-
-
Notifications
You must be signed in to change notification settings - Fork 363
/
variables.cmake
511 lines (431 loc) · 11.6 KB
/
variables.cmake
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
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
if(QT_VERSION_MAJOR GREATER 5)
set(QT_MAJOR_VERSION 6)
else(QT_VERSION_MAJOR EQUAL 5)
set(QT_MAJOR_VERSION 5)
endif()
set(CMAKE_AUTOMOC ON)
set(CMAKE_AUTOUIC ON)
set(CMAKE_AUTORCC ON)
add_definitions(-DUNICODE)
set(APPNAME "Q Light Controller Plus")
set(FXEDNAME "Fixture Definition Editor")
if(ANDROID OR IOS)
set(qmlui ON)
endif()
if(qmlui)
add_definitions(-DQMLUI)
set(APPVERSION "5.0.0 Beta 3")
else()
set(APPVERSION "4.13.2 GIT")
endif()
if(UNIX)
set(OLA_GIT "/usr/src/ola") # OLA directories
endif()
if(APPLE)
set(CMAKE_MACOSX_RPATH ON)
set(CMAKE_SKIP_BUILD_RPATH FALSE)
set(CMAKE_BUILD_WITH_INSTALL_RPATH FALSE)
set(CMAKE_INSTALL_RPATH_USE_LINK_PATH TRUE)
set(CMAKE_INSTALL_RPATH "@executable_path/../Frameworks")
endif()
if(WIN32)
set(DESTDIR "./")
endif()
# if(WIN32)
# set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -Wl,--enable-auto-import")
# endif()
# Installation paths
if (WIN32)
set(INSTALLROOT "$ENV{SystemDrive}/qlcplus")
elseif (APPLE)
set(INSTALLROOT "$ENV{HOME}/QLC+.app/Contents")
elseif (UNIX)
set(INSTALLROOT "/usr")
endif ()
if (ANDROID)
set(INSTALLROOT "/")
elseif (IOS)
set(INSTALLROOT "/")
endif ()
if (NOT ${INSTALL_ROOT} STREQUAL "/")
set(INSTALLROOT ${INSTALL_ROOT}/${INSTALLROOT})
message("Set INSTALL_ROOT ${INSTALL_ROOT}")
endif()
IF(CMAKE_INSTALL_PREFIX_INITIALIZED_TO_DEFAULT)
SET(CMAKE_INSTALL_PREFIX ${INSTALLROOT} CACHE PATH "install prefix" FORCE)
ENDIF(CMAKE_INSTALL_PREFIX_INITIALIZED_TO_DEFAULT)
# Binaries
if (WIN32)
set(BINDIR "")
elseif (APPLE)
set(BINDIR "MacOS")
elseif (UNIX)
set(BINDIR "bin")
endif ()
if (ANDROID)
set(BINDIR "bin")
elseif (IOS)
set(BINDIR "")
endif()
# Libraries
if (WIN32)
set(LIBSDIR "")
elseif (APPLE)
set(LIBSDIR "Frameworks")
elseif (UNIX)
set(LIBSDIR "${CMAKE_INSTALL_LIBDIR}")
endif ()
if (ANDROID)
set(LIBSDIR "/libs/armeabi-v7a")
elseif (IOS)
set(LIBSDIR "lib")
endif ()
# Data
if (WIN32)
set(DATADIR "")
elseif (APPLE)
set(DATADIR "Resources")
elseif (UNIX)
set(DATADIR "share/qlcplus")
endif ()
if (ANDROID)
set(DATADIR "/assets")
elseif (IOS)
set(DATADIR "")
elseif (appimage)
set(DATADIR "../share/qlcplus")
endif ()
# User Data
if (WIN32)
set(USERDATADIR "QLC+")
elseif (APPLE)
set(USERDATADIR "Library/Application Support/QLC+")
elseif (UNIX)
set(USERDATADIR ".qlcplus")
endif ()
if (ANDROID)
set(USERDATADIR ".qlcplus")
elseif (IOS)
set(USERDATADIR ".qlcplus")
endif ()
# Documentation
if (WIN32)
set(DOCSDIR "Documents")
elseif (APPLE)
set(DOCSDIR "${DATADIR}/Documents")
elseif (UNIX)
set(DOCSDIR "${DATADIR}/documents")
endif ()
if (ANDROID)
set(DOCSDIR "${DATADIR}/documents")
elseif (IOS)
set(DOCSDIR "Documents")
endif ()
# Input profiles
if (WIN32)
set(INPUTPROFILEDIR "InputProfiles")
elseif (APPLE)
set(INPUTPROFILEDIR "${DATADIR}/InputProfiles")
elseif (UNIX)
set(INPUTPROFILEDIR "${DATADIR}/inputprofiles")
endif ()
if (ANDROID)
set(INPUTPROFILEDIR "${DATADIR}/inputprofiles")
elseif (IOS)
set(INPUTPROFILEDIR "InputProfiles")
endif ()
# User input profiles
if (WIN32)
set(USERINPUTPROFILEDIR "${USERDATADIR}/InputProfiles")
elseif (APPLE)
set(USERINPUTPROFILEDIR "${USERDATADIR}/InputProfiles")
elseif (UNIX)
set(USERINPUTPROFILEDIR "${USERDATADIR}/inputprofiles")
endif ()
if (ANDROID)
set(USERINPUTPROFILEDIR "${USERDATADIR}/inputprofiles")
elseif (IOS)
set(USERINPUTPROFILEDIR "${USERDATADIR}/InputProfiles")
endif ()
# Midi templates
if (WIN32)
set(MIDITEMPLATEDIR "MidiTemplates")
elseif (APPLE)
set(MIDITEMPLATEDIR "${DATADIR}/MidiTemplates")
elseif (UNIX)
set(MIDITEMPLATEDIR "${DATADIR}/miditemplates")
endif ()
if (ANDROID)
set(MIDITEMPLATEDIR "${DATADIR}/miditemplates")
elseif (IOS)
set(MIDITEMPLATEDIR "MidiTemplates")
endif ()
# User midi templates
if (WIN32)
set(USERMIDITEMPLATEDIR "${USERDATADIR}/MidiTemplates")
elseif (APPLE)
set(USERMIDITEMPLATEDIR "${USERDATADIR}/MidiTemplates")
elseif (UNIX)
set(USERMIDITEMPLATEDIR "${USERDATADIR}/miditemplates")
endif ()
if (ANDROID)
set(USERMIDITEMPLATEDIR "${USERDATADIR}/miditemplates")
elseif (IOS)
set(USERMIDITEMPLATEDIR "${USERDATADIR}/MidiTemplates")
endif ()
# Channel modifiers templates
if (WIN32)
set(MODIFIERSTEMPLATEDIR "ModifiersTemplates")
elseif (APPLE)
set(MODIFIERSTEMPLATEDIR "${DATADIR}/ModifiersTemplates")
else ()
set(MODIFIERSTEMPLATEDIR "${DATADIR}/modifierstemplates")
endif ()
if (ANDROID)
set(MODIFIERSTEMPLATEDIR "${DATADIR}/modifierstemplates")
elseif (IOS)
set(MODIFIERSTEMPLATEDIR "ModifiersTemplates")
endif ()
# User modifiers templates
if (WIN32)
set(USERMODIFIERSTEMPLATEDIR "${USERDATADIR}/ModifiersTemplates")
elseif (APPLE)
set(USERMODIFIERSTEMPLATEDIR "${USERDATADIR}/ModifiersTemplates")
elseif (UNIX)
set(USERMODIFIERSTEMPLATEDIR "${USERDATADIR}/modifierstemplates")
endif ()
if (ANDROID)
set(USERMODIFIERSTEMPLATEDIR "${USERDATADIR}/modifierstemplates")
elseif (IOS)
set(USERMODIFIERSTEMPLATEDIR "${USERDATADIR}/ModifiersTemplates")
endif ()
# Fixtures
if (WIN32)
set(FIXTUREDIR "Fixtures")
elseif (APPLE)
set(FIXTUREDIR "${DATADIR}/Fixtures")
elseif (UNIX)
set(FIXTUREDIR "${DATADIR}/fixtures")
endif ()
if (ANDROID)
set(FIXTUREDIR "${DATADIR}/fixtures")
elseif (IOS)
set(FIXTUREDIR "Fixtures")
endif ()
# Gobos
if (WIN32)
set(GOBODIR "Gobos")
elseif (APPLE)
set(GOBODIR "${DATADIR}/Gobos")
elseif (UNIX)
set(GOBODIR "${DATADIR}/gobos")
endif ()
if (ANDROID)
set(GOBODIR "${DATADIR}/gobos")
elseif (IOS)
set(GOBODIR "Gobos")
endif ()
# User fixtures
if (WIN32)
set(USERFIXTUREDIR "${USERDATADIR}/Fixtures")
elseif (APPLE)
set(USERFIXTUREDIR "${USERDATADIR}/Fixtures")
elseif (UNIX)
set(USERFIXTUREDIR "${USERDATADIR}/fixtures")
endif ()
if (ANDROID)
set(USERFIXTUREDIR "${USERDATADIR}/fixtures")
elseif (IOS)
set(USERFIXTUREDIR "${USERDATADIR}/Fixtures")
endif ()
# Plugins
if (WIN32)
set(PLUGINDIR "Plugins")
elseif (APPLE)
set(PLUGINDIR "PlugIns")
elseif (UNIX)
if (appimage)
set(PLUGINDIR "../lib/qt${QT_MAJOR_VERSION}/plugins/qlcplus")
else ()
set(PLUGINDIR "${LIBSDIR}/qt${QT_MAJOR_VERSION}/plugins/qlcplus")
endif ()
endif ()
if (ANDROID OR IOS)
set(PLUGINDIR "Plugins")
endif ()
# Audio Plugins
if (WIN32)
set(AUDIOPLUGINDIR "${PLUGINDIR}/Audio")
elseif (APPLE)
set(AUDIOPLUGINDIR "${PLUGINDIR}/Audio")
elseif (UNIX)
set(AUDIOPLUGINDIR "${PLUGINDIR}/audio")
endif ()
if (ANDROID OR IOS)
set(AUDIOPLUGINDIR "${PLUGINDIR}/Audio")
endif ()
# Translations
if (WIN32)
set(TRANSLATIONDIR "")
elseif (APPLE)
set(TRANSLATIONDIR "${DATADIR}/Translations")
elseif (UNIX)
set(TRANSLATIONDIR "${DATADIR}/translations")
endif ()
if (ANDROID)
set(TRANSLATIONDIR "${DATADIR}/translations")
elseif (IOS)
set(TRANSLATIONDIR "")
endif ()
# RGB Scripts
if (WIN32)
set(RGBSCRIPTDIR "RGBScripts")
elseif (APPLE)
set(RGBSCRIPTDIR "${DATADIR}/RGBScripts")
else ()
set(RGBSCRIPTDIR "${DATADIR}/rgbscripts")
endif ()
if (ANDROID)
set(RGBSCRIPTDIR "${DATADIR}/rgbscripts")
elseif (IOS)
set(RGBSCRIPTDIR "RGBScripts")
endif ()
# User RGB Scripts
if (WIN32)
set(USERRGBSCRIPTDIR "${USERDATADIR}/RGBScripts")
elseif (APPLE)
set(USERRGBSCRIPTDIR "${USERDATADIR}/RGBScripts")
elseif (UNIX)
set(USERRGBSCRIPTDIR "${USERDATADIR}/rgbscripts")
endif ()
if (ANDROID)
set(USERRGBSCRIPTDIR "${USERDATADIR}/rgbscripts")
elseif (IOS)
set(USERRGBSCRIPTDIR "${USERDATADIR}/RGBScripts")
endif ()
# Web Files
if (WIN32)
set(WEBFILESDIR "Web")
elseif (APPLE)
set(WEBFILESDIR "${DATADIR}/Web")
else ()
set(WEBFILESDIR "${DATADIR}/web")
endif ()
if (ANDROID)
set(WEBFILESDIR "${DATADIR}/web")
elseif (IOS)
set(WEBFILESDIR "Web")
endif ()
# Samples
if (WIN32)
set(SAMPLESDIR "${INSTALLROOT}")
else ()
set(SAMPLESDIR "${INSTALLROOT}/${DATADIR}")
endif ()
# 3D Meshes
if (WIN32)
set(MESHESDIR "Meshes")
elseif (APPLE)
set(MESHESDIR "${DATADIR}/Meshes")
else ()
set(MESHESDIR "${DATADIR}/meshes")
endif ()
if (ANDROID)
set(MESHESDIR "${DATADIR}/meshes")
elseif (IOS)
set(MESHESDIR "Meshes")
endif ()
# Color filters
if (WIN32)
set(COLORFILTERSDIR "ColorFilters")
elseif (APPLE)
set(COLORFILTERSDIR "${DATADIR}/ColorFilters")
else ()
set(COLORFILTERSDIR "${DATADIR}/colorfilters")
endif ()
if (ANDROID)
set(COLORFILTERSDIR "${DATADIR}/colorfilters")
elseif (IOS)
set(COLORFILTERSDIR "ColorFilters")
endif ()
# User Color filters
if (WIN32)
set(USERCOLORFILTERSDIR "${USERDATADIR}/ColorFilters")
elseif (APPLE)
set(USERCOLORFILTERSDIR "${USERDATADIR}/ColorFilters")
elseif (UNIX)
set(USERCOLORFILTERSDIR "${USERDATADIR}/colorfilters")
endif ()
if (ANDROID)
set(USERCOLORFILTERSDIR "${USERDATADIR}/colorfilters")
elseif (IOS)
set(USERCOLORFILTERSDIR "${USERDATADIR}/ColorFilters")
endif ()
# udev rules
if(UNIX AND NOT APPLE)
if (${INSTALL_ROOT} STREQUAL "/")
set(UDEVRULESDIR "/etc/udev/rules.d")
else()
set(UDEVRULESDIR "${INSTALL_ROOT}/etc/udev/rules.d")
endif()
endif()
# AppStream metadata
if(UNIX AND NOT APPLE)
set(METAINFODIR "${INSTALLROOT}/share/metainfo")
endif()
# man
if(UNIX AND NOT APPLE)
set(MANDIR "share/man/man1/")
endif()
# Get QT_QMAKE_EXECUTABLE path
# Get the length of the CMAKE_PREFIX_PATH variable
string(LENGTH "${CMAKE_PREFIX_PATH}" CMAKE_PREFIX_PATH_LENGTH)
# Check if the CMAKE_PREFIX_PATH ends with a slash
if (CMAKE_PREFIX_PATH_LENGTH GREATER 0)
# Subtract one from the length to get the last index
math (EXPR CMAKE_PREFIX_PATH_LAST_INDEX "${CMAKE_PREFIX_PATH_LENGTH}-1")
string(SUBSTRING "${CMAKE_PREFIX_PATH}" ${CMAKE_PREFIX_PATH_LAST_INDEX} 1 CMAKE_PREFIX_PATH_LAST_CHAR)
if ((${CMAKE_PREFIX_PATH_LAST_CHAR} STREQUAL "/") OR (${CMAKE_PREFIX_PATH_LAST_CHAR} STREQUAL "\\"))
set(QT_QMAKE_EXECUTABLE "${CMAKE_PREFIX_PATH}../../bin/qmake")
else()
set(QT_QMAKE_EXECUTABLE "${CMAKE_PREFIX_PATH}/../../bin/qmake")
endif()
endif()
# Get QT_INSTALL_PREFIX, QT_INSTALL_LIBS, QT_INSTALL_PLUGINS variables
execute_process(
COMMAND ${QT_QMAKE_EXECUTABLE} -query QT_INSTALL_PREFIX
OUTPUT_VARIABLE QT_INSTALL_PREFIX
)
execute_process(
COMMAND ${QT_QMAKE_EXECUTABLE} -query QT_INSTALL_LIBS
OUTPUT_VARIABLE QT_INSTALL_LIBS
)
execute_process(
COMMAND ${QT_QMAKE_EXECUTABLE} -query QT_INSTALL_PLUGINS
OUTPUT_VARIABLE QT_INSTALL_PLUGINS
)
if (UNIX AND NOT APPLE)
set(QTPREFIX "${QT_INSTALL_PREFIX}")
string(FIND "${QTPREFIX}" "/usr" inUsr)
if (${inUsr} EQUAL 0)
set(QTLIBSDIR "${QT_INSTALL_LIBS}")
set(QTPLUGINSDIR "${QT_INSTALL_PLUGINS}")
string(REPLACE "/usr/" "" LIBSDIR "${QTLIBSDIR}")
string(REPLACE "/usr/" "" PLUGINDIR "${QTPLUGINSDIR}/qlcplus")
set(AUDIOPLUGINDIR "${PLUGINDIR}/audio")
endif()
# message("QT_INSTALL_PREFIX: ${QT_INSTALL_PREFIX}")
# message("QT_INSTALL_LIBS: ${QT_INSTALL_LIBS}")
# message("Linux LIBSDIR: ${INSTALLROOT}/${LIBSDIR}")
# message("Linux PLUGINDIR: ${INSTALLROOT}/${PLUGINDIR}")
endif()
if(MSVC)
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} /wd4701")
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} /wd4101")
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} /wd4456") # Suppress warning C4456: declaration of '_container_' hides previous local declaration in foreach
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} /WX")
elseif(NOT APPLE AND NOT IOS)
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Werror")
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wextra")
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wall")
endif()