Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ CMAKE_C_COMPILER=clang
CMAKE_CXX_COMPILER=clang++
CMAKE_GENERATOR=Ninja
builtin_freetype=ON
builtin_ftgl=ON
builtin_gif=ON
builtin_gl2ps=ON
builtin_jpeg=ON
Expand Down
20 changes: 12 additions & 8 deletions builtins/freetype/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,8 @@

# **PLEASE UPDATE ALSO THE FOLLOWING LINE WHEN UPDATING THE VERSION**
# 22 Mar 2026, https://github.com/freetype/freetype/releases/tag/VER-2-14-3
set(FREETYPE_VERSION 2.14.3)
set(FREETYPE_HASH "e61b31ab26358b946e767ed7eb7f4bb2e507da1cfefeb7a8861ace7fd5c899a1")
set(ROOT_FREETYPE_VERSION 2.14.3)
set(ROOT_FREETYPE_HASH "e61b31ab26358b946e767ed7eb7f4bb2e507da1cfefeb7a8861ace7fd5c899a1")

set(FREETYPE_PREFIX ${CMAKE_BINARY_DIR}/builtins/FREETYPE-prefix)

Expand All @@ -34,8 +34,8 @@ set(FREETYPE_LIBRARY ${FREETYPE_PREFIX}/lib/${CMAKE_STATIC_LIBRARY_PREFIX}freety

ExternalProject_Add(
BUILTIN_FREETYPE
URL ${lcgpackages}/freetype-${FREETYPE_VERSION}.tar.gz
URL_HASH SHA256=${FREETYPE_HASH}
URL ${lcgpackages}/freetype-${ROOT_FREETYPE_VERSION}.tar.gz
URL_HASH SHA256=${ROOT_FREETYPE_HASH}
PREFIX ${FREETYPE_PREFIX}
CMAKE_ARGS -G ${CMAKE_GENERATOR}
-DCMAKE_POLICY_VERSION_MINIMUM=3.5
Expand Down Expand Up @@ -77,7 +77,11 @@ endif()

# Set the canonical output of find_package according to
# https://cmake.org/cmake/help/latest/manual/cmake-developer.7.html#standard-variable-names
set(FREETYPE_INCLUDE_DIRS ${incdir} PARENT_SCOPE)
set(FREETYPE_LIBRARIES ${FREETYPE_LIBRARY} PARENT_SCOPE)
set(Freetype_FOUND TRUE PARENT_SCOPE)
set(Freetype_VERSION ${FREETYPE_VERSION} PARENT_SCOPE)
# FindFreetype seems quite hacky (non-standard) https://github.com/Kitware/CMake/blob/0ea36ddcf68fc52c0a0cb6035b612817551ca8d7/Modules/FindFreetype.cmake#L120
set(FREETYPE_INCLUDE_DIRS ${incdir} PARENT_SCOPE) # FindFreetype.cmake seems to define capital (non-standard)
set(FREETYPE_LIBRARIES ${FREETYPE_LIBRARY} PARENT_SCOPE) # FindFreetype.cmake seems to define capital (non-standard)
set(FREETYPE_LIBRARY ${FREETYPE_LIBRARY} PARENT_SCOPE) # FindFreetype.cmake seems to read this as HINT (non-standard)
set(Freetype_FOUND TRUE PARENT_SCOPE) # FindFreetype.cmake added with standard case in CMake 3.3
set(FREETYPE_FOUND TRUE PARENT_SCOPE) # FindFreetype.cmake historical (non-standard, deprecated with 4.2)
set(Freetype_VERSION ${ROOT_FREETYPE_VERSION} PARENT_SCOPE) # FindFreetype.cmake added with standard case in CMake 4.2
set(FREETYPE_VERSION_STRING ${ROOT_FREETYPE_VERSION} PARENT_SCOPE) # FindFreetype.cmake historical (non-standard, deprecated with 4.2)
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
From b043877060efafcfa00f1d07c264d69e32e5d3a9 Mon Sep 17 00:00:00 2001
From: Frank Heckenbach <f.heckenbach@fh-soft.de>
Date: Tue, 21 May 2019 23:09:18 +0200
Subject: [PATCH] src/CMakeLists.txt: remove FTLibrary.h from
libftgl_la_SOURCES (it's only in ftgl_headers)

---
src/CMakeLists.txt | 1 -
1 file changed, 1 deletion(-)

diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt
index 693e49f..b0f26f6 100644
--- a/src/CMakeLists.txt
+++ b/src/CMakeLists.txt
@@ -26,7 +26,6 @@ SET(libftgl_la_SOURCES
FTGlyphContainer.h
FTInternals.h
FTLibrary.cpp
- FTLibrary.h
FTList.h
FTPoint.cpp
FTSize.cpp
--
2.34.1

39 changes: 39 additions & 0 deletions builtins/ftgl/0002-fix-type-error.patch
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
diff --git a/src/FTContour.cpp b/src/FTContour.cpp
Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@silverweed I got this patch from https://github.com/luadebug/xmake-repo/blob/66321835cb5e940f5997c10de515d50e91aaac47/packages/f/ftgl/patches/2.4.0/fix-type-error.patch

maybe you know of a good way to tune it to include your probably more accurate fixes from a028d13

index c668d32..ef13576 100644
--- a/src/FTContour.cpp
+++ b/src/FTContour.cpp
@@ -174,7 +174,7 @@ void FTContour::SetParity(int parity)
}


-FTContour::FTContour(FT_Vector* contour, char* tags, unsigned int n)
+FTContour::FTContour(FT_Vector* contour, unsigned char* tags, unsigned int n)
{
FTPoint prev, cur(contour[(n - 1) % n]), next(contour[0]);
double olddir, dir = atan2((next - cur).Y(), (next - cur).X());
diff --git a/src/FTContour.h b/src/FTContour.h
index d2d187c..dc64e3a 100644
--- a/src/FTContour.h
+++ b/src/FTContour.h
@@ -52,7 +52,7 @@ class FTContour
* @param pointTags
* @param numberOfPoints
*/
- FTContour(FT_Vector* contour, char* pointTags, unsigned int numberOfPoints);
+ FTContour(FT_Vector* contour, unsigned char* pointTags, unsigned int numberOfPoints);

/**
* Destructor
diff --git a/src/FTVectoriser.cpp b/src/FTVectoriser.cpp
index 26e7da8..53d738e 100644
--- a/src/FTVectoriser.cpp
+++ b/src/FTVectoriser.cpp
@@ -168,7 +168,7 @@ void FTVectoriser::ProcessContours()
for(int i = 0; i < ftContourCount; ++i)
{
FT_Vector* pointList = &outline.points[startIndex];
- char* tagList = &outline.tags[startIndex];
+ unsigned char* tagList = (unsigned char*)&outline.tags[startIndex];

endIndex = outline.contours[i];
contourLength = (endIndex - startIndex) + 1;
85 changes: 85 additions & 0 deletions builtins/ftgl/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,85 @@
# Copyright (C) 1995-2019, Rene Brun and Fons Rademakers.
# All rights reserved.
#
# For the licensing terms see $ROOTSYS/LICENSE.
# For the list of contributors see $ROOTSYS/README/CREDITS.

# **PLEASE UPDATE ALSO THE FOLLOWING LINE WHEN UPDATING THE VERSION**
# 7 Feb 2019, https://github.com/frankheckenbach/ftgl/releases/tag/v2.4.0
set(ROOT_FTGL_VERSION 2.4.0)
set(ROOT_FTGL_HASH "aa97da1c3442a8fd3941037655df18016d70b5266381c81d81e8b5335f196ea8")
# Cherry-pick https://github.com/frankheckenbach/ftgl/commit/835f2ba7911a6c15a1a314d5e3267fa089b5a319 :
set(ROOT_FTGL_PATCH_FILE_1 "${CMAKE_CURRENT_SOURCE_DIR}/0001-src-CMakeLists.txt-remove-FTLibrary.h-from-libftgl_l.patch")
# From https://github.com/frankheckenbach/ftgl/issues/22, see also https://github.com/xmake-io/xmake-repo/pull/9040/changes and https://github.com/root-project/root/commit/a028d13255f0c2d0c84f2e1b99ccb6a112598e0c
set(ROOT_FTGL_PATCH_FILE_2 "${CMAKE_CURRENT_SOURCE_DIR}/0002-fix-type-error.patch")
set(ROOT_FTGL_PREFIX ${CMAKE_BINARY_DIR}/builtins/FTGL-prefix)
set(ROOT_FTGL_LIBRARY ${ROOT_FTGL_PREFIX}/lib/${CMAKE_STATIC_LIBRARY_PREFIX}ftgl${CMAKE_STATIC_LIBRARY_SUFFIX})

include(ExternalProject)

# Clear cache variables set by find_package(FTGL)
# to ensure that we use the builtin version
foreach(var FTGL_LIBRARIES FTGL_LIBRARY FTGL_LIBRARY_DEBUG FTGL_LIBRARY_RELEASE FTGL_FOUND FTGL_VERSION FTGL_INCLUDE_DIR FTGL_LIBRARY FTGL_LIBRARIES)
unset(${var})
unset(${var} CACHE)
endforeach()

if(WIN32 AND NOT CMAKE_GENERATOR MATCHES Ninja)
if(winrtdebug)
set(ROOT_FTGL_BUILD_COMMAND_FLAGS "--config Debug")
else()
set(ROOT_FTGL_BUILD_COMMAND_FLAGS "--config $<IF:$<CONFIG:Debug,RelWithDebInfo>,RelWithDebInfo,Release>")
endif()
endif()

ExternalProject_Add(BUILTIN_FTGL
PREFIX ${ROOT_FTGL_PREFIX}
URL ${lcgpackages}/ftgl-${ROOT_FTGL_VERSION}.tar.gz
URL_HASH SHA256=${ROOT_FTGL_HASH}
PATCH_COMMAND git apply ${ROOT_FTGL_PATCH_FILE_1} ${ROOT_FTGL_PATCH_FILE_2}

LOG_DOWNLOAD TRUE
LOG_CONFIGURE TRUE
LOG_BUILD TRUE
LOG_INSTALL TRUE
LOG_OUTPUT_ON_FAILURE TRUE

CMAKE_ARGS -G ${CMAKE_GENERATOR}
-DCMAKE_INSTALL_PREFIX:PATH=<INSTALL_DIR>
-DCMAKE_BUILD_TYPE:STRING=${CMAKE_BUILD_TYPE}
-DCMAKE_C_COMPILER:STRING=${CMAKE_C_COMPILER}
-DCMAKE_CXX_COMPILER:STRING=${CMAKE_CXX_COMPILER}
-DBUILD_SHARED_LIBS:BOOL=FALSE
-DCMAKE_POSITION_INDEPENDENT_CODE:BOOL=TRUE
-DCMAKE_POLICY_VERSION_MINIMUM=3.5
-DFREETYPE_LIBRARY=${FREETYPE_LIBRARY} # Seems to be needed for Win32 (CMake 3.30 Freetype.cmake)
-DFREETYPE_INCLUDE_DIRS=${FREETYPE_INCLUDE_DIRS} # Seems to be needed for Win32 (CMake 3.30 Freetype.cmake)
-DFREETYPE_DIR=${FREETYPE_INCLUDE_DIRS}/../ # Seems to be needed for Win32 (CMake 3.30 Freetype.cmake)
BUILD_COMMAND ${CMAKE_COMMAND} --build . ${ROOT_FTGL_BUILD_COMMAND_FLAGS}
INSTALL_COMMAND ${CMAKE_COMMAND} --build . ${ROOT_FTGL_BUILD_COMMAND_FLAGS} --target install
BUILD_BYPRODUCTS
${ROOT_FTGL_LIBRARY}
TIMEOUT 600
)

file(MAKE_DIRECTORY ${ROOT_FTGL_PREFIX}/include)
add_library(FTGL::FTGL IMPORTED STATIC GLOBAL)
add_dependencies(FTGL::FTGL BUILTIN_FTGL)
set_target_properties(FTGL::FTGL PROPERTIES
IMPORTED_LOCATION ${ROOT_FTGL_LIBRARY}
INTERFACE_INCLUDE_DIRECTORIES ${ROOT_FTGL_PREFIX}/include)
target_compile_definitions(FTGL::FTGL INTERFACE FTGL_LIBRARY_STATIC) # needed for Win32 since public flag is not correctly propagated to parent scope (BUILD_SHARED_LIBS works fine for building but when installing, flag info is lost)
if(builtin_freetype)
add_dependencies(BUILTIN_FTGL BUILTIN_FREETYPE)
endif()
if(builin_zlib)
add_dependencies(BUILTIN_FTGL BUILTIN_ZLIB)
endif()
target_link_libraries(FTGL::FTGL INTERFACE Freetype::Freetype) # private: OpenGL::GL OpenGL::GLU ZLIB::ZLIB

# Set the canonical output of find_package according to
# https://cmake.org/cmake/help/latest/manual/cmake-developer.7.html#standard-variable-names
set(FTGL_INCLUDE_DIRS ${ROOT_FTGL_PREFIX}/include PARENT_SCOPE)
set(FTGL_LIBRARIES ${ROOT_FTGL_LIBRARY} PARENT_SCOPE)
set(FTGL_FOUND TRUE PARENT_SCOPE)
set(FTGL_VERSION ${ROOT_FTGL_VERSION} PARENT_SCOPE)
9 changes: 9 additions & 0 deletions cmake/modules/FindFTGL.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -25,3 +25,12 @@ set(FTGL_LIBRARIES ${FTGL_LIBRARY})
include(FindPackageHandleStandardArgs)
find_package_handle_standard_args(FTGL DEFAULT_MSG FTGL_INCLUDE_DIR FTGL_LIBRARY)
mark_as_advanced(FTGL_FOUND FTGL_INCLUDE_DIR FTGL_LIBRARY)

if(FTGL_FOUND)
if(NOT TARGET FTGL::FTGL)
add_library(FTGL::FTGL UNKNOWN IMPORTED)
set_target_properties(FTGL::FTGL PROPERTIES
IMPORTED_LOCATION "${FTGL_LIBRARY}"
INTERFACE_INCLUDE_DIRECTORIES "${FTGL_INCLUDE_DIRS}")
endif()
endif()
29 changes: 7 additions & 22 deletions cmake/modules/SearchInstalledSoftware.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -818,29 +818,14 @@ if(dcache)
endif()

#---Check for ftgl if needed----------------------------------------------------------
if(opengl AND NOT builtin_ftgl)
find_package(FTGL)
if(NOT FTGL_FOUND)
if(fail-on-missing)
message(SEND_ERROR "ftgl library not found and is required ('builtin_ftgl' is OFF). Set variable FTGL_ROOT_DIR to installation location")
else()
message(STATUS "ftgl library not found. Set variable FTGL_ROOT_DIR to point to your installation")
message(STATUS "For the time being switching ON 'builtin_ftgl' option")
set(builtin_ftgl ON CACHE BOOL "Enabled because ftgl not found but opengl requested (${builtin_ftgl_description})" FORCE)
endif()
if(opengl)
ROOT_FIND_REQUIRED_DEP(FTGL builtin_ftgl)
if (builtin_ftgl)
add_subdirectory(builtins/ftgl)
list(APPEND ROOT_BUILTINS BUILTIN_FTGL)
endif()
endif()

if(builtin_ftgl)
# clear variables set to NOTFOUND to allow builtin FTGL to override them
foreach(var FTGL_LIBRARIES FTGL_LIBRARY FTGL_LIBRARY_DEBUG FTGL_LIBRARY_RELEASE)
unset(${var})
unset(${var} CACHE)
endforeach()
set(FTGL_INCLUDE_DIR ${CMAKE_SOURCE_DIR}/graf3d/ftgl/inc)
set(FTGL_INCLUDE_DIRS ${CMAKE_SOURCE_DIR}/graf3d/ftgl/inc)
set(FTGL_CFLAGS -DBUILTIN_FTGL)
set(FTGL_LIBRARIES FTGL)
elseif(builtin_ftgl)
message(SEND_ERROR "FTGL features enabled with \"builtin_ftgl=ON\" require \"opengl=ON\"")
endif()

#---Check for R/Rcpp/RInside--------------------------------------------------------------------
Expand Down
9 changes: 5 additions & 4 deletions graf2d/asimage/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -26,17 +26,18 @@ ROOT_STANDARD_LIBRARY_PACKAGE(ASImage
-writeEmptyRootPCM
LIBRARIES
libAfterImage
${ASEXTRA_LIBRARIES}
${FREETYPE_LIBRARIES}
${X11_LIBRARIES}
JPEG::JPEG
PNG::PNG
GIF::GIF
libAfterImage
Freetype::Freetype
ZLIB::ZLIB
DEPENDENCIES
Core
Graf
Postscript
)

target_link_libraries(ASImage PRIVATE JPEG::JPEG PNG::PNG GIF::GIF libAfterImage Freetype::Freetype)
if (x11)
target_link_libraries(ASImage PRIVATE X11::X11)
endif()
Expand Down
3 changes: 0 additions & 3 deletions graf3d/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -12,9 +12,6 @@ endif()
add_subdirectory(csg) # special CMakeLists.txt

if (opengl)
if(builtin_ftgl)
add_subdirectory(ftgl)
endif()
if(geom)
add_subdirectory(eve)
add_subdirectory(gviz3d)
Expand Down
56 changes: 0 additions & 56 deletions graf3d/ftgl/CMakeLists.txt

This file was deleted.

Loading
Loading