forked from musescore/MuseScore
-
Notifications
You must be signed in to change notification settings - Fork 0
/
SetupConfigure.cmake
333 lines (284 loc) · 11.1 KB
/
SetupConfigure.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
#=============================================================================
# MuseScore
# Linux Music Score Editor
#
# Copyright (C) 2023 MuseScore BVBA and others
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License version 2.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software
# Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
#=============================================================================
include(GetBuildType)
include(GetPlatformInfo)
include(version)
if (NOT MUSESCORE_BUILD_CONFIGURATION)
set(MUSESCORE_BUILD_CONFIGURATION "app")
endif()
if (NOT MUSESCORE_BUILD_MODE)
set(MUSESCORE_BUILD_MODE "dev")
endif()
# Set revision for local builds
# Before need run 'make revision' or 'msvc_build.bat revision'
include(${CMAKE_CURRENT_LIST_DIR}/build/cmake/TryUseLocalRevision.cmake)
message(STATUS "MUSESCORE_BUILD_CONFIGURATION: ${MUSESCORE_BUILD_CONFIGURATION}")
message(STATUS "MUSESCORE_BUILD_MODE: ${MUSESCORE_BUILD_MODE}")
message(STATUS "MUSESCORE_BUILD_NUMBER: ${CMAKE_BUILD_NUMBER}")
string(TOUPPER ${MUSESCORE_BUILD_CONFIGURATION} BUILD_CONFIGURE)
string(TOUPPER ${MUSESCORE_BUILD_MODE} BUILD_MODE)
###########################################
# Setup by mode
###########################################
if(BUILD_MODE MATCHES "DEV")
set(MUSESCORE_UNSTABLE ON)
set(MUSESCORE_RELEASE_CHANNEL "dev")
set(MUSESCORE_NAME_VERSION "${MUSESCORE_NAME} ${MUSESCORE_VERSION_MAJOR} ${MUSESCORE_RELEASE_CHANNEL}")
set(MUSESCORE_IS_PRERELEASE ON)
set(MUSESCORE_ALLOW_UPDATE_ON_PRERELEASE OFF)
endif()
if(BUILD_MODE MATCHES "TESTING")
set(MUSESCORE_UNSTABLE OFF)
set(MUSESCORE_RELEASE_CHANNEL "Testing")
set(MUSESCORE_NAME_VERSION "${MUSESCORE_NAME} ${MUSESCORE_VERSION_MAJOR} ${MUSESCORE_RELEASE_CHANNEL}")
set(MUSESCORE_IS_PRERELEASE ON)
set(MUSESCORE_ALLOW_UPDATE_ON_PRERELEASE ON)
endif()
if(BUILD_MODE MATCHES "RELEASE")
set(MUSESCORE_UNSTABLE OFF)
set(MUSESCORE_NAME_VERSION "${MUSESCORE_NAME} ${MUSESCORE_VERSION_MAJOR}")
set(MUSESCORE_IS_PRERELEASE OFF)
set(MUSESCORE_ALLOW_UPDATE_ON_PRERELEASE OFF)
endif()
###########################################
# Setup paths
###########################################
if (OS_IS_MAC)
SET(Mscore_INSTALL_NAME "Contents/Resources/")
SET(Mscore_SHARE_NAME "mscore.app/")
elseif (OS_IS_WIN)
SET(Mscore_INSTALL_NAME "")
SET(Mscore_SHARE_NAME "./")
else()
SET(Mscore_INSTALL_NAME "mscore${MUSESCORE_INSTALL_SUFFIX}-${MUSESCORE_VERSION_MAJ_MIN}/")
SET(Mscore_SHARE_NAME "share/")
endif()
###########################################
# CONFIGURE: Desktop App
###########################################
set(MUE_GENERAL_APP OFF)
if(BUILD_CONFIGURE MATCHES "APP")
set(MUE_GENERAL_APP ON)
endif()
if(BUILD_CONFIGURE MATCHES "APP-PORTABLE")
set(MUE_GENERAL_APP ON)
set(WIN_PORTABLE ON)
endif()
if (MUE_GENERAL_APP)
if (BUILD_IS_DEBUG)
set(MUE_ENABLE_LOGGER_DEBUGLEVEL ON)
else()
set(MUE_ENABLE_LOGGER_DEBUGLEVEL OFF)
endif()
endif()
if (WIN_PORTABLE)
set(MUE_BUILD_UPDATE_MODULE OFF)
endif()
if (OS_IS_FBSD)
message(WARNING "Not building unsupported chrashpad client on FreeBSD")
set(MUE_BUILD_CRASHPAD_CLIENT OFF)
endif()
###########################################
# CONFIGURE: VTest
###########################################
if(BUILD_CONFIGURE MATCHES "VTEST")
set(MUE_BUILD_UNIT_TESTS OFF)
set(MUE_ENABLE_LOGGER_DEBUGLEVEL ON)
set(MUE_BUILD_ASAN ON)
set(MUE_BUILD_IMAGESEXPORT_MODULE ON)
set(MUE_BUILD_CONVERTER_MODULE ON)
set(MUE_BUILD_PROJECT_MODULE ON)
set(MUE_BUILD_NOTATION_MODULE ON)
set(MUE_BUILD_UI_MODULE ON)
set(MUE_BUILD_ACCESSIBILITY_MODULE OFF)
set(MUE_BUILD_AUDIO_MODULE OFF)
set(MUE_BUILD_BRAILLE_MODULE OFF)
set(MUE_BUILD_MIDI_MODULE OFF)
set(MUE_BUILD_MPE_MODULE OFF)
set(MUE_BUILD_MUSESAMPLER_MODULE OFF)
set(MUE_BUILD_NETWORK_MODULE OFF)
set(MUE_BUILD_SHORTCUTS_MODULE OFF)
set(MUE_BUILD_VST_MODULE OFF)
set(MUE_BUILD_APPSHELL_MODULE OFF)
set(MUE_BUILD_CLOUD_MODULE OFF)
set(MUE_BUILD_INSPECTOR_MODULE OFF)
set(MUE_BUILD_INSTRUMENTSSCENE_MODULE OFF)
set(MUE_BUILD_LANGUAGES_MODULE OFF)
set(MUE_BUILD_LEARN_MODULE OFF)
set(MUE_BUILD_MULTIINSTANCES_MODULE OFF)
set(MUE_BUILD_PALETTE_MODULE OFF)
set(MUE_BUILD_PLAYBACK_MODULE OFF)
set(MUE_BUILD_EXTENSIONS_MODULE OFF)
set(MUE_BUILD_UPDATE_MODULE OFF)
set(MUE_BUILD_WORKSPACE_MODULE OFF)
set(MUE_BUILD_IMPORTEXPORT_MODULE OFF)
set(MUE_BUILD_VIDEOEXPORT_MODULE OFF)
set(MUE_INSTALL_SOUNDFONT OFF)
set(MUE_BUILD_CRASHPAD_CLIENT OFF)
endif()
###########################################
# CONFIGURE: UTest
###########################################
if(BUILD_CONFIGURE MATCHES "UTEST")
set(MUE_BUILD_UNIT_TESTS ON)
set(MUE_ENABLE_LOGGER_DEBUGLEVEL ON)
set(MUE_BUILD_AUDIO_MODULE ON)
set(MUE_BUILD_ASAN ON)
message(STATUS "If you added tests to a module that didn't have them yet, make sure that this module is enabled, see SetupConfigure.cmake")
set(MUE_BUILD_MIDI_MODULE OFF)
set(MUE_BUILD_MUSESAMPLER_MODULE OFF)
set(MUE_BUILD_NETWORK_MODULE OFF)
set(MUE_BUILD_SHORTCUTS_MODULE OFF)
set(MUE_BUILD_APPSHELL_MODULE OFF)
set(MUE_BUILD_AUTOBOT_MODULE OFF)
set(MUE_BUILD_CLOUD_MODULE OFF)
set(MUE_BUILD_CONVERTER_MODULE OFF)
set(MUE_BUILD_INSPECTOR_MODULE OFF)
set(MUE_BUILD_INSTRUMENTSSCENE_MODULE OFF)
set(MUE_BUILD_LANGUAGES_MODULE OFF)
set(MUE_BUILD_LEARN_MODULE OFF)
set(MUE_BUILD_MULTIINSTANCES_MODULE OFF)
set(MUE_BUILD_PALETTE_MODULE OFF)
set(MUE_BUILD_PLAYBACK_MODULE OFF)
set(MUE_BUILD_UPDATE_MODULE OFF)
set(MUE_BUILD_WORKSPACE_MODULE OFF)
endif()
###########################################
# Subsystem
###########################################
set(QT_SUPPORT ON)
if (NOT MUE_BUILD_AUDIO_MODULE)
set(MUE_BUILD_MUSESAMPLER_MODULE OFF)
set(MUE_BUILD_VST_MODULE OFF)
endif()
if (MUE_ENABLE_AUDIO_JACK)
add_definitions(-DJACK_AUDIO)
endif()
if (NOT MUE_BUILD_IMPORTEXPORT_MODULE)
set(MUE_BUILD_VIDEOEXPORT_MODULE OFF)
endif()
if (NOT MUE_BUILD_DIAGNOSTICS_MODULE)
set(MUE_BUILD_CRASHPAD_CLIENT OFF)
endif()
if (MUE_BUILD_ASAN)
set(MUE_ENABLE_CUSTOM_ALLOCATOR OFF)
endif()
if (NOT MUE_BUILD_NOTATION_MODULE)
set(MUE_BUILD_PROJECT_MODULE OFF) # hard dependency
set(MUE_BUILD_PALETTE_MODULE OFF) # hard dependency
endif()
if (NOT MUE_BUILD_UI_MODULE)
set(MUE_BUILD_APPSHELL_MODULE OFF) # hard dependency
endif()
###########################################
# Unit tests
###########################################
if (NOT MUE_BUILD_UNIT_TESTS)
set(MUE_BUILD_ACCESSIBILITY_TESTS OFF)
set(MUE_BUILD_AUDIO_TESTS OFF)
set(MUE_BUILD_DRAW_TESTS OFF)
set(MUE_BUILD_GLOBAL_TESTS OFF)
set(MUE_BUILD_MPE_TESTS OFF)
set(MUE_BUILD_NETWORK_TESTS OFF)
set(MUE_BUILD_UI_TESTS OFF)
set(MUE_BUILD_BRAILLE_TESTS OFF)
set(MUE_BUILD_DIAGNOSTICS_TESTS OFF)
set(MUE_BUILD_ENGRAVING_TESTS OFF)
set(MUE_BUILD_IMPORTEXPORT_TESTS OFF)
set(MUE_BUILD_NOTATION_TESTS OFF)
set(MUE_BUILD_PLAYBACK_TESTS OFF)
set(MUE_BUILD_EXTENSIONS_TESTS OFF)
set(MUE_BUILD_PROJECT_TESTS OFF)
set(MUE_BUILD_UPDATE_TESTS OFF)
endif()
###########################################
# Global definitions
###########################################
add_definitions(-DMU_APP_NAME="${MUSESCORE_NAME}")
add_definitions(-DMU_APP_REVISION="${MUSESCORE_REVISION}")
add_definitions(-DMU_APP_BUILD_NUMBER="${CMAKE_BUILD_NUMBER}")
add_definitions(-DMU_APP_VERSION="${MUSESCORE_VERSION}")
add_definitions(-DMU_APP_VERSION_LABEL="${MUSESCORE_VERSION_LABEL}")
add_definitions(-DMU_APP_INSTALL_SUFFIX="${MUSESCORE_INSTALL_SUFFIX}")
add_definitions(-DMU_APP_INSTALL_PREFIX="${CMAKE_INSTALL_PREFIX}")
add_definitions(-DMU_APP_INSTALL_NAME="${Mscore_INSTALL_NAME}")
if (MUSESCORE_UNSTABLE)
add_definitions(-DMU_APP_UNSTABLE)
endif()
if (MUSESCORE_ALLOW_UPDATE_ON_PRERELEASE)
add_definitions(-DMUSESCORE_ALLOW_UPDATE_ON_PRERELEASE)
endif()
function(def_opt name val)
if (${val})
add_definitions(-D${name})
endif()
endfunction()
# framework
def_opt(MUE_BUILD_ACCESSIBILITY_MODULE ${MUE_BUILD_ACCESSIBILITY_MODULE})
def_opt(MUE_BUILD_AUDIO_MODULE ${MUE_BUILD_AUDIO_MODULE})
def_opt(MUE_ENABLE_AUDIO_EXPORT ${MUE_ENABLE_AUDIO_EXPORT})
def_opt(MUE_BUILD_MIDI_MODULE ${MUE_BUILD_MIDI_MODULE})
def_opt(MUE_BUILD_MPE_MODULE ${MUE_BUILD_MPE_MODULE})
def_opt(MUE_BUILD_MUSESAMPLER_MODULE ${MUE_BUILD_MUSESAMPLER_MODULE})
def_opt(MUE_BUILD_NETWORK_MODULE ${MUE_BUILD_NETWORK_MODULE})
def_opt(MUE_BUILD_SHORTCUTS_MODULE ${MUE_BUILD_SHORTCUTS_MODULE})
def_opt(MUE_BUILD_UI_MODULE ${MUE_BUILD_UI_MODULE})
def_opt(MUE_BUILD_VST_MODULE ${MUE_BUILD_VST_MODULE})
# modules
def_opt(MUE_BUILD_APPSHELL_MODULE ${MUE_BUILD_APPSHELL_MODULE})
def_opt(MUE_BUILD_AUTOBOT_MODULE ${MUE_BUILD_AUTOBOT_MODULE})
def_opt(MUE_BUILD_BRAILLE_MODULE ${MUE_BUILD_BRAILLE_MODULE})
def_opt(MUE_BUILD_CLOUD_MODULE ${MUE_BUILD_CLOUD_MODULE})
def_opt(MUE_BUILD_CONVERTER_MODULE ${MUE_BUILD_CONVERTER_MODULE})
def_opt(MUE_BUILD_DIAGNOSTICS_MODULE ${MUE_BUILD_DIAGNOSTICS_MODULE})
def_opt(MUE_BUILD_EXTENSIONS_MODULE ${MUE_BUILD_EXTENSIONS_MODULE})
def_opt(MUE_BUILD_INSPECTOR_MODULE ${MUE_BUILD_INSPECTOR_MODULE})
def_opt(MUE_BUILD_INSTRUMENTSSCENE_MODULE ${MUE_BUILD_INSTRUMENTSSCENE_MODULE})
def_opt(MUE_BUILD_LANGUAGES_MODULE ${MUE_BUILD_LANGUAGES_MODULE})
def_opt(MUE_BUILD_LEARN_MODULE ${MUE_BUILD_LEARN_MODULE})
def_opt(MUE_BUILD_MULTIINSTANCES_MODULE ${MUE_BUILD_MULTIINSTANCES_MODULE})
def_opt(MUE_BUILD_NOTATION_MODULE ${MUE_BUILD_NOTATION_MODULE})
def_opt(MUE_BUILD_PALETTE_MODULE ${MUE_BUILD_PALETTE_MODULE})
def_opt(MUE_BUILD_PLAYBACK_MODULE ${MUE_BUILD_PLAYBACK_MODULE})
def_opt(MUE_BUILD_PROJECT_MODULE ${MUE_BUILD_PROJECT_MODULE})
def_opt(MUE_BUILD_UPDATE_MODULE ${MUE_BUILD_UPDATE_MODULE})
def_opt(MUE_BUILD_WORKSPACE_MODULE ${MUE_BUILD_WORKSPACE_MODULE})
def_opt(MUE_BUILD_IMPORTEXPORT_MODULE ${MUE_BUILD_IMPORTEXPORT_MODULE})
def_opt(MUE_BUILD_VIDEOEXPORT_MODULE ${MUE_BUILD_VIDEOEXPORT_MODULE})
def_opt(MUE_BUILD_IMAGESEXPORT_MODULE ${MUE_BUILD_IMAGESEXPORT_MODULE})
def_opt(MUE_BUILD_CRASHPAD_CLIENT ${MUE_BUILD_CRASHPAD_CLIENT})
def_opt(MUE_COMPILE_USE_QTFONTMETRICS ${MUE_COMPILE_USE_QTFONTMETRICS})
def_opt(MU_BUILD_UNIT_TESTS ${MUE_BUILD_UNIT_TESTS})
if (QT_SUPPORT)
add_definitions(-DQT_SUPPORT)
add_definitions(-DKORS_LOGGER_QT_SUPPORT)
add_definitions(-DSCRIPT_INTERFACE)
if (MUE_COMPILE_QT5_COMPAT)
add_definitions(-DMU_QT5_COMPAT)
endif()
else()
add_definitions(-DNO_QT_SUPPORT)
endif()
if (WIN_PORTABLE)
add_definitions(-DWIN_PORTABLE)
endif()
add_definitions(-DKORS_PROFILER_ENABLED)
if (MUE_ENABLE_LOAD_QML_FROM_SOURCE)
add_definitions(-DMUE_ENABLE_LOAD_QML_FROM_SOURCE)
endif()