Skip to content

Commit baed086

Browse files
committed
#585 freetype statically linked.
1 parent 303fe21 commit baed086

5 files changed

Lines changed: 81 additions & 12 deletions

File tree

tcMenuNative/.idea/editor.xml

Lines changed: 63 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

tcMenuNative/CMakeLists.txt

Lines changed: 9 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,15 @@
11
#
22
# This build file should work of all platforms, although presently tested on MacOSX and Windows. On Windows it requires
3-
# that you have built the FreeType package yourself, whereas on MacOS this package would normally be available if you
4-
# have C++ developer tools installed. You may need to set FREETYPE_DIR yourself and on Windows it is assumed that the
5-
# statically linked library is available there.
3+
# that you have built the FreeType package yourself. On Windows and macOS it is assumed that the statically linked
4+
# FreeType library is available in the packaged directory for the platform.
65
#
76

87
cmake_minimum_required(VERSION 3.27)
98
project(tcMenuNative)
109
set(CMAKE_CXX_STANDARD 17)
1110
SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -DLIBRARY_EXPORTS=1")
1211

13-
# On unix systems freetype will generally be available when developer tools are installed. We find it.
14-
if(UNIX)
12+
if(UNIX AND NOT APPLE)
1513
find_package(Freetype REQUIRED)
1614
find_package(PNG REQUIRED)
1715
find_package(ZLIB REQUIRED)
@@ -21,13 +19,17 @@ endif()
2119
add_library(tcMenuNative SHARED library.cpp FreeFontHandler.cpp)
2220

2321
# Pull in the free type headers.
24-
if(UNIX)
22+
if(APPLE)
23+
target_include_directories(tcMenuNative PRIVATE ${FREETYPE_DIR})
24+
elseif(UNIX)
2525
target_include_directories(tcMenuNative PRIVATE ${FREETYPE_INCLUDE_DIRS})
2626
else ()
2727
target_include_directories(tcMenuNative PRIVATE ${FREETYPE_DIR})
2828
endif ()
2929

30-
if(UNIX)
30+
if(APPLE)
31+
target_link_libraries(tcMenuNative "${CMAKE_CURRENT_SOURCE_DIR}/packaged/mac/libfreetype.a")
32+
elseif(UNIX)
3133
# On unix we need to link against the three libraries needed by freetype, these were found above using find_package
3234
target_link_libraries(tcMenuNative
3335
${FREETYPE_LIBRARIES}

tcMenuNative/README.md

Lines changed: 9 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -6,15 +6,19 @@ Once you've built a release build, it is your responsibility to test it, and tha
66

77
Once it is tested, replace the output DLL/DynLib/so file in the packaged directory.
88

9-
## Windows
9+
## Windows and MacOS
1010

11-
Use the Visual Studio toolchain as the dependencies it creates are on nearly all Windows boxes.
11+
On Windows use the Visual Studio toolchain as the dependencies it creates are on nearly all Windows boxes.
1212

13-
First you need a statically linked version of the freetype library, this is generally achieved by building the free type source with the static linking options enabled.
13+
On MacOS use the standard apple toolchain for the same reason.
1414

15-
## MacOS
15+
First, you need a statically linked version of the freetype library, this is generally achieved by building the free type source with the static linking options enabled.
1616

17-
Ensure XCode is installed. Beyond this the library should build in release mode with no further options
17+
Now indicate where to find the includes as an option:
18+
19+
-FREETYPE_DIR=/myUserDir/source/freetype/include
20+
21+
Make sure that you build a release version, it will be 10x smaller than a debug build.
1822

1923
## Linux Ubuntu
2024

1.86 MB
Binary file not shown.
638 KB
Binary file not shown.

0 commit comments

Comments
 (0)