Mercurial > minori
annotate CMakeLists.txt @ 117:2c1b6782e1d0
pages/torrents: work around conversion error on Linux
| author | Paper <mrpapersonic@gmail.com> |
|---|---|
| date | Tue, 07 Nov 2023 16:06:17 -0500 |
| parents | 254b1d2b7096 |
| children | 39521c47c7a3 |
| 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 |
|
db445ce42057
cmake: only enable OBJCXX on OS X
Paper <mrpapersonic@gmail.com>
parents:
15
diff
changeset
|
4 if(APPLE) |
|
db445ce42057
cmake: only enable OBJCXX on OS X
Paper <mrpapersonic@gmail.com>
parents:
15
diff
changeset
|
5 enable_language(OBJCXX) |
|
db445ce42057
cmake: only enable OBJCXX on OS X
Paper <mrpapersonic@gmail.com>
parents:
15
diff
changeset
|
6 endif() |
| 2 | 7 |
| 64 | 8 set(CMAKE_RUNTIME_OUTPUT_DIRECTORY "${CMAKE_BINARY_DIR}") |
| 9 set(CMAKE_LIBRARY_OUTPUT_DIRECTORY "${CMAKE_BINARY_DIR}") | |
| 10 set(CMAKE_ARCHIVE_OUTPUT_DIRECTORY "${CMAKE_BINARY_DIR}") | |
| 11 | |
| 12 option(BUILD_SHARED_LIBS "Build using shared libraries" ON) | |
| 108 | 13 option(USE_QT6 "Force build with Qt 6" OFF) |
| 14 option(USE_QT5 "Force build with Qt 5" OFF) | |
|
114
ab191e28e69d
*: add initial torrent stuff
Paper <mrpapersonic@gmail.com>
parents:
112
diff
changeset
|
15 option(UPDATE_TRANSLATIONS "Update *.ts translation files" OFF) |
| 64 | 16 |
| 9 | 17 add_subdirectory(dep/anitomy) |
| 64 | 18 add_subdirectory(dep/animia) |
|
55
d10b6c6b432e
add xml lib, we will need to use it eventually
Paper <mrpapersonic@gmail.com>
parents:
54
diff
changeset
|
19 add_subdirectory(dep/pugixml) |
| 9 | 20 |
| 12 | 21 # Fix for mingw64 |
| 22 list(APPEND CMAKE_FIND_LIBRARY_SUFFIXES ".dll.a" ".a") | |
| 23 | |
|
110
2f3ae79adb02
cmake: fix what I tried to do in the last commit
Paper <mrpapersonic@gmail.com>
parents:
109
diff
changeset
|
24 if(USE_QT6) |
| 108 | 25 set(QT_VERSION_MAJOR 6) |
|
109
79714c95a145
*: add translation files and locale files
Paper <mrpapersonic@gmail.com>
parents:
108
diff
changeset
|
26 elseif(USE_QT5) |
| 108 | 27 set(QT_VERSION_MAJOR 5) |
| 62 | 28 else() |
| 108 | 29 find_package(QT NAMES Qt6 Qt5 REQUIRED COMPONENTS Core) |
| 62 | 30 endif() |
| 108 | 31 |
| 32 find_package(Qt${QT_VERSION_MAJOR} REQUIRED COMPONENTS Widgets LinguistTools) | |
| 33 | |
| 12 | 34 find_package(CURL REQUIRED) |
| 35 | |
| 36 set(LIBRARIES | |
| 37 ${CURL_LIBRARIES} | |
| 108 | 38 ${Qt${QT_VERSION_MAJOR}Widgets_LIBRARIES} |
| 12 | 39 anitomy |
| 64 | 40 animia |
|
114
ab191e28e69d
*: add initial torrent stuff
Paper <mrpapersonic@gmail.com>
parents:
112
diff
changeset
|
41 pugixml |
| 12 | 42 ) |
| 43 | |
| 44 # We need Cocoa for some OS X stuff | |
| 45 if(APPLE) | |
| 46 find_library(COCOA_LIBRARY Cocoa) | |
| 47 list(APPEND LIBRARIES ${COCOA_LIBRARY}) | |
| 48 endif() | |
| 49 | |
| 2 | 50 set(SRC_FILES |
| 9 | 51 # Main entrypoint |
| 81 | 52 src/main.cc |
| 9 | 53 |
| 54 # Core files and datatype declarations... | |
| 81 | 55 src/core/anime.cc |
| 56 src/core/anime_db.cc | |
| 57 src/core/config.cc | |
| 58 src/core/date.cc | |
| 59 src/core/filesystem.cc | |
|
116
254b1d2b7096
settings: add torrents page, make rss feed configurable
Paper <mrpapersonic@gmail.com>
parents:
114
diff
changeset
|
60 src/core/ini.cc |
| 81 | 61 src/core/http.cc |
| 62 src/core/json.cc | |
| 63 src/core/strings.cc | |
| 64 src/core/time.cc | |
| 9 | 65 |
| 46 | 66 # Main window |
| 81 | 67 src/gui/window.cc |
| 102 | 68 src/gui/theme.cc |
| 108 | 69 src/gui/locale.cc |
| 46 | 70 |
| 71 # Main window pages | |
| 81 | 72 src/gui/pages/anime_list.cc |
| 73 src/gui/pages/now_playing.cc | |
| 74 src/gui/pages/statistics.cc | |
| 75 src/gui/pages/search.cc | |
| 76 src/gui/pages/seasons.cc | |
| 77 src/gui/pages/torrents.cc | |
| 78 src/gui/pages/history.cc | |
|
54
466ac9870df9
add stub pages (to be implemented)
Paper <mrpapersonic@gmail.com>
parents:
51
diff
changeset
|
79 |
| 46 | 80 # Custom widgets |
| 81 | 81 src/gui/widgets/anime_info.cc |
| 82 src/gui/widgets/poster.cc | |
| 83 src/gui/widgets/clickable_label.cc | |
| 84 src/gui/widgets/sidebar.cc | |
| 85 src/gui/widgets/text.cc | |
| 86 src/gui/widgets/optional_date.cc | |
| 9 | 87 |
| 88 # Dialogs | |
| 81 | 89 src/gui/dialog/about.cc |
| 90 src/gui/dialog/information.cc | |
| 91 src/gui/dialog/settings.cc | |
| 92 src/gui/dialog/settings/application.cc | |
| 93 src/gui/dialog/settings/services.cc | |
|
116
254b1d2b7096
settings: add torrents page, make rss feed configurable
Paper <mrpapersonic@gmail.com>
parents:
114
diff
changeset
|
94 src/gui/dialog/settings/torrents.cc |
| 9 | 95 |
| 10 | 96 # Translate |
| 81 | 97 src/gui/translate/anime.cc |
| 98 src/gui/translate/anilist.cc | |
|
90
c4bb49c2f6eb
config: improve handling of vars
Paper <mrpapersonic@gmail.com>
parents:
82
diff
changeset
|
99 src/gui/translate/config.cc |
| 10 | 100 |
| 9 | 101 # Services (only AniList for now) |
| 81 | 102 src/services/services.cc |
| 103 src/services/anilist.cc | |
| 9 | 104 |
| 64 | 105 # Tracking |
|
82
8b65c417c225
*: fix old stuff, make video players and extensions constants
Paper <mrpapersonic@gmail.com>
parents:
81
diff
changeset
|
106 src/track/constants.cc |
| 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 |
| 2 | 112 ) |
| 113 | |
| 108 | 114 set(INCLUDE |
| 115 include | |
| 116 dep/pugixml/src | |
| 117 dep/animia/include | |
| 118 dep/anitomy | |
| 119 dep | |
| 120 ) | |
| 121 | |
| 122 set(TS_FILES | |
| 123 rc/locale/en_GB.ts | |
| 124 rc/locale/es.ts | |
| 125 ) | |
| 126 | |
| 127 set_source_files_properties(${TS_FILES} PROPERTIES OUTPUT_LOCATION "${CMAKE_CURRENT_BINARY_DIR}/rc/locale") | |
| 128 | |
| 129 # dumb little hack to get this working on Qt5 and Qt6 | |
|
110
2f3ae79adb02
cmake: fix what I tried to do in the last commit
Paper <mrpapersonic@gmail.com>
parents:
109
diff
changeset
|
130 if(UPDATE_TRANSLATIONS) |
|
109
79714c95a145
*: add translation files and locale files
Paper <mrpapersonic@gmail.com>
parents:
108
diff
changeset
|
131 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
|
132 endif() |
| 108 | 133 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
|
134 list(APPEND SRC_FILES ${QM_FILES}) |
| 108 | 135 |
| 136 function(qt_create_resource_file outfile) | |
| 137 set(QRC "<!DOCTYPE rcc><RCC version=\"1.0\">\n\t<qresource>\n") | |
| 138 get_filename_component(DIR ${outfile} DIRECTORY) | |
| 139 foreach (qm ${ARGN}) | |
| 140 file(RELATIVE_PATH name ${DIR} ${qm}) | |
| 141 string(APPEND QRC "\t\t<file>${name}</file>\n") | |
| 142 endforeach() | |
| 143 string(APPEND QRC "\t</qresource>\n</RCC>\n") | |
| 144 file(WRITE ${outfile} ${QRC}) | |
| 145 endfunction() | |
| 146 | |
| 147 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
|
148 list(APPEND SRC_FILES "${CMAKE_CURRENT_BINARY_DIR}/rc/locale.qrc") |
| 108 | 149 |
| 150 # This is also used in the Win32 rc file | |
| 103 | 151 set(RC_INFO_STRING "A lightweight anime tracker built with Qt.") |
| 152 | |
| 9 | 153 if(APPLE) # Mac OS X (or OS X (or macOS)) |
| 103 | 154 set(MACOSX_BUNDLE_BUNDLE_NAME "Minori") |
| 155 set(MACOSX_BUNDLE_BUNDLE_VERSION ${minori_VERSION}) | |
| 156 set(MACOSX_BUNDLE_COPYRIGHT "Copyright (C) Paper 2023") | |
| 157 set(MACOSX_BUNDLE_GUI_IDENTIFIER "org.eu.us.paper.minori") | |
| 158 set(MACOSX_BUNDLE_INFO_STRING ${RC_INFO_STRING}) | |
| 159 set(MACOSX_BUNDLE_ICON_FILE rc/osx/favicon.icns) | |
| 160 set(app_icon_osx "${CMAKE_CURRENT_SOURCE_DIR}/rc/osx/favicon.icns") | |
| 161 set_source_files_properties(${app_icon_osx} PROPERTIES MACOSX_PACKAGE_LOCATION "Resources") | |
| 162 | |
| 5 | 163 list(APPEND SRC_FILES |
| 164 src/sys/osx/dark_theme.mm | |
| 165 src/sys/osx/filesystem.mm | |
| 103 | 166 ${app_icon_osx} |
| 5 | 167 ) |
| 9 | 168 elseif(WIN32) # Windows |
| 103 | 169 configure_file( |
| 170 ${CMAKE_CURRENT_SOURCE_DIR}/rc/win32/version.rc.in | |
| 171 ${CMAKE_CURRENT_BINARY_DIR}/rc/version.rc | |
| 172 @ONLY | |
| 173 ) | |
| 174 list(APPEND SRC_FILES | |
| 175 src/sys/win32/dark_theme.cc | |
| 176 rc/win32/resource.rc | |
| 177 ${CMAKE_CURRENT_BINARY_DIR}/rc/version.rc | |
| 178 ) | |
| 2 | 179 endif() |
| 180 | |
| 103 | 181 add_executable(minori WIN32 MACOSX_BUNDLE ${SRC_FILES}) |
| 63 | 182 set_property(TARGET minori PROPERTY CXX_STANDARD 11) |
| 11 | 183 set_property(TARGET minori PROPERTY AUTOMOC ON) |
| 184 set_property(TARGET minori PROPERTY AUTORCC ON) | |
| 2 | 185 |
| 108 | 186 target_include_directories(minori PUBLIC ${CURL_INCLUDE_DIRS} PRIVATE ${INCLUDE}) |
| 187 target_include_directories(minori PUBLIC ${Qt${QT_VERSION_MAJOR}Widgets_INCLUDE_DIRS}) | |
| 64 | 188 target_compile_options(minori PRIVATE -Wall -Wpedantic -Wextra -Wsuggest-override -Wold-style-cast) |
| 5 | 189 if(APPLE) |
| 11 | 190 target_compile_definitions(minori PUBLIC MACOSX) |
| 9 | 191 elseif(WIN32) |
| 11 | 192 target_compile_definitions(minori PUBLIC WIN32) |
| 5 | 193 endif() |
| 11 | 194 target_link_libraries(minori ${LIBRARIES}) |
