forked from Isarhamster/chessx
-
Notifications
You must be signed in to change notification settings - Fork 0
/
CMakeLists.txt
151 lines (123 loc) · 3.13 KB
/
CMakeLists.txt
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
cmake_minimum_required(VERSION 3.10)
set(CMAKE_OSX_DEPLOYMENT_TARGET 10.13)
project(chessx LANGUAGES CXX)
set(CMAKE_CXX_STANDARD 11)
set(CMAKE_CXX_STANDARD_REQUIRED ON)
set(CMAKE_CXX_EXTENSIONS OFF)
option(ENABLE_SOUNDS "Enable sounds (requires Qt5::Multimedia)" ON)
option(ENABLE_TTS "Enable text-to-speech (requires Qt5::TextToSpeech)" ON)
option(ENABLE_SCID_SUPPORT "Enable support for Scid database format (*.si4)" ON)
add_subdirectory(dep)
# common definitions to use with Qt
add_library(qt_config INTERFACE)
target_compile_definitions(qt_config INTERFACE
QT_DEPRECATED_WARNINGS
QT_NO_CAST_TO_ASCII
QT_USE_QSTRINGBUILDER
)
set(REQUIRED_QT_COMPONENTS
Core Xml DBus Network OpenGL Svg PrintSupport Gui Widgets
)
if (ENABLE_SOUNDS)
list(APPEND REQUIRED_QT_COMPONENTS Multimedia MultimediaWidgets)
endif()
if (ENABLE_TTS)
list(APPEND REQUIRED_QT_COMPONENTS TextToSpeech)
endif()
find_package(Qt5 REQUIRED
LinguistTools
"${REQUIRED_QT_COMPONENTS}"
Test
)
# TODO: enable warnings
# CONFIG += warn_on
# put translations.rc alongside generated .qm files
configure_file(translations.qrc ${CMAKE_CURRENT_BINARY_DIR} COPYONLY)
# list of .ts files to compile into .qm
set(TRANSLATIONS_SRC_FILES
# i18n/chessx_da.ts
i18n/chessx_de.ts
# i18n/chessx_fr.ts
# i18n/chessx_it.ts
# i18n/chessx_cz.ts
# i18n/chessx_ru.ts
)
set_source_files_properties(${TRANSLATIONS_SRC_FILES}
PROPERTIES
OUTPUT_LOCATION "${CMAKE_CURRENT_BINARY_DIR}/i18n"
)
qt5_add_translation(TRANSLATIONS_BIN_FILES ${TRANSLATIONS_SRC_FILES})
set(CMAKE_AUTOMOC ON)
set(CMAKE_AUTORCC ON)
set(CMAKE_AUTOUIC ON)
add_subdirectory(src)
set(OTHER_FILES
#[[
data/templates/pgn-default.template
data/templates/notation-default.template
data/templates/latex-default.template
data/templates/html-default.template
ChangeLog
COPYING
ChangeLog.txt
data/help/about.css
data/help/about-dark.css
data/help/about0.html
data/help/about1.html
data/help/about1a.html
data/help/about2.html
data/help/about3.html
data/help/about4.html
data/help/about5.html
data/help/about6.html
setup7-64.iss
setup7-32.iss
setupXP.iss
data/styles/orange.css
unix/chessx.desktop
]]
)
add_executable(chessx WIN32
src/gui/main.cpp
resources.qrc
${CMAKE_CURRENT_BINARY_DIR}/translations.qrc
${OTHER_FILES}
)
target_link_libraries(chessx PRIVATE
qt_config
quazip
bitboard
board
eco
gui
)
if (CMAKE_HOST_APPLE)
# Make macOS bundle instead of bare executable
set_target_properties(chessx PROPERTIES
MACOSX_BUNDLE TRUE
# TODO: use variables in Info.plist template
MACOSX_BUNDLE_INFO_PLIST "${CMAKE_CURRENT_SOURCE_DIR}/mac_osx/Info.plist"
)
# embed required resources
target_sources(chessx PRIVATE
mac_osx/Info.plist
mac_osx/qt_menu.nib
data/images/chessx.icns
)
set_property(
TARGET chessx
APPEND PROPERTY
RESOURCE
mac_osx/qt_menu.nib
data/images/chessx.icns
)
# TODO: embed engines & timeseal
endif()
set(CMAKE_AUTOMOC OFF)
set(CMAKE_AUTORCC OFF)
set(CMAKE_AUTOUIC OFF)
option(ENABLE_TESTING "Enable testing" OFF)
if (ENABLE_TESTING)
enable_testing()
add_subdirectory(tests/unittests)
endif()