Mercurial > minori
annotate CMakeLists.txt @ 247:1ae4d8b28a5c
autotools/windres: use AC_PROG_SED for sed
sed is actually surprisingly unportable. on mingw this shouldn't
be a problem, but alas, we should use it anyway
| author | Paper <mrpapersonic@gmail.com> |
|---|---|
| date | Wed, 24 Jan 2024 20:15:35 -0500 |
| parents | ff0061e75f0f |
| children | a7d0d543b334 |
| rev | line source |
|---|---|
| 108 | 1 cmake_minimum_required(VERSION 3.18) |
| 103 | 2 project(minori LANGUAGES CXX VERSION 0.1.0) |
|
17
db445ce42057
cmake: only enable OBJCXX on OS X
Paper <mrpapersonic@gmail.com>
parents:
15
diff
changeset
|
3 |
| 64 | 4 set(CMAKE_RUNTIME_OUTPUT_DIRECTORY "${CMAKE_BINARY_DIR}") |
| 5 set(CMAKE_LIBRARY_OUTPUT_DIRECTORY "${CMAKE_BINARY_DIR}") | |
| 6 set(CMAKE_ARCHIVE_OUTPUT_DIRECTORY "${CMAKE_BINARY_DIR}") | |
| 7 | |
| 8 option(BUILD_SHARED_LIBS "Build using shared libraries" ON) | |
| 108 | 9 option(USE_QT6 "Force build with Qt 6" OFF) |
| 10 option(USE_QT5 "Force build with Qt 5" OFF) | |
|
114
ab191e28e69d
*: add initial torrent stuff
Paper <mrpapersonic@gmail.com>
parents:
112
diff
changeset
|
11 option(UPDATE_TRANSLATIONS "Update *.ts translation files" OFF) |
| 64 | 12 |
| 9 | 13 add_subdirectory(dep/anitomy) |
| 64 | 14 add_subdirectory(dep/animia) |
|
55
d10b6c6b432e
add xml lib, we will need to use it eventually
Paper <mrpapersonic@gmail.com>
parents:
54
diff
changeset
|
15 add_subdirectory(dep/pugixml) |
| 9 | 16 |
| 12 | 17 # Fix for mingw64 |
| 18 list(APPEND CMAKE_FIND_LIBRARY_SUFFIXES ".dll.a" ".a") | |
| 19 | |
|
110
2f3ae79adb02
cmake: fix what I tried to do in the last commit
Paper <mrpapersonic@gmail.com>
parents:
109
diff
changeset
|
20 if(USE_QT6) |
| 108 | 21 set(QT_VERSION_MAJOR 6) |
|
109
79714c95a145
*: add translation files and locale files
Paper <mrpapersonic@gmail.com>
parents:
108
diff
changeset
|
22 elseif(USE_QT5) |
| 108 | 23 set(QT_VERSION_MAJOR 5) |
| 62 | 24 else() |
| 108 | 25 find_package(QT NAMES Qt6 Qt5 REQUIRED COMPONENTS Core) |
| 62 | 26 endif() |
| 108 | 27 |
| 28 find_package(Qt${QT_VERSION_MAJOR} REQUIRED COMPONENTS Widgets LinguistTools) | |
| 29 | |
| 12 | 30 find_package(CURL REQUIRED) |
| 31 | |
| 32 set(LIBRARIES | |
| 33 ${CURL_LIBRARIES} | |
| 108 | 34 ${Qt${QT_VERSION_MAJOR}Widgets_LIBRARIES} |
| 12 | 35 anitomy |
| 64 | 36 animia |
|
114
ab191e28e69d
*: add initial torrent stuff
Paper <mrpapersonic@gmail.com>
parents:
112
diff
changeset
|
37 pugixml |
| 12 | 38 ) |
| 39 | |
| 40 # We need Cocoa for some OS X stuff | |
| 41 if(APPLE) | |
|
179
9c4645100fec
osx: clean up includes, we do not need cocoa
Paper <mrpapersonic@gmail.com>
parents:
147
diff
changeset
|
42 find_library(FOUNDATION_LIBRARY Foundation) |
|
9c4645100fec
osx: clean up includes, we do not need cocoa
Paper <mrpapersonic@gmail.com>
parents:
147
diff
changeset
|
43 find_library(APPKIT_LIBRARY AppKit) |
|
9c4645100fec
osx: clean up includes, we do not need cocoa
Paper <mrpapersonic@gmail.com>
parents:
147
diff
changeset
|
44 list(APPEND LIBRARIES ${FOUNDATION_LIBRARY} ${APPKIT_LIBRARY}) |
| 12 | 45 endif() |
| 46 | |
| 2 | 47 set(SRC_FILES |
| 9 | 48 # Main entrypoint |
| 81 | 49 src/main.cc |
| 9 | 50 |
| 51 # Core files and datatype declarations... | |
| 81 | 52 src/core/anime.cc |
| 53 src/core/anime_db.cc | |
| 54 src/core/config.cc | |
| 55 src/core/date.cc | |
| 56 src/core/filesystem.cc | |
| 57 src/core/http.cc | |
| 58 src/core/json.cc | |
| 59 src/core/strings.cc | |
| 60 src/core/time.cc | |
| 9 | 61 |
| 46 | 62 # Main window |
| 81 | 63 src/gui/window.cc |
| 102 | 64 src/gui/theme.cc |
| 108 | 65 src/gui/locale.cc |
| 46 | 66 |
| 67 # Main window pages | |
| 81 | 68 src/gui/pages/anime_list.cc |
| 69 src/gui/pages/now_playing.cc | |
| 70 src/gui/pages/statistics.cc | |
| 71 src/gui/pages/search.cc | |
| 72 src/gui/pages/seasons.cc | |
| 73 src/gui/pages/torrents.cc | |
| 74 src/gui/pages/history.cc | |
|
54
466ac9870df9
add stub pages (to be implemented)
Paper <mrpapersonic@gmail.com>
parents:
51
diff
changeset
|
75 |
| 46 | 76 # Custom widgets |
| 81 | 77 src/gui/widgets/anime_info.cc |
| 78 src/gui/widgets/poster.cc | |
| 79 src/gui/widgets/clickable_label.cc | |
| 80 src/gui/widgets/sidebar.cc | |
| 81 src/gui/widgets/text.cc | |
| 82 src/gui/widgets/optional_date.cc | |
| 9 | 83 |
| 84 # Dialogs | |
| 81 | 85 src/gui/dialog/about.cc |
| 86 src/gui/dialog/information.cc | |
| 87 src/gui/dialog/settings.cc | |
| 88 src/gui/dialog/settings/application.cc | |
| 89 src/gui/dialog/settings/services.cc | |
|
116
254b1d2b7096
settings: add torrents page, make rss feed configurable
Paper <mrpapersonic@gmail.com>
parents:
114
diff
changeset
|
90 src/gui/dialog/settings/torrents.cc |
|
119
4eae379cb1ff
settings: add a very early recognition tab for configuring players and extensions
Paper <mrpapersonic@gmail.com>
parents:
118
diff
changeset
|
91 src/gui/dialog/settings/recognition.cc |
| 226 | 92 src/gui/dialog/settings/library.cc |
| 9 | 93 |
| 10 | 94 # Translate |
| 81 | 95 src/gui/translate/anime.cc |
| 96 src/gui/translate/anilist.cc | |
|
90
c4bb49c2f6eb
config: improve handling of vars
Paper <mrpapersonic@gmail.com>
parents:
82
diff
changeset
|
97 src/gui/translate/config.cc |
| 10 | 98 |
| 9 | 99 # Services (only AniList for now) |
| 81 | 100 src/services/services.cc |
| 101 src/services/anilist.cc | |
| 9 | 102 |
|
221
53211cb1e7f5
library: add initial library stuff
Paper <paper@paper.us.eu.org>
parents:
202
diff
changeset
|
103 # Library |
|
53211cb1e7f5
library: add initial library stuff
Paper <paper@paper.us.eu.org>
parents:
202
diff
changeset
|
104 src/library/library.cc |
|
53211cb1e7f5
library: add initial library stuff
Paper <paper@paper.us.eu.org>
parents:
202
diff
changeset
|
105 |
| 64 | 106 # Tracking |
| 81 | 107 src/track/media.cc |
| 64 | 108 |
| 9 | 109 # Qt resources |
| 2 | 110 rc/icons.qrc |
|
105
6d8da6e64d61
theme: add dark stylesheet, make it actually usable
Paper <mrpapersonic@gmail.com>
parents:
103
diff
changeset
|
111 rc/dark.qrc |
|
138
28842a8d0c6b
dep/animia: huge refactor (again...)
Paper <mrpapersonic@gmail.com>
parents:
128
diff
changeset
|
112 rc/player_data.qrc |
| 2 | 113 ) |
| 114 | |
| 108 | 115 set(INCLUDE |
| 116 include | |
| 117 dep/pugixml/src | |
| 118 dep/animia/include | |
| 119 dep/anitomy | |
| 120 dep | |
| 121 ) | |
| 122 | |
| 123 set(TS_FILES | |
| 124 rc/locale/en_GB.ts | |
| 125 rc/locale/es.ts | |
| 126 ) | |
| 127 | |
|
232
ff0061e75f0f
theme: add OS detection with glib
Paper <mrpapersonic@gmail.com>
parents:
226
diff
changeset
|
128 set(DEFINES) |
|
ff0061e75f0f
theme: add OS detection with glib
Paper <mrpapersonic@gmail.com>
parents:
226
diff
changeset
|
129 |
| 108 | 130 set_source_files_properties(${TS_FILES} PROPERTIES OUTPUT_LOCATION "${CMAKE_CURRENT_BINARY_DIR}/rc/locale") |
| 131 | |
|
110
2f3ae79adb02
cmake: fix what I tried to do in the last commit
Paper <mrpapersonic@gmail.com>
parents:
109
diff
changeset
|
132 if(UPDATE_TRANSLATIONS) |
|
109
79714c95a145
*: add translation files and locale files
Paper <mrpapersonic@gmail.com>
parents:
108
diff
changeset
|
133 cmake_language(CALL qt${QT_VERSION_MAJOR}_create_translation ${SRC_FILES} ${TS_FILES} OPTIONS "-I${CMAKE_CURRENT_SOURCE_DIR}/include") |
|
79714c95a145
*: add translation files and locale files
Paper <mrpapersonic@gmail.com>
parents:
108
diff
changeset
|
134 endif() |
| 108 | 135 cmake_language(CALL qt${QT_VERSION_MAJOR}_add_translation QM_FILES ${TS_FILES}) |
|
112
80f49f623d30
locale: allow switching locales without restarting
Paper <mrpapersonic@gmail.com>
parents:
110
diff
changeset
|
136 list(APPEND SRC_FILES ${QM_FILES}) |
| 108 | 137 |
| 138 function(qt_create_resource_file outfile) | |
| 139 set(QRC "<!DOCTYPE rcc><RCC version=\"1.0\">\n\t<qresource>\n") | |
| 140 get_filename_component(DIR ${outfile} DIRECTORY) | |
| 141 foreach (qm ${ARGN}) | |
| 142 file(RELATIVE_PATH name ${DIR} ${qm}) | |
| 143 string(APPEND QRC "\t\t<file>${name}</file>\n") | |
| 144 endforeach() | |
| 145 string(APPEND QRC "\t</qresource>\n</RCC>\n") | |
| 146 file(WRITE ${outfile} ${QRC}) | |
| 147 endfunction() | |
| 148 | |
| 149 qt_create_resource_file("${CMAKE_CURRENT_BINARY_DIR}/rc/locale.qrc" ${QM_FILES}) | |
|
112
80f49f623d30
locale: allow switching locales without restarting
Paper <mrpapersonic@gmail.com>
parents:
110
diff
changeset
|
150 list(APPEND SRC_FILES "${CMAKE_CURRENT_BINARY_DIR}/rc/locale.qrc") |
| 108 | 151 |
| 152 # This is also used in the Win32 rc file | |
| 103 | 153 set(RC_INFO_STRING "A lightweight anime tracker built with Qt.") |
| 154 | |
| 9 | 155 if(APPLE) # Mac OS X (or OS X (or macOS)) |
| 103 | 156 set(MACOSX_BUNDLE_BUNDLE_NAME "Minori") |
| 157 set(MACOSX_BUNDLE_BUNDLE_VERSION ${minori_VERSION}) | |
| 158 set(MACOSX_BUNDLE_COPYRIGHT "Copyright (C) Paper 2023") | |
| 159 set(MACOSX_BUNDLE_GUI_IDENTIFIER "org.eu.us.paper.minori") | |
| 160 set(MACOSX_BUNDLE_INFO_STRING ${RC_INFO_STRING}) | |
| 161 set(MACOSX_BUNDLE_ICON_FILE rc/osx/favicon.icns) | |
| 162 set(app_icon_osx "${CMAKE_CURRENT_SOURCE_DIR}/rc/osx/favicon.icns") | |
| 163 set_source_files_properties(${app_icon_osx} PROPERTIES MACOSX_PACKAGE_LOCATION "Resources") | |
| 164 | |
| 5 | 165 list(APPEND SRC_FILES |
|
194
8548dc425697
sys/osx: remove all objective-c++ stuff
Paper <mrpapersonic@gmail.com>
parents:
189
diff
changeset
|
166 src/sys/osx/dark_theme.cc |
|
8548dc425697
sys/osx: remove all objective-c++ stuff
Paper <mrpapersonic@gmail.com>
parents:
189
diff
changeset
|
167 src/sys/osx/filesystem.cc |
| 103 | 168 ${app_icon_osx} |
| 5 | 169 ) |
|
232
ff0061e75f0f
theme: add OS detection with glib
Paper <mrpapersonic@gmail.com>
parents:
226
diff
changeset
|
170 list(APPEND DEFINES MACOSX) |
| 9 | 171 elseif(WIN32) # Windows |
| 103 | 172 configure_file( |
| 173 ${CMAKE_CURRENT_SOURCE_DIR}/rc/win32/version.rc.in | |
| 174 ${CMAKE_CURRENT_BINARY_DIR}/rc/version.rc | |
| 175 @ONLY | |
| 176 ) | |
| 177 list(APPEND SRC_FILES | |
| 178 src/sys/win32/dark_theme.cc | |
| 179 rc/win32/resource.rc | |
| 180 ${CMAKE_CURRENT_BINARY_DIR}/rc/version.rc | |
| 181 ) | |
|
232
ff0061e75f0f
theme: add OS detection with glib
Paper <mrpapersonic@gmail.com>
parents:
226
diff
changeset
|
182 list(APPEND DEFINES WIN32) |
|
ff0061e75f0f
theme: add OS detection with glib
Paper <mrpapersonic@gmail.com>
parents:
226
diff
changeset
|
183 else() |
|
ff0061e75f0f
theme: add OS detection with glib
Paper <mrpapersonic@gmail.com>
parents:
226
diff
changeset
|
184 if(LINUX) |
|
ff0061e75f0f
theme: add OS detection with glib
Paper <mrpapersonic@gmail.com>
parents:
226
diff
changeset
|
185 configure_file( |
|
ff0061e75f0f
theme: add OS detection with glib
Paper <mrpapersonic@gmail.com>
parents:
226
diff
changeset
|
186 ${CMAKE_CURRENT_SOURCE_DIR}/rc/linux/Minori.desktop.in |
|
ff0061e75f0f
theme: add OS detection with glib
Paper <mrpapersonic@gmail.com>
parents:
226
diff
changeset
|
187 ${CMAKE_CURRENT_BINARY_DIR}/rc/Minori.desktop |
|
ff0061e75f0f
theme: add OS detection with glib
Paper <mrpapersonic@gmail.com>
parents:
226
diff
changeset
|
188 @ONLY |
|
ff0061e75f0f
theme: add OS detection with glib
Paper <mrpapersonic@gmail.com>
parents:
226
diff
changeset
|
189 ) |
|
ff0061e75f0f
theme: add OS detection with glib
Paper <mrpapersonic@gmail.com>
parents:
226
diff
changeset
|
190 configure_file( |
|
ff0061e75f0f
theme: add OS detection with glib
Paper <mrpapersonic@gmail.com>
parents:
226
diff
changeset
|
191 ${CMAKE_CURRENT_SOURCE_DIR}/rc/favicon256.png |
|
ff0061e75f0f
theme: add OS detection with glib
Paper <mrpapersonic@gmail.com>
parents:
226
diff
changeset
|
192 ${CMAKE_CURRENT_BINARY_DIR}/rc/Minori.png |
|
ff0061e75f0f
theme: add OS detection with glib
Paper <mrpapersonic@gmail.com>
parents:
226
diff
changeset
|
193 COPYONLY |
|
ff0061e75f0f
theme: add OS detection with glib
Paper <mrpapersonic@gmail.com>
parents:
226
diff
changeset
|
194 ) |
|
ff0061e75f0f
theme: add OS detection with glib
Paper <mrpapersonic@gmail.com>
parents:
226
diff
changeset
|
195 endif() |
|
ff0061e75f0f
theme: add OS detection with glib
Paper <mrpapersonic@gmail.com>
parents:
226
diff
changeset
|
196 |
|
ff0061e75f0f
theme: add OS detection with glib
Paper <mrpapersonic@gmail.com>
parents:
226
diff
changeset
|
197 find_package(PkgConfig) |
|
ff0061e75f0f
theme: add OS detection with glib
Paper <mrpapersonic@gmail.com>
parents:
226
diff
changeset
|
198 if (PKG_CONFIG_FOUND) |
|
ff0061e75f0f
theme: add OS detection with glib
Paper <mrpapersonic@gmail.com>
parents:
226
diff
changeset
|
199 pkg_check_modules(GLIB gio-2.0 glib-2.0) |
|
ff0061e75f0f
theme: add OS detection with glib
Paper <mrpapersonic@gmail.com>
parents:
226
diff
changeset
|
200 if (GLIB_FOUND) |
|
ff0061e75f0f
theme: add OS detection with glib
Paper <mrpapersonic@gmail.com>
parents:
226
diff
changeset
|
201 list(APPEND SRC_FILES src/sys/glib/dark_theme.cc) |
|
ff0061e75f0f
theme: add OS detection with glib
Paper <mrpapersonic@gmail.com>
parents:
226
diff
changeset
|
202 list(APPEND INCLUDE ${GLIB_INCLUDE_DIRS}) |
|
ff0061e75f0f
theme: add OS detection with glib
Paper <mrpapersonic@gmail.com>
parents:
226
diff
changeset
|
203 list(APPEND LIBRARIES ${GLIB_LINK_LIBRARIES}) |
|
ff0061e75f0f
theme: add OS detection with glib
Paper <mrpapersonic@gmail.com>
parents:
226
diff
changeset
|
204 list(APPEND DEFINES GLIB) |
|
ff0061e75f0f
theme: add OS detection with glib
Paper <mrpapersonic@gmail.com>
parents:
226
diff
changeset
|
205 endif() |
|
ff0061e75f0f
theme: add OS detection with glib
Paper <mrpapersonic@gmail.com>
parents:
226
diff
changeset
|
206 endif() |
| 2 | 207 endif() |
| 208 | |
| 103 | 209 add_executable(minori WIN32 MACOSX_BUNDLE ${SRC_FILES}) |
|
128
859d2a957940
cmake: set CXX_STANDARD to 17
Paper <mrpapersonic@gmail.com>
parents:
124
diff
changeset
|
210 set_property(TARGET minori PROPERTY CXX_STANDARD 17) |
| 11 | 211 set_property(TARGET minori PROPERTY AUTOMOC ON) |
| 212 set_property(TARGET minori PROPERTY AUTORCC ON) | |
| 2 | 213 |
|
232
ff0061e75f0f
theme: add OS detection with glib
Paper <mrpapersonic@gmail.com>
parents:
226
diff
changeset
|
214 target_include_directories(minori PRIVATE ${Qt${QT_VERSION_MAJOR}Widgets_INCLUDE_DIRS} ${CURL_INCLUDE_DIRS} PUBLIC ${INCLUDE}) |
|
ff0061e75f0f
theme: add OS detection with glib
Paper <mrpapersonic@gmail.com>
parents:
226
diff
changeset
|
215 target_link_libraries(minori PRIVATE ${LIBRARIES}) |
| 64 | 216 target_compile_options(minori PRIVATE -Wall -Wpedantic -Wextra -Wsuggest-override -Wold-style-cast) |
|
232
ff0061e75f0f
theme: add OS detection with glib
Paper <mrpapersonic@gmail.com>
parents:
226
diff
changeset
|
217 target_compile_definitions(minori PRIVATE ${DEFINES}) |
|
ff0061e75f0f
theme: add OS detection with glib
Paper <mrpapersonic@gmail.com>
parents:
226
diff
changeset
|
218 |
| 5 | 219 if(APPLE) |
|
195
975a3f0965e2
locale: only attempt loading locales after QApplication is init'd
Paper <mrpapersonic@gmail.com>
parents:
194
diff
changeset
|
220 set_target_properties(minori PROPERTIES MACOSX_BUNDLE TRUE) |
| 9 | 221 elseif(WIN32) |
|
138
28842a8d0c6b
dep/animia: huge refactor (again...)
Paper <mrpapersonic@gmail.com>
parents:
128
diff
changeset
|
222 install(FILES $<TARGET_RUNTIME_DLLS:minori> TYPE BIN) |
|
28842a8d0c6b
dep/animia: huge refactor (again...)
Paper <mrpapersonic@gmail.com>
parents:
128
diff
changeset
|
223 endif() |
