comparison CMakeLists.txt @ 367:8d45d892be88 default tip

*: instead of pugixml, use Qt XML features this means we have one extra Qt dependency though...
author Paper <paper@tflc.us>
date Sun, 17 Nov 2024 22:55:47 -0500
parents 99c961c91809
children
comparison
equal deleted inserted replaced
366:886f66775f31 367:8d45d892be88
10 option(USE_QT5 "Force build with Qt 5" OFF) 10 option(USE_QT5 "Force build with Qt 5" OFF)
11 option(UPDATE_TRANSLATIONS "Update *.ts translation files" OFF) 11 option(UPDATE_TRANSLATIONS "Update *.ts translation files" OFF)
12 12
13 add_subdirectory(dep/animone) 13 add_subdirectory(dep/animone)
14 add_subdirectory(dep/anitomy) 14 add_subdirectory(dep/anitomy)
15 add_subdirectory(dep/pugixml)
16 add_subdirectory(dep/utf8proc)
17 add_subdirectory(dep/fmt)
18 15
19 # Fix for mingw64 16 # Fix for mingw64
20 list(APPEND CMAKE_FIND_LIBRARY_SUFFIXES ".dll.a" ".a") 17 list(APPEND CMAKE_FIND_LIBRARY_SUFFIXES ".dll.a" ".a")
21 18
22 if(USE_QT6 AND USE_QT5) 19 if(USE_QT6 AND USE_QT5)
27 set(QT_VERSION_MAJOR 5) 24 set(QT_VERSION_MAJOR 5)
28 else() 25 else()
29 find_package(QT NAMES Qt6 Qt5 REQUIRED COMPONENTS Core) 26 find_package(QT NAMES Qt6 Qt5 REQUIRED COMPONENTS Core)
30 endif() 27 endif()
31 28
32 find_package(Qt${QT_VERSION_MAJOR} REQUIRED COMPONENTS Widgets LinguistTools) 29 find_package(Qt${QT_VERSION_MAJOR} REQUIRED COMPONENTS Widgets LinguistTools Xml)
33 30
34 # find_package(CURL) fails sometimes 31 # find_package(CURL) is dysfunctional
35 find_package(PkgConfig REQUIRED) 32 find_package(PkgConfig REQUIRED)
36 pkg_check_modules(CURL REQUIRED libcurl) 33 pkg_check_modules(CURL REQUIRED libcurl)
34 pkg_check_modules(UTF8PROC libutf8proc)
35 pkg_check_modules(FMT fmt)
36
37 message("${FMT_LINK_LIBRARIES}")
38
39 if(NOT UTF8PROC_FOUND)
40 add_subdirectory(dep/utf8proc)
41 endif()
42
43 if(NOT FMT_FOUND)
44 add_subdirectory(dep/fmt)
45 endif()
37 46
38 set(LIBRARIES 47 set(LIBRARIES
39 ${CURL_LIBRARIES}
40 ${Qt${QT_VERSION_MAJOR}Widgets_LIBRARIES} 48 ${Qt${QT_VERSION_MAJOR}Widgets_LIBRARIES}
49 ${Qt${QT_VERSION_MAJOR}Xml_LIBRARIES}
50 ${CURL_LINK_LIBRARIES}
41 anitomy 51 anitomy
42 animia 52 animia
43 pugixml 53 )
44 utf8proc 54
45 fmt 55 if(UTF8PROC_FOUND)
46 ) 56 list(APPEND LIBRARIES ${UTF8PROC_LINK_LIBRARIES})
57 else()
58 list(APPEND LIBRARIES utf8proc)
59 endif()
60
61 if(FMT_FOUND)
62 list(APPEND LIBRARIES ${FMT_LINK_LIBRARIES})
63 else()
64 list(APPEND LIBRARIES fmt)
65 endif()
47 66
48 set(QT_MOC_FILES 67 set(QT_MOC_FILES
49 include/core/http.h 68 include/core/http.h
50 include/core/session.h 69 include/core/session.h
51 include/gui/dialog/about.h 70 include/gui/dialog/about.h
153 rc/animone.qrc 172 rc/animone.qrc
154 rc/licenses.qrc 173 rc/licenses.qrc
155 ) 174 )
156 175
157 set(INCLUDE 176 set(INCLUDE
177 ${Qt${QT_VERSION_MAJOR}Widgets_INCLUDE_DIRS}
178 ${Qt${QT_VERSION_MAJOR}Xml_INCLUDE_DIRS}
179 ${CURL_INCLUDE_DIRS}
158 include 180 include
159 dep/pugixml/src
160 dep/animia/include 181 dep/animia/include
161 dep/fmt/include
162 dep/utf8proc
163 dep/anitomy 182 dep/anitomy
164 dep 183 dep
165 ) 184 )
185
186 if(UTF8PROC_FOUND)
187 list(APPEND INCLUDE ${UTF8PROC_INCLUDE_DIRS})
188 else()
189 list(APPEND INCLUDE dep/utf8proc)
190 endif()
191
192 if(FMT_FOUND)
193 list(APPEND INCLUDE ${FMT_INCLUDE_DIRS})
194 else()
195 list(APPEND INCLUDE dep/fmt/include)
196 endif()
166 197
167 set(TS_FILES 198 set(TS_FILES
168 rc/locale/en_GB.ts 199 rc/locale/en_GB.ts
169 ) 200 )
170 201
265 296
266 add_executable(minori WIN32 MACOSX_BUNDLE ${SRC_FILES}) 297 add_executable(minori WIN32 MACOSX_BUNDLE ${SRC_FILES})
267 set_property(TARGET minori PROPERTY CXX_STANDARD 17) 298 set_property(TARGET minori PROPERTY CXX_STANDARD 17)
268 set_property(TARGET minori PROPERTY AUTORCC ON) 299 set_property(TARGET minori PROPERTY AUTORCC ON)
269 300
270 target_include_directories(minori PRIVATE ${Qt${QT_VERSION_MAJOR}Widgets_INCLUDE_DIRS} ${CURL_INCLUDE_DIRS} PUBLIC ${INCLUDE}) 301 target_include_directories(minori PRIVATE ${INCLUDE})
271 target_link_libraries(minori PRIVATE ${LIBRARIES}) 302 target_link_libraries(minori PRIVATE ${LIBRARIES})
272 target_compile_options(minori PRIVATE -Wall -Wpedantic -Wextra -Wsuggest-override -Wold-style-cast) 303 target_compile_options(minori PRIVATE -Wall -Wpedantic -Wextra -Wsuggest-override -Wold-style-cast)
273 target_compile_definitions(minori PRIVATE ${DEFINES}) 304 target_compile_definitions(minori PRIVATE ${DEFINES})
274 305
275 if(APPLE) 306 if(APPLE)