summaryrefslogtreecommitdiff
path: root/CMakeLists.txt
diff options
context:
space:
mode:
Diffstat (limited to 'CMakeLists.txt')
-rw-r--r--CMakeLists.txt25
1 files changed, 16 insertions, 9 deletions
diff --git a/CMakeLists.txt b/CMakeLists.txt
index ab57900e..a5b41da3 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -7,6 +7,10 @@ project (Lagrange
7) 7)
8set (COPYRIGHT_YEAR 2020) 8set (COPYRIGHT_YEAR 2020)
9 9
10# Build configuration.
11option (ENABLE_KERNING "Enable kerning in font renderer (slower)" ON)
12option (ENABLE_RESOURCE_EMBED "Embed resources inside the executable" OFF)
13
10include (Embed.cmake) 14include (Embed.cmake)
11find_package (the_Foundation REQUIRED) 15find_package (the_Foundation REQUIRED)
12find_package (PkgConfig REQUIRED) 16find_package (PkgConfig REQUIRED)
@@ -15,11 +19,10 @@ pkg_check_modules (SDL2 REQUIRED sdl2)
15# Embedded resources are written to a generated source file. 19# Embedded resources are written to a generated source file.
16message (STATUS "Preparing embedded resources...") 20message (STATUS "Preparing embedded resources...")
17# Fonts are too large to comfortably embed as a C source. 21# Fonts are too large to comfortably embed as a C source.
18set (EMBED_IN_EXECUTABLE OFF CACHE BOOL "Embed resources inside the executable")
19set (EMBED_RESOURCES 22set (EMBED_RESOURCES
20 res/about.gmi 23 res/about/help.gmi
21 res/help.gmi 24 res/about/lagrange.gmi
22 res/version.gmi 25 res/about/version.gmi
23 res/SourceSansPro-Regular.ttf 26 res/SourceSansPro-Regular.ttf
24 res/FiraSans-Regular.ttf 27 res/FiraSans-Regular.ttf
25 res/FiraSans-Bold.ttf 28 res/FiraSans-Bold.ttf
@@ -34,12 +37,12 @@ set (EMBED_RESOURCES
34 endif () 37 endif ()
35embed_make (${EMBED_RESOURCES}) 38embed_make (${EMBED_RESOURCES})
36 39
37set (EMB_BIN ${CMAKE_CURRENT_BINARY_DIR}/resources.bin) 40set (EMB_BIN ${CMAKE_CURRENT_BINARY_DIR}/resources.binary)
38set_source_files_properties (${EMB_BIN} PROPERTIES MACOSX_PACKAGE_LOCATION Resources) 41set_source_files_properties (${EMB_BIN} PROPERTIES MACOSX_PACKAGE_LOCATION Resources)
39 42
40# Source files. 43# Source files.
41set (SOURCES 44set (SOURCES
42 ${CMAKE_CURRENT_BINARY_DIR}/resources.bin 45 ${CMAKE_CURRENT_BINARY_DIR}/resources.binary
43 ${CMAKE_CURRENT_BINARY_DIR}/embedded.c 46 ${CMAKE_CURRENT_BINARY_DIR}/embedded.c
44 ${CMAKE_CURRENT_BINARY_DIR}/embedded.h 47 ${CMAKE_CURRENT_BINARY_DIR}/embedded.h
45 src/main.c 48 src/main.c
@@ -92,7 +95,7 @@ set (SOURCES
92) 95)
93if (IOS) 96if (IOS)
94elseif (APPLE) 97elseif (APPLE)
95 list (APPEND SOURCES src/ui/macos.m src/ui/macos.h) 98 list (APPEND SOURCES src/macos.m src/macos.h)
96 list (APPEND RESOURCES "res/Lagrange.icns") 99 list (APPEND RESOURCES "res/Lagrange.icns")
97endif () 100endif ()
98if (MSYS) 101if (MSYS)
@@ -113,9 +116,13 @@ target_include_directories (app PUBLIC
113) 116)
114target_compile_options (app PUBLIC 117target_compile_options (app PUBLIC
115 -Werror=implicit-function-declaration 118 -Werror=implicit-function-declaration
119 -Werror=incompatible-pointer-types
116 ${SDL2_CFLAGS} 120 ${SDL2_CFLAGS}
117) 121)
118target_compile_definitions (app PUBLIC LAGRANGE_APP_VERSION="${PROJECT_VERSION}") 122target_compile_definitions (app PUBLIC LAGRANGE_APP_VERSION="${PROJECT_VERSION}")
123if (ENABLE_KERNING)
124 target_compile_definitions (app PUBLIC LAGRANGE_ENABLE_KERNING=1)
125endif ()
119target_link_libraries (app PUBLIC the_Foundation::the_Foundation) 126target_link_libraries (app PUBLIC the_Foundation::the_Foundation)
120target_link_libraries (app PUBLIC ${SDL2_LDFLAGS}) 127target_link_libraries (app PUBLIC ${SDL2_LDFLAGS})
121if (APPLE) 128if (APPLE)
@@ -145,7 +152,7 @@ endif ()
145# Deployment. 152# Deployment.
146if (MSYS) 153if (MSYS)
147 install (TARGETS app DESTINATION .) 154 install (TARGETS app DESTINATION .)
148 if (NOT EMBED_IN_EXECUTABLE) 155 if (NOT ENABLE_RESOURCE_EMBED)
149 install (FILES ${EMB_BIN} DESTINATION .) 156 install (FILES ${EMB_BIN} DESTINATION .)
150 endif () 157 endif ()
151 install (PROGRAMS 158 install (PROGRAMS
@@ -172,7 +179,7 @@ Icon=fi.skyjake.lagrange")
172 DESTINATION share/icons/hicolor/256x256/apps 179 DESTINATION share/icons/hicolor/256x256/apps
173 RENAME fi.skyjake.lagrange.png 180 RENAME fi.skyjake.lagrange.png
174 ) 181 )
175 if (NOT EMBED_IN_EXECUTABLE) 182 if (NOT ENABLE_RESOURCE_EMBED)
176 install (FILES ${EMB_BIN} DESTINATION share/lagrange) 183 install (FILES ${EMB_BIN} DESTINATION share/lagrange)
177 endif () 184 endif ()
178endif () 185endif ()