summaryrefslogtreecommitdiff
path: root/CMakeLists.txt
diff options
context:
space:
mode:
Diffstat (limited to 'CMakeLists.txt')
-rw-r--r--CMakeLists.txt71
1 files changed, 57 insertions, 14 deletions
diff --git a/CMakeLists.txt b/CMakeLists.txt
index 9d421fe2..1bb50791 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -18,22 +18,31 @@
18cmake_minimum_required (VERSION 3.9) 18cmake_minimum_required (VERSION 3.9)
19 19
20project (Lagrange 20project (Lagrange
21 VERSION 1.9.5 21 VERSION 1.10.0
22 DESCRIPTION "A Beautiful Gemini Client" 22 DESCRIPTION "A Beautiful Gemini Client"
23 LANGUAGES C 23 LANGUAGES C
24) 24)
25set (COPYRIGHT_YEAR 2022) 25set (COPYRIGHT_YEAR 2022)
26if (IOS) 26if (IOS)
27 set (PROJECT_VERSION 1.7) 27 set (PROJECT_VERSION 1.10)
28 set (IOS_BUNDLE_VERSION 23) 28 set (IOS_BUNDLE_VERSION 9)
29 set (IOS_BUILD_DATE "2021-10-23") 29 set (IOS_BUILD_DATE "2022-01-01")
30endif ()
31if (ANDROID)
32 set (PROJECT_VERSION 1.10)
33 set (ANDROID_BUILD_VERSION a3) # remember to update Gradle, AndroidManifest.xml
34 set (ANDROID_BUILD_DATE "2022-01-03")
30endif () 35endif ()
31 36
32# Defaults that depend on environment. 37# Defaults that depend on environment.
33set (DEFAULT_RESIZE_DRAW ON) 38set (DEFAULT_RESIZE_DRAW ON)
34if (HAIKU) 39if (HAIKU OR ANDROID)
35 set (DEFAULT_RESIZE_DRAW OFF) 40 set (DEFAULT_RESIZE_DRAW OFF)
36endif () 41endif ()
42set (DEFAULT_IDLE_SLEEP OFF)
43if (IOS)
44 set (DEFAULT_IDLE_SLEEP ON)
45endif ()
37 46
38# Build configuration. 47# Build configuration.
39option (ENABLE_CUSTOM_FRAME "Draw a custom window frame (Windows)" OFF) 48option (ENABLE_CUSTOM_FRAME "Draw a custom window frame (Windows)" OFF)
@@ -42,7 +51,7 @@ option (ENABLE_FRIBIDI "Use the GNU FriBidi library for bidirectional t
42option (ENABLE_FRIBIDI_BUILD "Build the GNU FriBidi library (if OFF, try pkg-config)" OFF) 51option (ENABLE_FRIBIDI_BUILD "Build the GNU FriBidi library (if OFF, try pkg-config)" OFF)
43option (ENABLE_HARFBUZZ "Use the HarfBuzz library to shape text" ON) 52option (ENABLE_HARFBUZZ "Use the HarfBuzz library to shape text" ON)
44option (ENABLE_HARFBUZZ_MINIMAL "Build the HarfBuzz library with minimal dependencies (if OFF, try pkg-config)" OFF) 53option (ENABLE_HARFBUZZ_MINIMAL "Build the HarfBuzz library with minimal dependencies (if OFF, try pkg-config)" OFF)
45option (ENABLE_IDLE_SLEEP "While idle, sleep in the main thread instead of waiting for events" ON) 54option (ENABLE_IDLE_SLEEP "While idle, sleep in the main thread instead of waiting for events" ${DEFAULT_IDLE_SLEEP})
46option (ENABLE_IPC "Use IPC to communicate between running instances" ON) 55option (ENABLE_IPC "Use IPC to communicate between running instances" ON)
47option (ENABLE_KERNING "Enable kerning in font renderer (slower)" ON) 56option (ENABLE_KERNING "Enable kerning in font renderer (slower)" ON)
48option (ENABLE_MAC_MENUS "Use native context menus (macOS)" ON) 57option (ENABLE_MAC_MENUS "Use native context menus (macOS)" ON)
@@ -66,11 +75,8 @@ include (Depends.cmake)
66message (STATUS "Preparing resources...") 75message (STATUS "Preparing resources...")
67set (RESOURCES 76set (RESOURCES
68 res/about/about.gmi 77 res/about/about.gmi
69 res/about/help.gmi
70 res/about/lagrange.gmi 78 res/about/lagrange.gmi
71 res/about/license.gmi 79 res/about/license.gmi
72 res/about/version.gmi
73 res/arg-help.txt
74 res/lang/cs.bin 80 res/lang/cs.bin
75 res/lang/de.bin 81 res/lang/de.bin
76 res/lang/en.bin 82 res/lang/en.bin
@@ -99,12 +105,38 @@ set (RESOURCES
99) 105)
100file (GLOB FONTS RELATIVE ${CMAKE_CURRENT_SOURCE_DIR} res/fonts/*) 106file (GLOB FONTS RELATIVE ${CMAKE_CURRENT_SOURCE_DIR} res/fonts/*)
101list (APPEND RESOURCES ${FONTS}) 107list (APPEND RESOURCES ${FONTS})
108if (IOS)
109 list (APPEND RESOURCES
110 res/about/ios-help.gmi
111 res/about/ios-version.gmi
112 )
113elseif (ANDROID)
114 list (APPEND RESOURCES
115 res/about/android-help.gmi
116 res/about/android-version.gmi
117 )
118else ()
119 list (APPEND RESOURCES
120 res/about/help.gmi
121 res/about/version.gmi
122 res/arg-help.txt
123 )
124endif ()
102if ((UNIX AND NOT APPLE) OR MSYS) 125if ((UNIX AND NOT APPLE) OR MSYS)
103 list (APPEND RESOURCES res/lagrange-64.png) 126 list (APPEND RESOURCES res/lagrange-64.png)
104endif () 127endif ()
105set (EMB_BIN ${CMAKE_CURRENT_BINARY_DIR}/resources.lgr) 128set (EMB_BIN ${CMAKE_CURRENT_BINARY_DIR}/resources.lgr)
106make_resources (${EMB_BIN} ${RESOURCES}) 129make_resources (${EMB_BIN} ${RESOURCES})
107set_source_files_properties (${EMB_BIN} PROPERTIES MACOSX_PACKAGE_LOCATION Resources) 130set_source_files_properties (${EMB_BIN} PROPERTIES MACOSX_PACKAGE_LOCATION Resources)
131if (IOS)
132 set (EMB_FONTS
133 res/fonts/SourceSans3-Regular.ttf
134 res/fonts/IosevkaTerm-Extended.ttf
135 )
136 set_source_files_properties (${EMB_FONTS}
137 PROPERTIES MACOSX_PACKAGE_LOCATION Resources
138 )
139endif ()
108 140
109# Source files. 141# Source files.
110set (SOURCES 142set (SOURCES
@@ -169,6 +201,8 @@ set (SOURCES
169 src/ui/bindingswidget.h 201 src/ui/bindingswidget.h
170 src/ui/certimportwidget.c 202 src/ui/certimportwidget.c
171 src/ui/certimportwidget.h 203 src/ui/certimportwidget.h
204 src/ui/certlistwidget.c
205 src/ui/certlistwidget.h
172 src/ui/color.c 206 src/ui/color.c
173 src/ui/color.h 207 src/ui/color.h
174 src/ui/command.c 208 src/ui/command.c
@@ -177,6 +211,8 @@ set (SOURCES
177 src/ui/documentwidget.h 211 src/ui/documentwidget.h
178 src/ui/indicatorwidget.c 212 src/ui/indicatorwidget.c
179 src/ui/indicatorwidget.h 213 src/ui/indicatorwidget.h
214 src/ui/linkinfo.c
215 src/ui/linkinfo.h
180 src/ui/listwidget.c 216 src/ui/listwidget.c
181 src/ui/listwidget.h 217 src/ui/listwidget.h
182 src/ui/lookupwidget.c 218 src/ui/lookupwidget.c
@@ -226,7 +262,7 @@ set (SOURCES
226 res/about/version.gmi 262 res/about/version.gmi
227 ${EMB_BIN} 263 ${EMB_BIN}
228) 264)
229if (NOT APPLE) # macos.m has Sparkle updater 265if (IOS OR NOT APPLE) # macos.m has Sparkle updater
230 list (APPEND SOURCES src/updater.c) 266 list (APPEND SOURCES src/updater.c)
231endif () 267endif ()
232if (ENABLE_IPC) 268if (ENABLE_IPC)
@@ -265,7 +301,7 @@ if (MSYS)
265 configure_file (res/lagrange.rc.in ${CMAKE_CURRENT_BINARY_DIR}/lagrange.rc NEWLINE_STYLE WIN32) 301 configure_file (res/lagrange.rc.in ${CMAKE_CURRENT_BINARY_DIR}/lagrange.rc NEWLINE_STYLE WIN32)
266 list (APPEND SOURCES src/win32.c src/win32.h ${CMAKE_CURRENT_BINARY_DIR}/lagrange.rc) 302 list (APPEND SOURCES src/win32.c src/win32.h ${CMAKE_CURRENT_BINARY_DIR}/lagrange.rc)
267endif () 303endif ()
268set_source_files_properties (${RESOURCES} PROPERTIES MACOSX_PACKAGE_LOCATION Resources) 304#set_source_files_properties (${RESOURCES} PROPERTIES MACOSX_PACKAGE_LOCATION Resources)
269if (MSYS OR (APPLE AND NOT MOBILE) OR (UNIX AND NOT MOBILE)) 305if (MSYS OR (APPLE AND NOT MOBILE) OR (UNIX AND NOT MOBILE))
270 add_definitions (-DiPlatformPcDesktop=1) 306 add_definitions (-DiPlatformPcDesktop=1)
271endif () 307endif ()
@@ -287,10 +323,10 @@ endif ()
287 323
288# Target. 324# Target.
289if (NOT ANDROID) 325if (NOT ANDROID)
290 add_executable (app ${SOURCES} ${RESOURCES}) 326 add_executable (app ${SOURCES} ${RESOURCES} ${EMB_FONTS})
291else () 327else ()
292 # The whole app becomes one shared library, based on this static one. 328 # The whole app becomes one shared library, based on this static one.
293 add_library (app STATIC ${SOURCES}) 329 add_library (app SHARED ${SOURCES})
294endif () 330endif ()
295set_property (TARGET app PROPERTY C_STANDARD 11) 331set_property (TARGET app PROPERTY C_STANDARD 11)
296if (TARGET ext-deps) 332if (TARGET ext-deps)
@@ -305,6 +341,7 @@ target_include_directories (app PUBLIC
305target_compile_options (app PUBLIC 341target_compile_options (app PUBLIC
306 -Werror=implicit-function-declaration 342 -Werror=implicit-function-declaration
307 -Werror=incompatible-pointer-types 343 -Werror=incompatible-pointer-types
344 -Wno-deprecated-declarations
308 ${SDL2_CFLAGS} 345 ${SDL2_CFLAGS}
309 -DSTB_VORBIS_NO_STDIO=1 346 -DSTB_VORBIS_NO_STDIO=1
310 -DSTB_VORBIS_NO_INTEGER_CONVERSION=1 347 -DSTB_VORBIS_NO_INTEGER_CONVERSION=1
@@ -418,6 +455,12 @@ if (APPLE)
418 ) 455 )
419 endif () 456 endif ()
420endif () 457endif ()
458if (ANDROID)
459 target_compile_definitions (app PUBLIC
460 LAGRANGE_ANDROID_VERSION="${ANDROID_BUILD_VERSION}"
461 LAGRANGE_ANDROID_BUILD_DATE="${ANDROID_BUILD_DATE}"
462 )
463endif ()
421if (MSYS) 464if (MSYS)
422 target_link_libraries (app PUBLIC d2d1 uuid dwmapi) # querying DPI 465 target_link_libraries (app PUBLIC d2d1 uuid dwmapi) # querying DPI
423 if (ENABLE_WINSPARKLE) 466 if (ENABLE_WINSPARKLE)
@@ -452,7 +495,7 @@ elseif (HAIKU)
452 LAGRANGE_EMB_BIN="${CMAKE_INSTALL_PREFIX}/resources.lgr") 495 LAGRANGE_EMB_BIN="${CMAKE_INSTALL_PREFIX}/resources.lgr")
453 install (FILES ${EMB_BIN} DESTINATION .) 496 install (FILES ${EMB_BIN} DESTINATION .)
454elseif (ANDROID) 497elseif (ANDROID)
455 file (COPY ${EMB_BIN} DESTINATION ${CMAKE_SOURCE_DIR}/../app/src/main/assets) 498 file (COPY ${EMB_BIN} DESTINATION ${CMAKE_SOURCE_DIR}/../src/main/assets)
456elseif (UNIX AND NOT APPLE) 499elseif (UNIX AND NOT APPLE)
457 include (GNUInstallDirs) 500 include (GNUInstallDirs)
458 set_target_properties (app PROPERTIES 501 set_target_properties (app PROPERTIES