2012-05-26 14:49:10 +02:00
|
|
|
#=============================================================================
|
2016-06-10 10:37:53 +02:00
|
|
|
# MuseScore
|
2012-05-26 14:49:10 +02:00
|
|
|
# Linux Music Score Editor
|
|
|
|
#
|
2016-06-10 10:37:53 +02:00
|
|
|
# Copyright (C) 2002-2016 by Werner Schweer and others
|
2012-05-26 14:49:10 +02:00
|
|
|
#
|
|
|
|
# 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.
|
|
|
|
#=============================================================================
|
|
|
|
|
2020-12-03 16:04:20 +01:00
|
|
|
cmake_minimum_required(VERSION 3.16)
|
2020-10-27 15:18:50 +01:00
|
|
|
|
2020-12-10 16:44:43 +01:00
|
|
|
cmake_policy(SET CMP0091 OLD) # not set MSVC default args
|
|
|
|
|
2020-12-03 16:04:20 +01:00
|
|
|
project(mscore LANGUAGES C CXX)
|
2018-06-27 15:37:05 +02:00
|
|
|
|
2020-12-05 16:59:48 +01:00
|
|
|
set(CMAKE_CXX_STANDARD 17)
|
|
|
|
set(CMAKE_CXX_STANDARD_REQUIRED ON)
|
2018-01-01 13:20:40 +01:00
|
|
|
|
2020-12-03 16:04:20 +01:00
|
|
|
set(CMAKE_INCLUDE_CURRENT_DIR ON)
|
|
|
|
|
|
|
|
set(CMAKE_MODULE_PATH
|
|
|
|
${CMAKE_CURRENT_LIST_DIR}/build
|
|
|
|
${CMAKE_CURRENT_LIST_DIR}/build/cmake
|
|
|
|
${CMAKE_MODULE_PATH}
|
|
|
|
)
|
2018-01-01 13:20:40 +01:00
|
|
|
|
2020-12-10 16:44:43 +01:00
|
|
|
###########################################
|
|
|
|
# Setup option and build settings
|
|
|
|
###########################################
|
|
|
|
|
2020-12-03 16:04:20 +01:00
|
|
|
set(MUSESCORE_REVISION "" CACHE STRING "Build revision")
|
|
|
|
set(MUSESCORE_BUILD_CONFIG "dev" CACHE STRING "Build config")
|
2020-10-13 15:52:14 +02:00
|
|
|
# Possible MUSESCORE_BUILD_CONFIG values:
|
|
|
|
# - dev - for development/nightly builds
|
|
|
|
# - testing - for testing versions (alpha, beta, RC)
|
|
|
|
# - release - for stable release builds
|
2016-01-02 13:30:37 +01:00
|
|
|
|
2018-08-21 17:27:26 +02:00
|
|
|
option(BUILD_64 "Build 64 bit version of editor" ON)
|
2020-12-07 16:04:00 +01:00
|
|
|
option(BUILD_PORTABLEAPPS "Windows build for PortableApps.com" OFF)
|
|
|
|
option(BUILD_FOR_WINSTORE "Build for the Windows Store." OFF)
|
2018-09-25 11:24:37 +02:00
|
|
|
option(BUILD_AUTOUPDATE "Build with autoupdate support" OFF)
|
2020-12-07 16:04:00 +01:00
|
|
|
|
2019-12-21 12:41:50 +01:00
|
|
|
option(BUILD_TELEMETRY_MODULE "Build with telemetry module" ON)
|
2019-12-13 16:02:34 +01:00
|
|
|
set(TELEMETRY_TRACK_ID "" CACHE STRING "Telemetry track id")
|
2020-12-07 16:04:00 +01:00
|
|
|
set(CRASH_REPORT_URL "" CACHE STRING "URL where to send crash reports")
|
|
|
|
|
2021-01-20 13:34:37 +01:00
|
|
|
option(BUILD_NETWORK_MODULE "Build network module" ON)
|
2021-01-21 12:58:09 +01:00
|
|
|
option(BUILD_EXTENSIONS_MODULE "Build extensions module" ON)
|
2021-01-21 13:35:52 +01:00
|
|
|
option(BUILD_LANGUAGES_MODULE "Build languages module" ON)
|
2021-01-20 13:34:37 +01:00
|
|
|
|
2020-12-07 16:04:00 +01:00
|
|
|
option(SOUNDFONT3 "Ogg Vorbis compressed fonts" ON) # Enable Ogg Vorbis compressed fonts, requires Ogg & Vorbis
|
|
|
|
option(DOWNLOAD_SOUNDFONT "Download the latest soundfont version as part of the build process" ON)
|
|
|
|
|
2020-06-29 16:48:29 +02:00
|
|
|
option(BUILD_UNIT_TESTS "Build gtest unit test" OFF)
|
2020-10-13 15:52:14 +02:00
|
|
|
option(PACKAGE_FILE_ASSOCIATION "File types association" OFF)
|
2017-10-08 12:47:43 +02:00
|
|
|
|
2020-12-10 16:44:43 +01:00
|
|
|
option(TRY_USE_CCACHE "Try use ccache" ON)
|
2020-12-14 12:01:53 +01:00
|
|
|
option(BUILD_PCH "Build using precompiled headers." ON)
|
2020-12-15 14:56:47 +01:00
|
|
|
option(BUILD_UNITY "Build using unity build." ON)
|
2020-12-28 13:28:22 +01:00
|
|
|
option(TRY_BUILD_SHARED_LIBS_IN_DEBUG "Build shared libs if possible in debug" OFF)
|
2020-12-07 16:04:00 +01:00
|
|
|
option(QML_LOAD_FROM_SOURCE "Load qml files from source (not resource)" OFF)
|
|
|
|
|
2020-12-15 14:56:47 +01:00
|
|
|
option(USE_SYSTEM_FREETYPE "Use system FreeType" OFF) # requires freetype >= 2.5.2, does not work on win
|
2020-12-07 16:04:00 +01:00
|
|
|
option(BUILD_WEBENGINE "Built in webengine support" ON)
|
|
|
|
set(SCRIPT_INTERFACE TRUE)
|
2020-12-05 16:59:48 +01:00
|
|
|
|
2020-12-03 16:04:20 +01:00
|
|
|
set(VST3_SDK_VERSION "3.7")
|
2020-08-05 12:49:04 +02:00
|
|
|
option(BUILD_VST "Build VST MODULE" OFF)
|
|
|
|
set(VST3_SDK_PATH "" CACHE PATH "Path to VST3_SDK. SDK version >= ${VST3_SDK_VERSION} required")
|
|
|
|
|
2020-12-03 16:04:20 +01:00
|
|
|
set(JACK_LONGNAME "JACK (Jack Audio Connection Kit)")
|
|
|
|
set(JACK_MIN_VERSION "0.98.0")
|
|
|
|
option(BUILD_JACK "Build with support for ${JACK_LONGNAME} audio backend. JACK >= ${JACK_MIN_VERSION} will be needed." OFF)
|
2020-04-08 20:29:53 +02:00
|
|
|
|
2020-12-10 16:44:43 +01:00
|
|
|
if (BUILD_PORTABLEAPPS)
|
|
|
|
set(WIN_PORTABLE 1)
|
|
|
|
endif (BUILD_PORTABLEAPPS)
|
|
|
|
|
|
|
|
if (BUILD_FOR_WINSTORE)
|
|
|
|
set(FOR_WINSTORE 1)
|
|
|
|
endif(BUILD_FOR_WINSTORE)
|
|
|
|
|
|
|
|
###########################################
|
|
|
|
# Setup compiler and build environment
|
|
|
|
###########################################
|
2019-12-25 14:18:22 +01:00
|
|
|
|
2020-12-07 16:04:00 +01:00
|
|
|
include(SetupBuildEnvironment)
|
|
|
|
include(GetPlatformInfo)
|
2020-12-10 16:44:43 +01:00
|
|
|
if (TRY_USE_CCACHE)
|
2020-12-07 16:04:00 +01:00
|
|
|
include(TryUseCcache)
|
2020-12-10 16:44:43 +01:00
|
|
|
endif(TRY_USE_CCACHE)
|
|
|
|
|
|
|
|
###########################################
|
|
|
|
# Setup MuseScore config
|
|
|
|
###########################################
|
2019-12-21 12:45:26 +01:00
|
|
|
|
2020-12-07 16:04:00 +01:00
|
|
|
include(${CMAKE_CURRENT_LIST_DIR}/config.cmake)
|
2020-12-10 16:44:43 +01:00
|
|
|
configure_file (
|
|
|
|
${PROJECT_SOURCE_DIR}/build/config.h.in
|
|
|
|
${PROJECT_BINARY_DIR}/config.h
|
|
|
|
)
|
|
|
|
|
|
|
|
|
|
|
|
###########################################
|
|
|
|
# Setup external dependencies
|
|
|
|
###########################################
|
2012-05-26 14:49:10 +02:00
|
|
|
|
2020-12-07 16:04:00 +01:00
|
|
|
# We need this early, before FindQt5
|
|
|
|
if (BUILD_WEBENGINE)
|
2020-12-09 23:04:28 +01:00
|
|
|
if (CC_IS_MINGW)
|
2020-12-07 16:04:00 +01:00
|
|
|
set(USE_WEBENGINE 0)
|
2020-12-09 23:04:28 +01:00
|
|
|
else (CC_IS_MINGW)
|
2020-12-07 16:04:00 +01:00
|
|
|
set(USE_WEBENGINE 1)
|
2020-12-09 23:04:28 +01:00
|
|
|
endif(CC_IS_MINGW)
|
2020-12-07 16:04:00 +01:00
|
|
|
else (BUILD_WEBENGINE)
|
|
|
|
set(USE_WEBENGINE 0)
|
|
|
|
endif (BUILD_WEBENGINE)
|
2012-05-26 14:49:10 +02:00
|
|
|
|
2020-12-07 16:04:00 +01:00
|
|
|
set(QT_MIN_VERSION "5.15.0")
|
|
|
|
include(FindQt5)
|
2012-05-26 14:49:10 +02:00
|
|
|
|
2020-12-10 16:44:43 +01:00
|
|
|
if (OS_IS_WIN)
|
|
|
|
set(DEPENDENCIES_DIR "${PROJECT_SOURCE_DIR}/dependencies/libx64")
|
|
|
|
link_directories(${DEPENDENCIES_DIR})
|
|
|
|
include_directories(${PROJECT_SOURCE_DIR}/dependencies/include)
|
|
|
|
endif(OS_IS_WIN)
|
2012-05-26 14:49:10 +02:00
|
|
|
|
2020-12-10 16:44:43 +01:00
|
|
|
if (OS_IS_MAC)
|
|
|
|
find_library(AudioToolboxFW NAMES AudioToolbox)
|
|
|
|
find_library(AudioUnitFW NAMES AudioUnit)
|
|
|
|
find_library(CoreAudioFW NAMES CoreAudio)
|
|
|
|
find_library(CoreMidiFW NAMES CoreMIDI)
|
|
|
|
find_library(SystemConfigurationFW NAMES SystemConfiguration)
|
|
|
|
find_library(CoreServicesFW NAMES CoreServices)
|
|
|
|
find_library(AppKit NAMES AppKit)
|
|
|
|
|
|
|
|
set(OsxFrameworks
|
|
|
|
${AudioToolboxFW}
|
|
|
|
${AudioUnitFW}
|
|
|
|
${CoreAudioFW}
|
|
|
|
${CoreMidiFW}
|
|
|
|
${SystemConfigurationFW}
|
|
|
|
${CoreServicesFW}
|
|
|
|
${AppKit}
|
|
|
|
)
|
|
|
|
endif(OS_IS_MAC)
|
2018-10-27 08:13:15 +02:00
|
|
|
|
2020-12-10 16:44:43 +01:00
|
|
|
include(SetupFreetype)
|
2018-10-27 08:13:15 +02:00
|
|
|
|
2020-12-10 16:44:43 +01:00
|
|
|
include(FindSndFile)
|
2020-12-07 13:06:54 +01:00
|
|
|
|
2020-12-10 16:44:43 +01:00
|
|
|
#if(SOUNDFONT3)
|
|
|
|
# include(FindVorbisAndOgg)
|
|
|
|
#endif(SOUNDFONT3)
|
|
|
|
|
|
|
|
if (BUILD_JACK)
|
|
|
|
include(FindJack)
|
|
|
|
endif(BUILD_JACK)
|
2020-10-14 17:15:56 +02:00
|
|
|
|
2020-12-03 16:04:20 +01:00
|
|
|
if (BUILD_AUTOUPDATE)
|
2020-12-07 16:04:00 +01:00
|
|
|
|
2020-12-21 15:57:14 +01:00
|
|
|
if (OS_IS_MAC)
|
2020-12-07 16:04:00 +01:00
|
|
|
set(MAC_APPCAST_URL "")
|
2020-12-21 15:57:14 +01:00
|
|
|
endif (OS_IS_MAC)
|
2020-12-07 16:04:00 +01:00
|
|
|
|
2020-12-03 16:04:20 +01:00
|
|
|
include(SetupSparkle)
|
|
|
|
endif(BUILD_AUTOUPDATE)
|
2013-02-13 22:01:48 +01:00
|
|
|
|
2018-03-09 15:23:28 +01:00
|
|
|
if (DOWNLOAD_SOUNDFONT)
|
2020-12-03 16:04:20 +01:00
|
|
|
include(DownloadSoundFont)
|
2018-03-09 15:23:28 +01:00
|
|
|
endif(DOWNLOAD_SOUNDFONT)
|
|
|
|
|
2020-10-20 16:20:58 +02:00
|
|
|
|
2020-12-10 16:44:43 +01:00
|
|
|
###########################################
|
|
|
|
# Add source tree
|
|
|
|
###########################################
|
2013-05-21 17:53:14 +02:00
|
|
|
|
2020-12-10 16:44:43 +01:00
|
|
|
if (BUILD_UNIT_TESTS)
|
2020-12-17 12:09:30 +01:00
|
|
|
enable_testing()
|
|
|
|
message(STATUS "Enabled testing")
|
|
|
|
|
2020-12-10 16:44:43 +01:00
|
|
|
define_property(TARGET PROPERTY OUTPUT_XML
|
|
|
|
BRIEF_DOCS "List XML files outputed by google test."
|
|
|
|
FULL_DOCS "List XML files outputed by google test."
|
|
|
|
)
|
2014-06-26 13:33:16 +02:00
|
|
|
|
2020-12-10 16:44:43 +01:00
|
|
|
add_subdirectory(thirdparty/googletest)
|
|
|
|
endif(BUILD_UNIT_TESTS)
|
2020-12-05 12:47:01 +01:00
|
|
|
|
2020-12-17 12:09:30 +01:00
|
|
|
add_subdirectory(share)
|
|
|
|
add_subdirectory(src/framework/global) # should be first to work pch
|
|
|
|
add_subdirectory(thirdparty/qzip)
|
|
|
|
add_subdirectory(src)
|
2020-12-05 12:47:01 +01:00
|
|
|
|
2020-12-10 16:44:43 +01:00
|
|
|
###########################################
|
|
|
|
# Setup Packaging
|
|
|
|
###########################################
|
2020-12-05 12:47:01 +01:00
|
|
|
|
2020-12-10 16:44:43 +01:00
|
|
|
if (OS_IS_LIN)
|
|
|
|
include(SetupAppImagePackaging)
|
|
|
|
endif(OS_IS_LIN)
|
2012-05-26 14:49:10 +02:00
|
|
|
|
2020-12-10 16:44:43 +01:00
|
|
|
if (OS_IS_WIN)
|
|
|
|
include(Packaging)
|
|
|
|
endif(OS_IS_WIN)
|
2012-05-26 14:49:10 +02:00
|
|
|
|
|
|
|
|
2020-12-10 16:44:43 +01:00
|
|
|
###########################################
|
|
|
|
# Custom target for translation generation
|
|
|
|
###########################################
|
2017-05-16 14:21:30 +02:00
|
|
|
|
2020-12-10 16:44:43 +01:00
|
|
|
# lupdate is used to generate the translation text files based off of the source code
|
2012-05-26 14:49:10 +02:00
|
|
|
add_custom_target(lupdate
|
|
|
|
COMMAND ${PROJECT_SOURCE_DIR}/build/gen-qt-projectfile ${PROJECT_SOURCE_DIR} > mscore.pro
|
2018-12-17 12:46:55 +01:00
|
|
|
COMMAND Qt5::lupdate ${PROJECT_BINARY_DIR}/mscore.pro
|
2017-09-15 16:35:17 +02:00
|
|
|
COMMAND ${PROJECT_SOURCE_DIR}/build/gen-instruments-projectfile ${PROJECT_SOURCE_DIR}/share/instruments > instruments.pro
|
2018-12-17 12:46:55 +01:00
|
|
|
COMMAND Qt5::lupdate ${PROJECT_BINARY_DIR}/instruments.pro
|
2018-12-21 23:23:17 +01:00
|
|
|
COMMAND ${PROJECT_SOURCE_DIR}/build/gen-tours-projectfile ${PROJECT_SOURCE_DIR}/share/tours > tours.pro
|
|
|
|
COMMAND Qt5::lupdate ${PROJECT_BINARY_DIR}/tours.pro
|
2012-05-26 14:49:10 +02:00
|
|
|
WORKING_DIRECTORY ${PROJECT_BINARY_DIR}
|
|
|
|
)
|
|
|
|
|
2020-12-10 16:44:43 +01:00
|
|
|
# lrelease is used to compile the translated text files generated by lupdate into binary resources
|
2018-08-14 10:00:21 +02:00
|
|
|
file(GLOB INSTRUMENTS_TS_FILES
|
|
|
|
"share/locale/instruments*.ts"
|
|
|
|
)
|
|
|
|
file(GLOB MSCORE_TS_FILES
|
|
|
|
"share/locale/mscore*.ts"
|
|
|
|
)
|
2018-12-21 23:23:17 +01:00
|
|
|
file(GLOB TOURS_TS_FILES
|
|
|
|
"share/locale/tours*.ts"
|
|
|
|
)
|
2018-08-14 10:00:21 +02:00
|
|
|
file(GLOB QT_TS_FILES
|
|
|
|
"share/locale/qt*.ts"
|
2018-08-08 10:47:01 +02:00
|
|
|
)
|
|
|
|
|
2012-05-26 14:49:10 +02:00
|
|
|
add_custom_target(lrelease
|
2018-08-14 10:00:21 +02:00
|
|
|
COMMAND Qt5::lrelease ${INSTRUMENTS_TS_FILES}
|
|
|
|
COMMAND Qt5::lrelease ${MSCORE_TS_FILES}
|
2018-12-21 23:23:17 +01:00
|
|
|
COMMAND Qt5::lrelease ${TOURS_TS_FILES}
|
2018-08-14 10:00:21 +02:00
|
|
|
COMMAND Qt5::lrelease ${QT_TS_FILES}
|
2012-05-26 14:49:10 +02:00
|
|
|
WORKING_DIRECTORY ${PROJECT_BINARY_DIR}
|
2018-08-08 10:47:01 +02:00
|
|
|
)
|
2020-12-11 11:14:51 +01:00
|
|
|
|
|
|
|
|
|
|
|
|