diff options
author | Jaakko Keränen <jaakko.keranen@iki.fi> | 2021-10-31 12:23:26 +0200 |
---|---|---|
committer | Jaakko Keränen <jaakko.keranen@iki.fi> | 2021-10-31 12:23:26 +0200 |
commit | 98f5ab5aa00f4d6b83079e6ee4e228b401356198 (patch) | |
tree | 3760877ce19431b821b66ae8b43a9fecea201460 /CMakeLists.txt | |
parent | a7596f683456da5274ecb33d4043a9eb47858c99 (diff) |
Changed format of resources.lgr
Resources are now stored in a ZIP archive, and it comes with an explicit version number. All the old embed/bincat stuff was removed as unnecessary.
resources.lgr is also a valid fontpack, for loading the built-in fonts.
IssueID #363
Diffstat (limited to 'CMakeLists.txt')
-rw-r--r-- | CMakeLists.txt | 45 |
1 files changed, 19 insertions, 26 deletions
diff --git a/CMakeLists.txt b/CMakeLists.txt index 4cafc4fa..77e25b45 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt | |||
@@ -18,7 +18,7 @@ | |||
18 | cmake_minimum_required (VERSION 3.9) | 18 | cmake_minimum_required (VERSION 3.9) |
19 | 19 | ||
20 | project (Lagrange | 20 | project (Lagrange |
21 | VERSION 1.8.1 | 21 | VERSION 1.9.0 |
22 | DESCRIPTION "A Beautiful Gemini Client" | 22 | DESCRIPTION "A Beautiful Gemini Client" |
23 | LANGUAGES C | 23 | LANGUAGES C |
24 | ) | 24 | ) |
@@ -29,7 +29,7 @@ if (IOS) | |||
29 | set (IOS_BUILD_DATE "2021-10-23") | 29 | set (IOS_BUILD_DATE "2021-10-23") |
30 | endif () | 30 | endif () |
31 | 31 | ||
32 | # Default that depend on environment. | 32 | # Defaults that depend on environment. |
33 | set (DEFAULT_RESIZE_DRAW ON) | 33 | set (DEFAULT_RESIZE_DRAW ON) |
34 | if (HAIKU) | 34 | if (HAIKU) |
35 | set (DEFAULT_RESIZE_DRAW OFF) | 35 | set (DEFAULT_RESIZE_DRAW OFF) |
@@ -52,20 +52,17 @@ option (ENABLE_MPG123 "Use mpg123 for decoding MPEG audio" ON) | |||
52 | option (ENABLE_POPUP_MENUS "Use popup windows for context menus (if OFF, menus are confined inside main window)" ON) | 52 | option (ENABLE_POPUP_MENUS "Use popup windows for context menus (if OFF, menus are confined inside main window)" ON) |
53 | option (ENABLE_RELATIVE_EMBED "Resources should always be found via relative path" OFF) | 53 | option (ENABLE_RELATIVE_EMBED "Resources should always be found via relative path" OFF) |
54 | option (ENABLE_RESIZE_DRAW "Force window to redraw during resizing" ${DEFAULT_RESIZE_DRAW}) | 54 | option (ENABLE_RESIZE_DRAW "Force window to redraw during resizing" ${DEFAULT_RESIZE_DRAW}) |
55 | option (ENABLE_RESOURCE_EMBED "Embed resources inside the executable" OFF) | ||
56 | option (ENABLE_WEBP "Use libwebp to decode .webp images (via pkg-config)" ON) | 55 | option (ENABLE_WEBP "Use libwebp to decode .webp images (via pkg-config)" ON) |
57 | option (ENABLE_WINDOWPOS_FIX "Set position after showing window (workaround for SDL bug)" OFF) | 56 | option (ENABLE_WINDOWPOS_FIX "Set position after showing window (workaround for SDL bug)" OFF) |
58 | option (ENABLE_X11_SWRENDER "Use software rendering (X11)" OFF) | 57 | option (ENABLE_X11_SWRENDER "Use software rendering (X11)" OFF) |
59 | 58 | ||
60 | include (BuildType.cmake) | 59 | include (BuildType.cmake) |
61 | include (res/Embed.cmake) | 60 | include (Resources.cmake) |
62 | include (res/Fontpack.cmake) | ||
63 | include (Depends.cmake) | 61 | include (Depends.cmake) |
64 | 62 | ||
65 | # Package resources. | 63 | # Package resources. |
66 | message (STATUS "Preparing resources...") | 64 | message (STATUS "Preparing resources...") |
67 | make_fontpack (res/default.fontpack) | 65 | set (RESOURCES |
68 | set (EMBED_RESOURCES | ||
69 | res/about/about.gmi | 66 | res/about/about.gmi |
70 | res/about/help.gmi | 67 | res/about/help.gmi |
71 | res/about/lagrange.gmi | 68 | res/about/lagrange.gmi |
@@ -92,12 +89,14 @@ set (EMBED_RESOURCES | |||
92 | res/lang/zh_Hans.bin | 89 | res/lang/zh_Hans.bin |
93 | res/lang/zh_Hant.bin | 90 | res/lang/zh_Hant.bin |
94 | res/shadow.png | 91 | res/shadow.png |
95 | ${CMAKE_BINARY_DIR}/default.fontpack | 92 | res/fontpack.ini |
96 | ) | 93 | ) |
94 | file (GLOB FONTS RELATIVE ${CMAKE_SOURCE_DIR} res/fonts/*) | ||
95 | list (APPEND RESOURCES ${FONTS}) | ||
97 | if ((UNIX AND NOT APPLE) OR MSYS) | 96 | if ((UNIX AND NOT APPLE) OR MSYS) |
98 | list (APPEND EMBED_RESOURCES res/lagrange-64.png) | 97 | list (APPEND RESOURCES res/lagrange-64.png) |
99 | endif () | 98 | endif () |
100 | embed_make (${EMBED_RESOURCES}) | 99 | make_resources (${CMAKE_CURRENT_BINARY_DIR}/resources.lgr ${RESOURCES}) |
101 | 100 | ||
102 | set (EMB_BIN ${CMAKE_CURRENT_BINARY_DIR}/resources.lgr) | 101 | set (EMB_BIN ${CMAKE_CURRENT_BINARY_DIR}/resources.lgr) |
103 | set_source_files_properties (${EMB_BIN} PROPERTIES MACOSX_PACKAGE_LOCATION Resources) | 102 | set_source_files_properties (${EMB_BIN} PROPERTIES MACOSX_PACKAGE_LOCATION Resources) |
@@ -142,6 +141,8 @@ set (SOURCES | |||
142 | src/periodic.h | 141 | src/periodic.h |
143 | src/prefs.c | 142 | src/prefs.c |
144 | src/prefs.h | 143 | src/prefs.h |
144 | src/resources.c | ||
145 | src/resources.h | ||
145 | src/sitespec.c | 146 | src/sitespec.c |
146 | src/sitespec.h | 147 | src/sitespec.h |
147 | src/stb_image.h | 148 | src/stb_image.h |
@@ -217,8 +218,6 @@ set (SOURCES | |||
217 | res/about/lagrange.gmi | 218 | res/about/lagrange.gmi |
218 | res/about/license.gmi | 219 | res/about/license.gmi |
219 | res/about/version.gmi | 220 | res/about/version.gmi |
220 | ${CMAKE_CURRENT_BINARY_DIR}/embedded.c | ||
221 | ${CMAKE_CURRENT_BINARY_DIR}/embedded.h | ||
222 | ${CMAKE_CURRENT_BINARY_DIR}/resources.lgr | 221 | ${CMAKE_CURRENT_BINARY_DIR}/resources.lgr |
223 | ) | 222 | ) |
224 | if (ENABLE_IPC) | 223 | if (ENABLE_IPC) |
@@ -417,9 +416,7 @@ if (MSYS) | |||
417 | if (TARGET PkgConfig::MPG123) | 416 | if (TARGET PkgConfig::MPG123) |
418 | install (PROGRAMS ${MPG123_LIBDIR}/../bin/msys-mpg123-0.dll DESTINATION .) | 417 | install (PROGRAMS ${MPG123_LIBDIR}/../bin/msys-mpg123-0.dll DESTINATION .) |
419 | endif () | 418 | endif () |
420 | if (NOT ENABLE_RESOURCE_EMBED) | 419 | install (FILES ${EMB_BIN} DESTINATION .) |
421 | install (FILES ${EMB_BIN} DESTINATION .) | ||
422 | endif () | ||
423 | install (PROGRAMS | 420 | install (PROGRAMS |
424 | ${SDL2_LIBDIR}/SDL2.dll | 421 | ${SDL2_LIBDIR}/SDL2.dll |
425 | res/urlopen.bat | 422 | res/urlopen.bat |
@@ -430,11 +427,9 @@ if (MSYS) | |||
430 | endif () | 427 | endif () |
431 | elseif (HAIKU) | 428 | elseif (HAIKU) |
432 | install (TARGETS app DESTINATION .) | 429 | install (TARGETS app DESTINATION .) |
433 | if (NOT ENABLE_RESOURCE_EMBED) | 430 | target_compile_definitions (app PUBLIC |
434 | target_compile_definitions (app PUBLIC | 431 | LAGRANGE_EMB_BIN="${CMAKE_INSTALL_PREFIX}/resources.lgr") |
435 | LAGRANGE_EMB_BIN="${CMAKE_INSTALL_PREFIX}/resources.lgr") | 432 | install (FILES ${EMB_BIN} DESTINATION .) |
436 | install (FILES ${EMB_BIN} DESTINATION .) | ||
437 | endif () | ||
438 | elseif (UNIX AND NOT APPLE) | 433 | elseif (UNIX AND NOT APPLE) |
439 | set_target_properties (app PROPERTIES | 434 | set_target_properties (app PROPERTIES |
440 | INSTALL_RPATH_USE_LINK_PATH YES | 435 | INSTALL_RPATH_USE_LINK_PATH YES |
@@ -460,11 +455,9 @@ MimeType=x-scheme-handler/gemini;x-scheme-handler/gopher | |||
460 | install (FILES res/fi.skyjake.Lagrange.appdata.xml | 455 | install (FILES res/fi.skyjake.Lagrange.appdata.xml |
461 | DESTINATION share/metainfo | 456 | DESTINATION share/metainfo |
462 | ) | 457 | ) |
463 | if (NOT ENABLE_RESOURCE_EMBED) | 458 | if (NOT ENABLE_RELATIVE_EMBED) |
464 | if (NOT ENABLE_RELATIVE_EMBED) | 459 | target_compile_definitions (app PUBLIC |
465 | target_compile_definitions (app PUBLIC | 460 | LAGRANGE_EMB_BIN="${CMAKE_INSTALL_PREFIX}/share/lagrange/resources.lgr") |
466 | LAGRANGE_EMB_BIN="${CMAKE_INSTALL_PREFIX}/share/lagrange/resources.lgr") | ||
467 | endif () | ||
468 | install (FILES ${EMB_BIN} DESTINATION share/lagrange) | ||
469 | endif () | 461 | endif () |
462 | install (FILES ${EMB_BIN} DESTINATION share/lagrange) | ||
470 | endif () | 463 | endif () |