-
Notifications
You must be signed in to change notification settings - Fork 67
/
CMakeLists.txt
316 lines (239 loc) · 7.77 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
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
cmake_minimum_required(VERSION 3.0)
if(POLICY CMP0020)
cmake_policy(SET CMP0020 NEW)
endif(POLICY CMP0020)
if(POLICY CMP0048)
cmake_policy(SET CMP0048 NEW)
endif(POLICY CMP0048)
###################################################
### SECTION Project Settings
###################################################
set(PROJECT_NAME
"LIII" CACHE STRING "Project Name aka brand name"
)
set(PROJECT_FULLNAME
"${PROJECT_NAME} BitTorrent Client" CACHE STRING "${PROJECT_NAME} fullname"
)
set(PROJECT_DOMAIN
"github.com" CACHE STRING "Internet domain name for ${PROJECT_NAME}"
)
set(PROJECT_COMPANYNAME
"aliakseis" CACHE STRING "Company name"
)
set(CMAKE_MODULE_PATH
${CMAKE_MODULE_PATH}
"${CMAKE_CURRENT_SOURCE_DIR}/cmake"
)
unset(Boost_INCLUDE_DIR CACHE)
set(CMAKE_FIND_USE_CMAKE_ENVIRONMENT_PATH FALSE)
project(${PROJECT_NAME} VERSION 0.1.1.20)
message("Building ${PROJECT_NAME} version ${PROJECT_VERSION}")
###################################################
### END OF SECTION Project Settings
###################################################
###################################################
### SECTION Options
###################################################
option(DEVELOPER_BUILD_TESTS "Use Qt unit tests" OFF)
option(DEVELOPER_FEATURES "use some debug tricks for developers" OFF)
option(DEVELOPER_GENERATE_TRANSLATIONS "Generate ts-files for ${PROJECT_NAME}" OFF)
option(DEVELOPER_TRAFFIC_CONTROL "allow traffic control functionality" ON)
option(DEVELOPER_TORRENTS_LOGS "enable torrents logging" OFF)
###################################################
### END OF SECTION Options
###################################################
###################################################
### SECTION Base build settings
###################################################
# Using pre-defined macros for this project
include(cmake/projecthelper.cmake)
include(cmake/testing.cmake)
include(cmake/doxygenHelper.cmake)
include(cmake/machelper.cmake)
include(cmake/additionalOptions.cmake)
include(cmake/VersionConf.cmake)
include(cmake/integrate-qt.cmake)
include(cmake/install-translations.cmake)
if(WIN32 OR APPLE)
set(CMAKE_INSTALL_PREFIX
"${CMAKE_BINARY_DIR}/bin"
)
endif(WIN32 OR APPLE)
if (APPLE)
set(CLIENT_DATA_DIR "${PROJECT_NAME}.app")
set(BINARY_INSTALL_DIR .)
elseif (WIN32)
set (CLIENT_DATA_DIR ".")
set(BINARY_INSTALL_DIR .)
else ()
set (CLIENT_DATA_DIR "${CMAKE_INSTALL_PREFIX}/share/${PROJECT_NAME}")
set(BINARY_INSTALL_DIR bin)
endif()
# Setup testing utility for project
SETUP_TESTING()
###################################################
### END OF SECTION Base build settings
###################################################
###################################################
### SECTION Macro Definitions
###################################################
DEFINE_DEFAULT_DEFINITIONS()
add_definitions(
-DRARDLL
-DSILENT # for internal code
-DPROJECT_CLIENT_DATA_DIR="${CLIENT_DATA_DIR}"
-DBOOST_BIND_GLOBAL_PLACEHOLDERS
)
if(DEVELOPER_TRAFFIC_CONTROL)
add_definitions(
-DALLOW_TRAFFIC_CONTROL
)
endif(DEVELOPER_TRAFFIC_CONTROL)
###################################################
### END OF SECTION Macro Definitions
###################################################
###################################################
### SECTION Resources
###################################################
################
# Qt resources
################
set(RESOURCE_QT
${CMAKE_CURRENT_SOURCE_DIR}/resources/${PROJECT_NAME}/resources-${PROJECT_NAME}.qrc
)
set(RESOURCE_QT_IN
${CMAKE_CURRENT_SOURCE_DIR}/resources/resources.qrc.in
)
configure_file(${RESOURCE_QT_IN} ${RESOURCE_QT} @ONLY)
configure_file(${CMAKE_CURRENT_SOURCE_DIR}/resources/qt.conf ${CMAKE_CURRENT_SOURCE_DIR}/resources/${PROJECT_NAME}/qt.conf) # Qt plugins support
###################################################
### SECTION Frameworks and Libraries
###################################################
######
# Qt
######
#DETECT_QT()
set(QT_COMPONENTS_TO_USE
Qt5Core
Qt5Gui
Qt5Widgets
Qt5Network
Qt5LinguistTools
)
INTEGRATE_QT(${QT_COMPONENTS_TO_USE})
###########
# OpenSSL
###########
find_package (OpenSSL REQUIRED)
###################
# Doxygen
###################
SETUP_DOXYGEN()
###################
# Using externals
###################
include_directories(
${OPENSSL_INCLUDE_DIR}
${CMAKE_SOURCE_DIR}
${CMAKE_SOURCE_DIR}/src
${CMAKE_BINARY_DIR}/src
)
set(EXTERNAL_LIBS
${QT_QGIF_LIBRARY}
${QT_QICO_LIBRARY}
${OPENSSL_LIBRARIES}
${IMAGE_LIBS}
)
if(NOT WIN32)
set(EXTERNAL_LIBS
${EXTERNAL_LIBS}
${ZLIB_LIBRARIES}
)
endif(NOT WIN32)
if(APPLE)
find_library(MACOSX_FRAMEWORK_COCOA Cocoa)
find_library(MACOSX_FRAMEWORK_QTKIT QTKit)
find_library(MACOSX_FRAMEWORK_APPKIT AppKit)
set(MACOSX_FRAMEWORK_LIBS
"-lz"
${MACOSX_FRAMEWORK_COCOA}
${MACOSX_FRAMEWORK_QTKIT}
)
set(EXTERNAL_LIBS
${EXTERNAL_LIBS}
${MACOSX_FRAMEWORK_LIBS}
)
endif()
###################################################
### END OF SECTION Frameworks and Libraries
###################################################
################
# OS resources
################
if(WIN32)
set(RESOURCE_OS "${CMAKE_CURRENT_BINARY_DIR}/${PROJECT_NAME}/winres.rc")
set(ICON_FILE "${CMAKE_SOURCE_DIR}/resources/${PROJECT_NAME}/images/icon.ico")
set(RESOURCE_OS_IN "${CMAKE_CURRENT_SOURCE_DIR}/resources/winres.rc.in")
elseif(APPLE)
set(MACOSX_BUNDLE_ICON_FILE
appicon.icns
)
set(QT_MACOSX_RESOURCES
${CMAKE_CURRENT_SOURCE_DIR}/resources/MacOSXResources/macresources.qrc
${CMAKE_CURRENT_SOURCE_DIR}/resources/MacOSXResources/qt_menu.nib
)
set(QT_MACOSX_IMAGES
${CMAKE_CURRENT_SOURCE_DIR}/resources/MacOSXResources/images/copyarrowcursor.png
${CMAKE_CURRENT_SOURCE_DIR}/resources/MacOSXResources/images/forbiddencursor.png
${CMAKE_CURRENT_SOURCE_DIR}/resources/MacOSXResources/images/leopard-unified-toolbar-on.png
${CMAKE_CURRENT_SOURCE_DIR}/resources/MacOSXResources/images/pluscursor.png
${CMAKE_CURRENT_SOURCE_DIR}/resources/MacOSXResources/images/spincursor.png
${CMAKE_CURRENT_SOURCE_DIR}/resources/MacOSXResources/images/waitcursor.png
)
set(MACOSX_APPICON
${CMAKE_CURRENT_SOURCE_DIR}/resources/${PROJECT_NAME}/images/appicon.icns
)
set(MACOSX_UPDATER
${CMAKE_CURRENT_SOURCE_DIR}/resources/MacOSXResources/updater/updaterRO.scpt
)
set(RESOURCE_OS "${CMAKE_CURRENT_BINARY_DIR}/${PROJECT_NAME}/LIII.desktop")
set(RESOURCE_OS_IN "${CMAKE_CURRENT_SOURCE_DIR}/resources/LIII.desktop.in")
set(ICON_FILE "${MACOSX_APPICON}")
elseif(UNIX)
set(RESOURCE_OS "${CMAKE_CURRENT_BINARY_DIR}/${PROJECT_NAME}/LIII.desktop")
set(RESOURCE_OS_IN "${CMAKE_CURRENT_SOURCE_DIR}/resources/LIII.desktop.in")
endif()
##########
# Styles
##########
set(CSS_FILES
${CMAKE_CURRENT_SOURCE_DIR}/resources/${PROJECT_NAME}/style.css
)
if (APPLE)
set(CSS_FILES ${CSS_FILES}
${CMAKE_CURRENT_SOURCE_DIR}/resources/${PROJECT_NAME}/macstyle.css
)
endif (APPLE)
###################################################
### END OF SECTION Resources
###################################################
###################################################
### SECTION Languages Definitions
###################################################
set(TS_FILES
${CMAKE_SOURCE_DIR}/translations/translations_en.ts
${CMAKE_SOURCE_DIR}/translations/translations_pt-br.ts
${CMAKE_SOURCE_DIR}/translations/translations_zh-cn.ts
${CMAKE_SOURCE_DIR}/translations/translations_ko-kr.ts
${CMAKE_SOURCE_DIR}/translations/translations_zh-tw.ts
${CMAKE_SOURCE_DIR}/translations/translations_ru-ru.ts
${CMAKE_SOURCE_DIR}/translations/translations_es-cl.ts
${CMAKE_SOURCE_DIR}/translations/translations_bg-bg.ts
)
set(FILES_TO_TRANSLATE
)
###################################################
### END OF SECTION Languages Definitions
###################################################
set_property( GLOBAL PROPERTY USE_FOLDERS ON)
add_subdirectory(src)