forked from musescore/MuseScore
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathCMakeLists.txt
201 lines (163 loc) · 7.34 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
# SPDX-License-Identifier: GPL-3.0-only
# MuseScore-CLA-applies
#
# MuseScore
# Music Composition & Notation
#
# Copyright (C) 2021 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 3 as
# published by the Free Software Foundation.
#
# 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, see <https://www.gnu.org/licenses/>.
cmake_minimum_required(VERSION 3.16)
cmake_policy(SET CMP0091 OLD) # not set MSVC default args
project(mscore LANGUAGES C CXX)
set(CMAKE_CXX_STANDARD 17)
set(CMAKE_CXX_STANDARD_REQUIRED ON)
set(CMAKE_INCLUDE_CURRENT_DIR ON)
set(CMAKE_MODULE_PATH
${CMAKE_CURRENT_LIST_DIR}
${CMAKE_CURRENT_LIST_DIR}/build
${CMAKE_CURRENT_LIST_DIR}/build/cmake
${CMAKE_MODULE_PATH}
)
###########################################
# Setup option and build settings
###########################################
include(GetPaths)
set(MUSESCORE_BUILD_CONFIGURATION "app" CACHE STRING "Build configuration")
# Possible MUSESCORE_BUILD_CONFIGURATION values:
# - app - for desktop app
# - app-portable - for desktop portable app (Windows build for PortableApps.com)
# - vtest - for visual tests (for CI)
# - utest - for unit tests (for CI)
set(MUSESCORE_BUILD_MODE "dev" CACHE STRING "Build mode")
# Possible MUSESCORE_BUILD_MODE values:
# - dev - for development/nightly builds
# - testing - for testing versions (alpha, beta, RC)
# - release - for stable release builds
set(MUSESCORE_REVISION "" CACHE STRING "Build revision")
include(muse_framework/DeclareOptions)
# Modules (alphabetical order please)
option(MUE_BUILD_APPSHELL_MODULE "Build appshell module" ON)
option(MUE_BUILD_BRAILLE_MODULE "Build braille module" ON)
option(MUE_BUILD_BRAILLE_TESTS "Build braille tests" ON)
option(MUE_BUILD_CONVERTER_MODULE "Build converter module" ON)
option(MUE_BUILD_DIAGNOSTICS_MODULE "Build diagnostic code" ON)
option(MUE_BUILD_DIAGNOSTICS_TESTS "Build diagnostic tests" ON)
option(MUE_BUILD_ENGRAVING_TESTS "Build engraving tests" ON)
option(MUE_BUILD_IMPORTEXPORT_MODULE "Build importexport module" ON)
option(MUE_BUILD_IMPORTEXPORT_TESTS "Build importexport tests" ON)
option(MUE_BUILD_VIDEOEXPORT_MODULE "Build videoexport module" OFF)
option(MUE_BUILD_IMAGESEXPORT_MODULE "Build imagesexport module" ON)
option(MUE_BUILD_INSPECTOR_MODULE "Build inspector module" ON)
option(MUE_BUILD_INSTRUMENTSSCENE_MODULE "Build instruments scene module" ON)
option(MUE_BUILD_NOTATION_MODULE "Build notation module" ON)
option(MUE_BUILD_NOTATION_TESTS "Build notation tests" ON)
option(MUE_BUILD_PALETTE_MODULE "Build palette module" ON)
option(MUE_BUILD_PLAYBACK_MODULE "Build playback module" ON)
option(MUE_BUILD_PLAYBACK_TESTS "Build playback tests" ON)
option(MUE_BUILD_PROJECT_MODULE "Build project module" ON)
option(MUE_BUILD_PROJECT_TESTS "Build project tests" ON)
option(MUE_BUILD_UPDATE_MODULE "Build update module" ON)
option(MUE_BUILD_UPDATE_TESTS "Build update tests" ON)
# === Setup ===
option(MUE_DOWNLOAD_SOUNDFONT "Download the latest soundfont version as part of the build process" ON)
# === Pack ===
option(MUE_RUN_LRELEASE "Generate .qm files" ON)
option(MUE_INSTALL_SOUNDFONT "Install sound font" ON)
# === Tests ===
set(MUE_VTEST_MSCORE_REF_BIN "${CMAKE_CURRENT_LIST_DIR}/../MU_ORIGIN/MuseScore/build.debug/install/${INSTALL_SUBDIR}/mscore" CACHE PATH "Path to mscore ref bin")
option(MUE_BUILD_ASAN "Enable Address Sanitizer" OFF)
option(MUE_BUILD_CRASHPAD_CLIENT "Build crashpad client" ON)
set(MUE_CRASH_REPORT_URL "" CACHE STRING "URL where to send crash reports")
option(MUE_CRASHPAD_HANDLER_PATH "Path to custom crashpad_handler executable (optional)" "")
# === Tools ===
option(MUE_ENABLE_CUSTOM_ALLOCATOR "Enable custom allocator (used for engraving)" OFF)
# === Compile ===
option(MUE_COMPILE_QT5_COMPAT "Build with Qt5" OFF)
option(MUE_COMPILE_BUILD_64 "Build 64 bit version of editor" ON)
option(MUE_COMPILE_BUILD_MACOS_APPLE_SILICON "Build for Apple Silicon architecture. Only applicable on Macs with Apple Silicon, and requires suitable Qt version." OFF)
option(MUE_COMPILE_INSTALL_QTQML_FILES "Whether to bundle qml files along with the installation (relevant on MacOS only)" ON)
option(MUE_COMPILE_USE_PCH "Use precompiled headers." ON)
option(MUE_COMPILE_USE_UNITY "Use unity build." ON)
option(MUE_COMPILE_USE_CCACHE "Try use ccache" ON)
option(MUE_COMPILE_USE_SHARED_LIBS_IN_DEBUG "Build shared libs if possible in debug" OFF)
option(MUE_COMPILE_USE_SYSTEM_FREETYPE "Try use system freetype" OFF) # Important for the maintainer of Linux distributions
option(MUE_COMPILE_USE_QTFONTMETRICS "Use Qt font metrics" ON)
# === Debug ===
option(MUE_ENABLE_LOAD_QML_FROM_SOURCE "Load qml files from source (not resource)" OFF)
option(MUE_ENABLE_ENGRAVING_RENDER_DEBUG "Enable rendering debug" OFF)
option(MUE_ENABLE_ENGRAVING_LD_ACCESS "Enable diagnostic engraving check layout data access" OFF)
option(MUE_ENABLE_ENGRAVING_LD_PASSES "Enable engraving layout by passes" OFF)
option(MUE_ENABLE_STRING_DEBUG_HACK "Enable string debug hack (only clang)" ON)
###########################################
# Setup Configure
###########################################
if(EXISTS "${CMAKE_CURRENT_LIST_DIR}/SetupConfigure.local.cmake")
include(${CMAKE_CURRENT_LIST_DIR}/SetupConfigure.local.cmake)
else()
include(SetupConfigure)
endif()
set(THIRDPARTY_DIR ${PROJECT_SOURCE_DIR}/thirdparty)
###########################################
# Setup compiler and build environment
###########################################
include(SetupBuildEnvironment)
include(GetPlatformInfo)
if (MUE_COMPILE_USE_CCACHE)
include(TryUseCcache)
endif(MUE_COMPILE_USE_CCACHE)
###########################################
# Setup external dependencies
###########################################
if (MUE_COMPILE_QT5_COMPAT)
set(QT_MIN_VERSION "5.15.0")
include(FindQt5)
else()
set(QT_MIN_VERSION "6.2.4")
include(FindQt6)
endif()
if (OS_IS_WIN)
include(FetchContent)
FetchContent_Declare(
musescore_prebuild_win_deps
GIT_REPOSITORY https://github.com/musescore/musescore_prebuild_win_deps.git
GIT_TAG HEAD
)
FetchContent_MakeAvailable(musescore_prebuild_win_deps)
set(DEPENDENCIES_DIR ${musescore_prebuild_win_deps_SOURCE_DIR})
set(DEPENDENCIES_LIB_DIR ${DEPENDENCIES_DIR}/libx64)
set(DEPENDENCIES_INC ${DEPENDENCIES_DIR}/include)
endif(OS_IS_WIN)
include(FindSndFile)
if (MUE_DOWNLOAD_SOUNDFONT)
include(DownloadSoundFont)
endif(MUE_DOWNLOAD_SOUNDFONT)
###########################################
# Add source tree
###########################################
add_subdirectory(share)
add_subdirectory(src/framework/global) # should be first to work pch
add_subdirectory(src)
###########################################
# Setup Packaging
###########################################
if (OS_IS_LIN)
include(SetupAppImagePackaging)
endif(OS_IS_LIN)
if (OS_IS_WIN)
include(SetupWindowsPackaging)
endif(OS_IS_WIN)
###########################################
# Add VTest
###########################################
add_subdirectory(vtest)