diff options
Diffstat (limited to 'CMakeLists.txt')
-rw-r--r-- | CMakeLists.txt | 25 |
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 | ) |
8 | set (COPYRIGHT_YEAR 2020) | 8 | set (COPYRIGHT_YEAR 2020) |
9 | 9 | ||
10 | # Build configuration. | ||
11 | option (ENABLE_KERNING "Enable kerning in font renderer (slower)" ON) | ||
12 | option (ENABLE_RESOURCE_EMBED "Embed resources inside the executable" OFF) | ||
13 | |||
10 | include (Embed.cmake) | 14 | include (Embed.cmake) |
11 | find_package (the_Foundation REQUIRED) | 15 | find_package (the_Foundation REQUIRED) |
12 | find_package (PkgConfig REQUIRED) | 16 | find_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. |
16 | message (STATUS "Preparing embedded resources...") | 20 | message (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. |
18 | set (EMBED_IN_EXECUTABLE OFF CACHE BOOL "Embed resources inside the executable") | ||
19 | set (EMBED_RESOURCES | 22 | set (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 () |
35 | embed_make (${EMBED_RESOURCES}) | 38 | embed_make (${EMBED_RESOURCES}) |
36 | 39 | ||
37 | set (EMB_BIN ${CMAKE_CURRENT_BINARY_DIR}/resources.bin) | 40 | set (EMB_BIN ${CMAKE_CURRENT_BINARY_DIR}/resources.binary) |
38 | set_source_files_properties (${EMB_BIN} PROPERTIES MACOSX_PACKAGE_LOCATION Resources) | 41 | set_source_files_properties (${EMB_BIN} PROPERTIES MACOSX_PACKAGE_LOCATION Resources) |
39 | 42 | ||
40 | # Source files. | 43 | # Source files. |
41 | set (SOURCES | 44 | set (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 | ) |
93 | if (IOS) | 96 | if (IOS) |
94 | elseif (APPLE) | 97 | elseif (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") |
97 | endif () | 100 | endif () |
98 | if (MSYS) | 101 | if (MSYS) |
@@ -113,9 +116,13 @@ target_include_directories (app PUBLIC | |||
113 | ) | 116 | ) |
114 | target_compile_options (app PUBLIC | 117 | target_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 | ) |
118 | target_compile_definitions (app PUBLIC LAGRANGE_APP_VERSION="${PROJECT_VERSION}") | 122 | target_compile_definitions (app PUBLIC LAGRANGE_APP_VERSION="${PROJECT_VERSION}") |
123 | if (ENABLE_KERNING) | ||
124 | target_compile_definitions (app PUBLIC LAGRANGE_ENABLE_KERNING=1) | ||
125 | endif () | ||
119 | target_link_libraries (app PUBLIC the_Foundation::the_Foundation) | 126 | target_link_libraries (app PUBLIC the_Foundation::the_Foundation) |
120 | target_link_libraries (app PUBLIC ${SDL2_LDFLAGS}) | 127 | target_link_libraries (app PUBLIC ${SDL2_LDFLAGS}) |
121 | if (APPLE) | 128 | if (APPLE) |
@@ -145,7 +152,7 @@ endif () | |||
145 | # Deployment. | 152 | # Deployment. |
146 | if (MSYS) | 153 | if (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 () |
178 | endif () | 185 | endif () |