Skip to content

Commit e8ddf11

Browse files
committed
[ftgl] Download instead of bundle and bump from 2.1.2 to 2.4, and use CMake target
[ftgl] try to fix win32 find-package error [ftgl] patch to fix win32 compilation error [ftgl] fix win32 static flag Attempt to fix Creating library C:/ROOT-CI/build/lib/libRGL.lib and object C:/ROOT-CI/build/lib/libRGL.exp TGLFontManager.obj : error LNK2019: unresolved external symbol "__declspec(dllimport) public: void __thiscall FTFont::BBox(char const *,float &,float &,float &,float &,float &,float &)" (__imp_?BBox@FTFont@@QAEXPBDAAM11111@Z) referenced in function "private: void __thiscall TGLFont::RenderHelper<char>(char const *,double,double,double,double)const " (??$RenderHelper@D@TGLFont@@ABEXPBDNNNN@Z) [C:\ROOT-CI\build\graf3d\gl\RGL.vcxproj] TGLText.obj : error LNK2001: unresolved external symbol "__declspec(dllimport) public: void __thiscall FTFont::BBox(char const *,float &,float &,float &,float &,float &,float &)" (__imp_?BBox@FTFont@@QAEXPBDAAM11111@Z) [C:\ROOT-CI\build\graf3d\gl\RGL.vcxproj] TGLFontManager.obj : error LNK2019: unresolved external symbol "__declspec(dllimport) public: void __thiscall FTFont::BBox(wchar_t const *,float &,float &,float &,float &,float &,float &)" (__imp_?BBox@FTFont@@QAEXPB_WAAM11111@Z) referenced in function "private: void __thiscall TGLFont::RenderHelper<wchar_t>(wchar_t const *,double,double,double,double)const " (??$RenderHelper@_W@TGLFont@@ABEXPB_WNNNN@Z) [C:\ROOT-CI\build\graf3d\gl\RGL.vcxproj] C:\ROOT-CI\build\bin\libRGL.dll : fatal error LNK1120: 2 unresolved externals [C:\ROOT-CI\build\graf3d\gl\RGL.vcxproj] because FLAG not propagated, they only use local add_definitions (CMake 2.8) rather than target-based
1 parent 0764807 commit e8ddf11

60 files changed

Lines changed: 172 additions & 5316 deletions

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

.github/workflows/root-ci-config/buildconfig/alma10-clang_ninja.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@ CMAKE_C_COMPILER=clang
22
CMAKE_CXX_COMPILER=clang++
33
CMAKE_GENERATOR=Ninja
44
builtin_freetype=ON
5+
builtin_ftgl=ON
56
builtin_gif=ON
67
builtin_jpeg=ON
78
builtin_lz4=ON
Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
From b043877060efafcfa00f1d07c264d69e32e5d3a9 Mon Sep 17 00:00:00 2001
2+
From: Frank Heckenbach <f.heckenbach@fh-soft.de>
3+
Date: Tue, 21 May 2019 23:09:18 +0200
4+
Subject: [PATCH] src/CMakeLists.txt: remove FTLibrary.h from
5+
libftgl_la_SOURCES (it's only in ftgl_headers)
6+
7+
---
8+
src/CMakeLists.txt | 1 -
9+
1 file changed, 1 deletion(-)
10+
11+
diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt
12+
index 693e49f..b0f26f6 100644
13+
--- a/src/CMakeLists.txt
14+
+++ b/src/CMakeLists.txt
15+
@@ -26,7 +26,6 @@ SET(libftgl_la_SOURCES
16+
FTGlyphContainer.h
17+
FTInternals.h
18+
FTLibrary.cpp
19+
- FTLibrary.h
20+
FTList.h
21+
FTPoint.cpp
22+
FTSize.cpp
23+
--
24+
2.34.1
25+
Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,39 @@
1+
diff --git a/src/FTContour.cpp b/src/FTContour.cpp
2+
index c668d32..ef13576 100644
3+
--- a/src/FTContour.cpp
4+
+++ b/src/FTContour.cpp
5+
@@ -174,7 +174,7 @@ void FTContour::SetParity(int parity)
6+
}
7+
8+
9+
-FTContour::FTContour(FT_Vector* contour, char* tags, unsigned int n)
10+
+FTContour::FTContour(FT_Vector* contour, unsigned char* tags, unsigned int n)
11+
{
12+
FTPoint prev, cur(contour[(n - 1) % n]), next(contour[0]);
13+
double olddir, dir = atan2((next - cur).Y(), (next - cur).X());
14+
diff --git a/src/FTContour.h b/src/FTContour.h
15+
index d2d187c..dc64e3a 100644
16+
--- a/src/FTContour.h
17+
+++ b/src/FTContour.h
18+
@@ -52,7 +52,7 @@ class FTContour
19+
* @param pointTags
20+
* @param numberOfPoints
21+
*/
22+
- FTContour(FT_Vector* contour, char* pointTags, unsigned int numberOfPoints);
23+
+ FTContour(FT_Vector* contour, unsigned char* pointTags, unsigned int numberOfPoints);
24+
25+
/**
26+
* Destructor
27+
diff --git a/src/FTVectoriser.cpp b/src/FTVectoriser.cpp
28+
index 26e7da8..53d738e 100644
29+
--- a/src/FTVectoriser.cpp
30+
+++ b/src/FTVectoriser.cpp
31+
@@ -168,7 +168,7 @@ void FTVectoriser::ProcessContours()
32+
for(int i = 0; i < ftContourCount; ++i)
33+
{
34+
FT_Vector* pointList = &outline.points[startIndex];
35+
- char* tagList = &outline.tags[startIndex];
36+
+ unsigned char* tagList = (unsigned char*)&outline.tags[startIndex];
37+
38+
endIndex = outline.contours[i];
39+
contourLength = (endIndex - startIndex) + 1;

builtins/ftgl/CMakeLists.txt

Lines changed: 85 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,85 @@
1+
# Copyright (C) 1995-2019, Rene Brun and Fons Rademakers.
2+
# All rights reserved.
3+
#
4+
# For the licensing terms see $ROOTSYS/LICENSE.
5+
# For the list of contributors see $ROOTSYS/README/CREDITS.
6+
7+
# **PLEASE UPDATE ALSO THE FOLLOWING LINE WHEN UPDATING THE VERSION**
8+
# 7 Feb 2019, https://github.com/frankheckenbach/ftgl/releases/tag/v2.4.0
9+
set(ROOT_FTGL_VERSION 2.4.0)
10+
set(ROOT_FTGL_HASH "aa97da1c3442a8fd3941037655df18016d70b5266381c81d81e8b5335f196ea8")
11+
# Cherry-pick https://github.com/frankheckenbach/ftgl/commit/835f2ba7911a6c15a1a314d5e3267fa089b5a319 :
12+
set(ROOT_FTGL_PATCH_FILE_1 "${CMAKE_CURRENT_SOURCE_DIR}/0001-src-CMakeLists.txt-remove-FTLibrary.h-from-libftgl_l.patch")
13+
# 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
14+
set(ROOT_FTGL_PATCH_FILE_2 "${CMAKE_CURRENT_SOURCE_DIR}/0002-fix-type-error.patch")
15+
set(ROOT_FTGL_PREFIX ${CMAKE_BINARY_DIR}/builtins/FTGL-prefix)
16+
set(ROOT_FTGL_LIBRARY ${ROOT_FTGL_PREFIX}/lib/${CMAKE_STATIC_LIBRARY_PREFIX}ftgl${CMAKE_STATIC_LIBRARY_SUFFIX})
17+
18+
include(ExternalProject)
19+
20+
# Clear cache variables set by find_package(FTGL)
21+
# to ensure that we use the builtin version
22+
foreach(var FTGL_LIBRARIES FTGL_LIBRARY FTGL_LIBRARY_DEBUG FTGL_LIBRARY_RELEASE FTGL_FOUND FTGL_VERSION FTGL_INCLUDE_DIR FTGL_LIBRARY FTGL_LIBRARIES)
23+
unset(${var})
24+
unset(${var} CACHE)
25+
endforeach()
26+
27+
if(WIN32 AND NOT CMAKE_GENERATOR MATCHES Ninja)
28+
if(winrtdebug)
29+
set(ROOT_FTGL_BUILD_COMMAND_FLAGS "--config Debug")
30+
else()
31+
set(ROOT_FTGL_BUILD_COMMAND_FLAGS "--config $<IF:$<CONFIG:Debug,RelWithDebInfo>,RelWithDebInfo,Release>")
32+
endif()
33+
endif()
34+
35+
ExternalProject_Add(BUILTIN_FTGL
36+
PREFIX ${ROOT_FTGL_PREFIX}
37+
URL ${lcgpackages}/ftgl-${ROOT_FTGL_VERSION}.tar.gz
38+
URL_HASH SHA256=${ROOT_FTGL_HASH}
39+
PATCH_COMMAND git apply ${ROOT_FTGL_PATCH_FILE_1} ${ROOT_FTGL_PATCH_FILE_2}
40+
41+
LOG_DOWNLOAD TRUE
42+
LOG_CONFIGURE TRUE
43+
LOG_BUILD TRUE
44+
LOG_INSTALL TRUE
45+
LOG_OUTPUT_ON_FAILURE TRUE
46+
47+
CMAKE_ARGS -G ${CMAKE_GENERATOR}
48+
-DCMAKE_INSTALL_PREFIX:PATH=<INSTALL_DIR>
49+
-DCMAKE_BUILD_TYPE:STRING=${CMAKE_BUILD_TYPE}
50+
-DCMAKE_C_COMPILER:STRING=${CMAKE_C_COMPILER}
51+
-DCMAKE_CXX_COMPILER:STRING=${CMAKE_CXX_COMPILER}
52+
-DBUILD_SHARED_LIBS:BOOL=FALSE
53+
-DCMAKE_POSITION_INDEPENDENT_CODE:BOOL=TRUE
54+
-DCMAKE_POLICY_VERSION_MINIMUM=3.5
55+
-DFREETYPE_LIBRARY=${FREETYPE_LIBRARY} # Seems to be needed for Win32 (CMake 3.30 Freetype.cmake)
56+
-DFREETYPE_INCLUDE_DIRS=${FREETYPE_INCLUDE_DIRS} # Seems to be needed for Win32 (CMake 3.30 Freetype.cmake)
57+
-DFREETYPE_DIR=${FREETYPE_INCLUDE_DIRS}/../ # Seems to be needed for Win32 (CMake 3.30 Freetype.cmake)
58+
BUILD_COMMAND ${CMAKE_COMMAND} --build . ${ROOT_FTGL_BUILD_COMMAND_FLAGS}
59+
INSTALL_COMMAND ${CMAKE_COMMAND} --build . ${ROOT_FTGL_BUILD_COMMAND_FLAGS} --target install
60+
BUILD_BYPRODUCTS
61+
${ROOT_FTGL_LIBRARY}
62+
TIMEOUT 600
63+
)
64+
65+
file(MAKE_DIRECTORY ${ROOT_FTGL_PREFIX}/include)
66+
add_library(FTGL::FTGL IMPORTED STATIC GLOBAL)
67+
add_dependencies(FTGL::FTGL BUILTIN_FTGL)
68+
set_target_properties(FTGL::FTGL PROPERTIES
69+
IMPORTED_LOCATION ${ROOT_FTGL_LIBRARY}
70+
INTERFACE_INCLUDE_DIRECTORIES ${ROOT_FTGL_PREFIX}/include)
71+
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)
72+
if(builtin_freetype)
73+
add_dependencies(BUILTIN_FTGL BUILTIN_FREETYPE)
74+
endif()
75+
if(builin_zlib)
76+
add_dependencies(BUILTIN_FTGL BUILTIN_ZLIB)
77+
endif()
78+
target_link_libraries(FTGL::FTGL INTERFACE Freetype::Freetype) # private: OpenGL::GL OpenGL::GLU ZLIB::ZLIB
79+
80+
# Set the canonical output of find_package according to
81+
# https://cmake.org/cmake/help/latest/manual/cmake-developer.7.html#standard-variable-names
82+
set(FTGL_INCLUDE_DIRS ${ROOT_FTGL_PREFIX}/include PARENT_SCOPE)
83+
set(FTGL_LIBRARIES ${ROOT_FTGL_LIBRARY} PARENT_SCOPE)
84+
set(FTGL_FOUND TRUE PARENT_SCOPE)
85+
set(FTGL_VERSION ${ROOT_FTGL_VERSION} PARENT_SCOPE)

cmake/modules/FindFTGL.cmake

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,3 +25,12 @@ set(FTGL_LIBRARIES ${FTGL_LIBRARY})
2525
include(FindPackageHandleStandardArgs)
2626
find_package_handle_standard_args(FTGL DEFAULT_MSG FTGL_INCLUDE_DIR FTGL_LIBRARY)
2727
mark_as_advanced(FTGL_FOUND FTGL_INCLUDE_DIR FTGL_LIBRARY)
28+
29+
if(FTGL_FOUND)
30+
if(NOT TARGET FTGL::FTGL)
31+
add_library(FTGL::FTGL UNKNOWN IMPORTED)
32+
set_target_properties(FTGL::FTGL PROPERTIES
33+
IMPORTED_LOCATION "${FTGL_LIBRARY}"
34+
INTERFACE_INCLUDE_DIRECTORIES "${FTGL_INCLUDE_DIRS}")
35+
endif()
36+
endif()

cmake/modules/SearchInstalledSoftware.cmake

Lines changed: 9 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -109,6 +109,7 @@ foreach(suffix FOUND INCLUDE_DIR LIBRARY LIBRARY_DEBUG LIBRARY_RELEASE LIBRARIES
109109
endforeach()
110110

111111
# Request explicit user opt-in for required dependencies
112+
ROOT_FIND_REQUIRED_DEP(Freetype builtin_freetype)
112113
if(asimage)
113114
ROOT_FIND_REQUIRED_DEP(GIF builtin_gif)
114115
ROOT_FIND_REQUIRED_DEP(JPEG builtin_jpeg)
@@ -821,29 +822,14 @@ if(dcache)
821822
endif()
822823

823824
#---Check for ftgl if needed----------------------------------------------------------
824-
if(opengl AND NOT builtin_ftgl)
825-
find_package(FTGL)
826-
if(NOT FTGL_FOUND)
827-
if(fail-on-missing)
828-
message(SEND_ERROR "ftgl library not found and is required ('builtin_ftgl' is OFF). Set variable FTGL_ROOT_DIR to installation location")
829-
else()
830-
message(STATUS "ftgl library not found. Set variable FTGL_ROOT_DIR to point to your installation")
831-
message(STATUS "For the time being switching ON 'builtin_ftgl' option")
832-
set(builtin_ftgl ON CACHE BOOL "Enabled because ftgl not found but opengl requested (${builtin_ftgl_description})" FORCE)
833-
endif()
834-
endif()
835-
endif()
836-
837-
if(builtin_ftgl)
838-
# clear variables set to NOTFOUND to allow builtin FTGL to override them
839-
foreach(var FTGL_LIBRARIES FTGL_LIBRARY FTGL_LIBRARY_DEBUG FTGL_LIBRARY_RELEASE)
840-
unset(${var})
841-
unset(${var} CACHE)
842-
endforeach()
843-
set(FTGL_INCLUDE_DIR ${CMAKE_SOURCE_DIR}/graf3d/ftgl/inc)
844-
set(FTGL_INCLUDE_DIRS ${CMAKE_SOURCE_DIR}/graf3d/ftgl/inc)
845-
set(FTGL_CFLAGS -DBUILTIN_FTGL)
846-
set(FTGL_LIBRARIES FTGL)
825+
if(opengl)
826+
ROOT_FIND_REQUIRED_DEP(FTGL builtin_ftgl)
827+
if (builtin_ftgl)
828+
add_subdirectory(builtins/ftgl)
829+
list(APPEND ROOT_BUILTINS BUILTIN_FTGL)
830+
endif()
831+
elseif(builtin_ftgl)
832+
message(SEND_ERROR "FTGL features enabled with \"builtin_ftgl=ON\" require \"opengl=ON\"")
847833
endif()
848834

849835
#---Check for R/Rcpp/RInside--------------------------------------------------------------------

graf3d/CMakeLists.txt

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -12,9 +12,6 @@ endif()
1212
add_subdirectory(csg) # special CMakeLists.txt
1313

1414
if (opengl)
15-
if(builtin_ftgl)
16-
add_subdirectory(ftgl)
17-
endif()
1815
if(geom)
1916
add_subdirectory(eve)
2017
add_subdirectory(gviz3d)

graf3d/ftgl/CMakeLists.txt

Lines changed: 0 additions & 56 deletions
This file was deleted.

0 commit comments

Comments
 (0)