Mercurial > minori
comparison CMakeLists.txt @ 232:ff0061e75f0f
theme: add OS detection with glib
author | Paper <mrpapersonic@gmail.com> |
---|---|
date | Sat, 13 Jan 2024 11:06:16 -0500 |
parents | f784b5b1914c |
children | a7d0d543b334 |
comparison
equal
deleted
inserted
replaced
231:69f4768a820c | 232:ff0061e75f0f |
---|---|
123 set(TS_FILES | 123 set(TS_FILES |
124 rc/locale/en_GB.ts | 124 rc/locale/en_GB.ts |
125 rc/locale/es.ts | 125 rc/locale/es.ts |
126 ) | 126 ) |
127 | 127 |
128 set(DEFINES) | |
129 | |
128 set_source_files_properties(${TS_FILES} PROPERTIES OUTPUT_LOCATION "${CMAKE_CURRENT_BINARY_DIR}/rc/locale") | 130 set_source_files_properties(${TS_FILES} PROPERTIES OUTPUT_LOCATION "${CMAKE_CURRENT_BINARY_DIR}/rc/locale") |
129 | 131 |
130 if(UPDATE_TRANSLATIONS) | 132 if(UPDATE_TRANSLATIONS) |
131 cmake_language(CALL qt${QT_VERSION_MAJOR}_create_translation ${SRC_FILES} ${TS_FILES} OPTIONS "-I${CMAKE_CURRENT_SOURCE_DIR}/include") | 133 cmake_language(CALL qt${QT_VERSION_MAJOR}_create_translation ${SRC_FILES} ${TS_FILES} OPTIONS "-I${CMAKE_CURRENT_SOURCE_DIR}/include") |
132 endif() | 134 endif() |
163 list(APPEND SRC_FILES | 165 list(APPEND SRC_FILES |
164 src/sys/osx/dark_theme.cc | 166 src/sys/osx/dark_theme.cc |
165 src/sys/osx/filesystem.cc | 167 src/sys/osx/filesystem.cc |
166 ${app_icon_osx} | 168 ${app_icon_osx} |
167 ) | 169 ) |
170 list(APPEND DEFINES MACOSX) | |
168 elseif(WIN32) # Windows | 171 elseif(WIN32) # Windows |
169 configure_file( | 172 configure_file( |
170 ${CMAKE_CURRENT_SOURCE_DIR}/rc/win32/version.rc.in | 173 ${CMAKE_CURRENT_SOURCE_DIR}/rc/win32/version.rc.in |
171 ${CMAKE_CURRENT_BINARY_DIR}/rc/version.rc | 174 ${CMAKE_CURRENT_BINARY_DIR}/rc/version.rc |
172 @ONLY | 175 @ONLY |
174 list(APPEND SRC_FILES | 177 list(APPEND SRC_FILES |
175 src/sys/win32/dark_theme.cc | 178 src/sys/win32/dark_theme.cc |
176 rc/win32/resource.rc | 179 rc/win32/resource.rc |
177 ${CMAKE_CURRENT_BINARY_DIR}/rc/version.rc | 180 ${CMAKE_CURRENT_BINARY_DIR}/rc/version.rc |
178 ) | 181 ) |
179 elseif(LINUX) | 182 list(APPEND DEFINES WIN32) |
180 configure_file( | 183 else() |
181 ${CMAKE_CURRENT_SOURCE_DIR}/rc/linux/Minori.desktop.in | 184 if(LINUX) |
182 ${CMAKE_CURRENT_BINARY_DIR}/rc/Minori.desktop | 185 configure_file( |
183 @ONLY | 186 ${CMAKE_CURRENT_SOURCE_DIR}/rc/linux/Minori.desktop.in |
184 ) | 187 ${CMAKE_CURRENT_BINARY_DIR}/rc/Minori.desktop |
185 configure_file( | 188 @ONLY |
186 ${CMAKE_CURRENT_SOURCE_DIR}/rc/favicon256.png | 189 ) |
187 ${CMAKE_CURRENT_BINARY_DIR}/rc/Minori.png | 190 configure_file( |
188 COPYONLY | 191 ${CMAKE_CURRENT_SOURCE_DIR}/rc/favicon256.png |
189 ) | 192 ${CMAKE_CURRENT_BINARY_DIR}/rc/Minori.png |
193 COPYONLY | |
194 ) | |
195 endif() | |
196 | |
197 find_package(PkgConfig) | |
198 if (PKG_CONFIG_FOUND) | |
199 pkg_check_modules(GLIB gio-2.0 glib-2.0) | |
200 if (GLIB_FOUND) | |
201 list(APPEND SRC_FILES src/sys/glib/dark_theme.cc) | |
202 list(APPEND INCLUDE ${GLIB_INCLUDE_DIRS}) | |
203 list(APPEND LIBRARIES ${GLIB_LINK_LIBRARIES}) | |
204 list(APPEND DEFINES GLIB) | |
205 endif() | |
206 endif() | |
190 endif() | 207 endif() |
191 | 208 |
192 add_executable(minori WIN32 MACOSX_BUNDLE ${SRC_FILES}) | 209 add_executable(minori WIN32 MACOSX_BUNDLE ${SRC_FILES}) |
193 set_property(TARGET minori PROPERTY CXX_STANDARD 17) | 210 set_property(TARGET minori PROPERTY CXX_STANDARD 17) |
194 set_property(TARGET minori PROPERTY AUTOMOC ON) | 211 set_property(TARGET minori PROPERTY AUTOMOC ON) |
195 set_property(TARGET minori PROPERTY AUTORCC ON) | 212 set_property(TARGET minori PROPERTY AUTORCC ON) |
196 | 213 |
197 target_include_directories(minori PUBLIC ${Qt${QT_VERSION_MAJOR}Widgets_INCLUDE_DIRS} ${CURL_INCLUDE_DIRS} PRIVATE ${INCLUDE}) | 214 target_include_directories(minori PRIVATE ${Qt${QT_VERSION_MAJOR}Widgets_INCLUDE_DIRS} ${CURL_INCLUDE_DIRS} PUBLIC ${INCLUDE}) |
215 target_link_libraries(minori PRIVATE ${LIBRARIES}) | |
198 target_compile_options(minori PRIVATE -Wall -Wpedantic -Wextra -Wsuggest-override -Wold-style-cast) | 216 target_compile_options(minori PRIVATE -Wall -Wpedantic -Wextra -Wsuggest-override -Wold-style-cast) |
217 target_compile_definitions(minori PRIVATE ${DEFINES}) | |
218 | |
199 if(APPLE) | 219 if(APPLE) |
200 target_compile_definitions(minori PUBLIC MACOSX) | |
201 set_target_properties(minori PROPERTIES MACOSX_BUNDLE TRUE) | 220 set_target_properties(minori PROPERTIES MACOSX_BUNDLE TRUE) |
202 elseif(WIN32) | 221 elseif(WIN32) |
203 target_compile_definitions(minori PUBLIC WIN32) | |
204 endif() | |
205 target_link_libraries(minori ${LIBRARIES}) | |
206 | |
207 if(WIN32) | |
208 install(FILES $<TARGET_RUNTIME_DLLS:minori> TYPE BIN) | 222 install(FILES $<TARGET_RUNTIME_DLLS:minori> TYPE BIN) |
209 endif() | 223 endif() |