Mercurial > minori
comparison CMakeLists.txt @ 108:2004b41d4a59
*: huge commit
1. WORKING LOCALIZATION + translation for Spanish and British English
2. idk like 2 changes for the dark theme :)
author | Paper <mrpapersonic@gmail.com> |
---|---|
date | Sun, 05 Nov 2023 23:31:49 -0500 |
parents | 6d8da6e64d61 |
children | 79714c95a145 |
comparison
equal
deleted
inserted
replaced
107:49c8d1976869 | 108:2004b41d4a59 |
---|---|
1 cmake_minimum_required(VERSION 3.16) | 1 cmake_minimum_required(VERSION 3.18) |
2 project(minori LANGUAGES CXX VERSION 0.1.0) | 2 project(minori LANGUAGES CXX VERSION 0.1.0) |
3 | 3 |
4 if(APPLE) | 4 if(APPLE) |
5 enable_language(OBJCXX) | 5 enable_language(OBJCXX) |
6 endif() | 6 endif() |
8 set(CMAKE_RUNTIME_OUTPUT_DIRECTORY "${CMAKE_BINARY_DIR}") | 8 set(CMAKE_RUNTIME_OUTPUT_DIRECTORY "${CMAKE_BINARY_DIR}") |
9 set(CMAKE_LIBRARY_OUTPUT_DIRECTORY "${CMAKE_BINARY_DIR}") | 9 set(CMAKE_LIBRARY_OUTPUT_DIRECTORY "${CMAKE_BINARY_DIR}") |
10 set(CMAKE_ARCHIVE_OUTPUT_DIRECTORY "${CMAKE_BINARY_DIR}") | 10 set(CMAKE_ARCHIVE_OUTPUT_DIRECTORY "${CMAKE_BINARY_DIR}") |
11 | 11 |
12 option(BUILD_SHARED_LIBS "Build using shared libraries" ON) | 12 option(BUILD_SHARED_LIBS "Build using shared libraries" ON) |
13 option(USE_QT6 "Build with Qt 6 instead of Qt 5" OFF) | 13 option(USE_QT6 "Force build with Qt 6" OFF) |
14 option(USE_QT5 "Force build with Qt 5" OFF) | |
14 | 15 |
15 add_subdirectory(dep/anitomy) | 16 add_subdirectory(dep/anitomy) |
16 add_subdirectory(dep/animia) | 17 add_subdirectory(dep/animia) |
17 add_subdirectory(dep/pugixml) | 18 add_subdirectory(dep/pugixml) |
18 | 19 |
19 # Fix for mingw64 | 20 # Fix for mingw64 |
20 list(APPEND CMAKE_FIND_LIBRARY_SUFFIXES ".dll.a" ".a") | 21 list(APPEND CMAKE_FIND_LIBRARY_SUFFIXES ".dll.a" ".a") |
21 | 22 |
22 if(USE_QT6) | 23 if (USE_QT6) |
23 find_package(Qt6 COMPONENTS Widgets REQUIRED) | 24 set(QT_VERSION_MAJOR 6) |
25 elseif(USE_Qt5) | |
26 set(QT_VERSION_MAJOR 5) | |
24 else() | 27 else() |
25 find_package(Qt5 COMPONENTS Widgets REQUIRED) | 28 find_package(QT NAMES Qt6 Qt5 REQUIRED COMPONENTS Core) |
26 endif() | 29 endif() |
30 | |
31 find_package(Qt${QT_VERSION_MAJOR} REQUIRED COMPONENTS Widgets LinguistTools) | |
32 | |
27 find_package(CURL REQUIRED) | 33 find_package(CURL REQUIRED) |
28 | 34 |
29 set(LIBRARIES | 35 set(LIBRARIES |
30 ${CURL_LIBRARIES} | 36 ${CURL_LIBRARIES} |
37 ${Qt${QT_VERSION_MAJOR}Widgets_LIBRARIES} | |
31 anitomy | 38 anitomy |
32 animia | 39 animia |
33 ) | 40 ) |
34 | |
35 if(USE_QT6) | |
36 list(APPEND LIBRARIES ${Qt6Widgets_LIBRARIES}) | |
37 else() | |
38 list(APPEND LIBRARIES ${Qt5Widgets_LIBRARIES}) | |
39 endif() | |
40 | 41 |
41 # We need Cocoa for some OS X stuff | 42 # We need Cocoa for some OS X stuff |
42 if(APPLE) | 43 if(APPLE) |
43 find_library(COCOA_LIBRARY Cocoa) | 44 find_library(COCOA_LIBRARY Cocoa) |
44 list(APPEND LIBRARIES ${COCOA_LIBRARY}) | 45 list(APPEND LIBRARIES ${COCOA_LIBRARY}) |
60 src/core/time.cc | 61 src/core/time.cc |
61 | 62 |
62 # Main window | 63 # Main window |
63 src/gui/window.cc | 64 src/gui/window.cc |
64 src/gui/theme.cc | 65 src/gui/theme.cc |
66 src/gui/locale.cc | |
65 | 67 |
66 # Main window pages | 68 # Main window pages |
67 src/gui/pages/anime_list.cc | 69 src/gui/pages/anime_list.cc |
68 src/gui/pages/now_playing.cc | 70 src/gui/pages/now_playing.cc |
69 src/gui/pages/statistics.cc | 71 src/gui/pages/statistics.cc |
103 # Qt resources | 105 # Qt resources |
104 rc/icons.qrc | 106 rc/icons.qrc |
105 rc/dark.qrc | 107 rc/dark.qrc |
106 ) | 108 ) |
107 | 109 |
110 set(INCLUDE | |
111 include | |
112 dep/pugixml/src | |
113 dep/animia/include | |
114 dep/anitomy | |
115 dep | |
116 ) | |
117 | |
118 set(TS_FILES | |
119 rc/locale/en_GB.ts | |
120 rc/locale/es.ts | |
121 ) | |
122 | |
123 set_source_files_properties(${TS_FILES} PROPERTIES OUTPUT_LOCATION "${CMAKE_CURRENT_BINARY_DIR}/rc/locale") | |
124 | |
125 # dumb little hack to get this working on Qt5 and Qt6 | |
126 cmake_language(CALL qt${QT_VERSION_MAJOR}_create_translation ${SRC_FILES} ${TS_FILES} OPTIONS "-I${CMAKE_CURRENT_SOURCE_DIR}/include") | |
127 cmake_language(CALL qt${QT_VERSION_MAJOR}_add_translation QM_FILES ${TS_FILES}) | |
128 list(APPEND SRC_FILES ${QM_FILES}) | |
129 | |
130 function(qt_create_resource_file outfile) | |
131 set(QRC "<!DOCTYPE rcc><RCC version=\"1.0\">\n\t<qresource>\n") | |
132 get_filename_component(DIR ${outfile} DIRECTORY) | |
133 foreach (qm ${ARGN}) | |
134 file(RELATIVE_PATH name ${DIR} ${qm}) | |
135 string(APPEND QRC "\t\t<file>${name}</file>\n") | |
136 endforeach() | |
137 string(APPEND QRC "\t</qresource>\n</RCC>\n") | |
138 file(WRITE ${outfile} ${QRC}) | |
139 endfunction() | |
140 | |
141 qt_create_resource_file("${CMAKE_CURRENT_BINARY_DIR}/rc/locale.qrc" ${QM_FILES}) | |
142 list(APPEND SRC_FILES "${CMAKE_CURRENT_BINARY_DIR}/rc/locale.qrc") | |
143 | |
144 # This is also used in the Win32 rc file | |
108 set(RC_INFO_STRING "A lightweight anime tracker built with Qt.") | 145 set(RC_INFO_STRING "A lightweight anime tracker built with Qt.") |
109 | 146 |
110 if(APPLE) # Mac OS X (or OS X (or macOS)) | 147 if(APPLE) # Mac OS X (or OS X (or macOS)) |
111 set(MACOSX_BUNDLE_BUNDLE_NAME "Minori") | 148 set(MACOSX_BUNDLE_BUNDLE_NAME "Minori") |
112 set(MACOSX_BUNDLE_BUNDLE_VERSION ${minori_VERSION}) | 149 set(MACOSX_BUNDLE_BUNDLE_VERSION ${minori_VERSION}) |
138 add_executable(minori WIN32 MACOSX_BUNDLE ${SRC_FILES}) | 175 add_executable(minori WIN32 MACOSX_BUNDLE ${SRC_FILES}) |
139 set_property(TARGET minori PROPERTY CXX_STANDARD 11) | 176 set_property(TARGET minori PROPERTY CXX_STANDARD 11) |
140 set_property(TARGET minori PROPERTY AUTOMOC ON) | 177 set_property(TARGET minori PROPERTY AUTOMOC ON) |
141 set_property(TARGET minori PROPERTY AUTORCC ON) | 178 set_property(TARGET minori PROPERTY AUTORCC ON) |
142 | 179 |
143 target_include_directories(minori PUBLIC ${CURL_INCLUDE_DIRS} PRIVATE include dep/pugixml/src dep/animia/include dep/anitomy dep) | 180 target_include_directories(minori PUBLIC ${CURL_INCLUDE_DIRS} PRIVATE ${INCLUDE}) |
144 if(USE_QT6) | 181 target_include_directories(minori PUBLIC ${Qt${QT_VERSION_MAJOR}Widgets_INCLUDE_DIRS}) |
145 target_include_directories(minori PUBLIC ${Qt6Widgets_INCLUDE_DIRS}) | |
146 else() | |
147 target_include_directories(minori PUBLIC ${Qt5Widgets_INCLUDE_DIRS}) | |
148 endif() | |
149 target_compile_options(minori PRIVATE -Wall -Wpedantic -Wextra -Wsuggest-override -Wold-style-cast) | 182 target_compile_options(minori PRIVATE -Wall -Wpedantic -Wextra -Wsuggest-override -Wold-style-cast) |
150 if(APPLE) | 183 if(APPLE) |
151 target_compile_definitions(minori PUBLIC MACOSX) | 184 target_compile_definitions(minori PUBLIC MACOSX) |
152 elseif(WIN32) | 185 elseif(WIN32) |
153 target_compile_definitions(minori PUBLIC WIN32) | 186 target_compile_definitions(minori PUBLIC WIN32) |