MuseScore/CMakeLists.txt

Ignoring revisions in .git-blame-ignore-revs. Click here to bypass and see the normal blame view.

290 lines
8.9 KiB
CMake
Raw Normal View History

# SPDX-License-Identifier: GPL-3.0-only
# MuseScore-CLA-applies
2012-05-26 14:49:10 +02:00
#
# MuseScore
# Music Composition & Notation
2012-05-26 14:49:10 +02:00
#
# Copyright (C) 2021 MuseScore BVBA 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 3 as
# published by the Free Software Foundation.
2012-05-26 14:49:10 +02:00
#
# 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/>.
2012-05-26 14:49:10 +02:00
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)
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}
)
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
option(BUILD_64 "Build 64 bit version of editor" ON)
option(BUILD_PORTABLEAPPS "Windows build for PortableApps.com" OFF)
option(BUILD_FOR_WINSTORE "Build for the Windows Store." OFF)
option(BUILD_AUTOUPDATE "Build with autoupdate support" OFF)
option(BUILD_TELEMETRY_MODULE "Build with telemetry module" ON)
set(TELEMETRY_TRACK_ID "" CACHE STRING "Telemetry track id")
set(CRASH_REPORT_URL "" CACHE STRING "URL where to send crash reports")
2021-01-26 08:59:37 +01:00
option(BUILD_SHORTCUTS_MODULE "Build shortcuts module" ON)
2021-01-25 18:39:25 +01:00
option(BUILD_SYSTEM_MODULE "Build system module" ON)
2021-01-20 13:34:37 +01:00
option(BUILD_NETWORK_MODULE "Build network module" ON)
2021-01-26 21:21:08 +01:00
option(BUILD_AUDIO_MODULE "Build audio module" ON)
option(BUILD_USERSCORES_MODULE "Build userscores module" ON)
2021-01-25 13:18:58 +01:00
option(BUILD_WORKSPACE_MODULE "Build workspace module" ON)
2021-01-22 16:22:13 +01:00
option(BUILD_CLOUD_MODULE "Build cloud module" ON)
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-25 11:22:26 +01:00
option(BUILD_PLUGINS_MODULE "Build plugins module" ON)
2021-01-22 14:22:25 +01:00
option(BUILD_PLAYBACK_MODULE "Build playback module" ON)
2021-01-22 13:16:59 +01:00
option(BUILD_PALETTE_MODULE "Build palette module" ON)
option(BUILD_INSTRUMENTS_MODULE "Build instruments module" ON)
2021-01-22 10:44:27 +01:00
option(BUILD_INSPECTOR_MODULE "Build inspector module" ON)
2021-03-26 14:38:46 +01:00
option(BUILD_AUTOBOT_MODULE "Build autobot module" OFF)
2021-01-20 13:34:37 +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)
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)
option(QML_LOAD_FROM_SOURCE "Load qml files from source (not resource)" OFF)
option(TRACE_DRAW_OBJ_ENABLED "Trace draw objects" 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
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
2021-04-08 11:18:35 +02:00
option(KDAB_DOCKWIDGETS "Build KDAB dockwidgets" OFF)
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)
2021-02-09 16:49:48 +01:00
set(APP_UPDATABLE 1)
if (OS_IS_MAC OR OS_IS_WIN)
if (WIN_PORTABLE OR FOR_WINSTORE)
set(APP_UPDATABLE 0)
endif(WIN_PORTABLE OR FOR_WINSTORE)
endif(OS_IS_MAC OR OS_IS_WIN)
2020-12-10 16:44:43 +01:00
###########################################
# Setup compiler and build environment
###########################################
include(SetupBuildEnvironment)
include(GetPlatformInfo)
2020-12-10 16:44:43 +01:00
if (TRY_USE_CCACHE)
include(TryUseCcache)
2020-12-10 16:44:43 +01:00
endif(TRY_USE_CCACHE)
###########################################
# Setup MuseScore config
###########################################
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
# We need this early, before FindQt5
if (BUILD_WEBENGINE)
2020-12-09 23:04:28 +01:00
if (CC_IS_MINGW)
set(USE_WEBENGINE 0)
2020-12-09 23:04:28 +01:00
else (CC_IS_MINGW)
set(USE_WEBENGINE 1)
2020-12-09 23:04:28 +01:00
endif(CC_IS_MINGW)
else (BUILD_WEBENGINE)
set(USE_WEBENGINE 0)
endif (BUILD_WEBENGINE)
2012-05-26 14:49:10 +02: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)
2020-12-10 16:44:43 +01:00
include(SetupFreetype)
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-12-03 16:04:20 +01:00
if (BUILD_AUTOUPDATE)
2020-12-21 15:57:14 +01:00
if (OS_IS_MAC)
set(MAC_APPCAST_URL "")
2020-12-21 15:57:14 +01:00
endif (OS_IS_MAC)
2020-12-03 16:04:20 +01:00
include(SetupSparkle)
endif(BUILD_AUTOUPDATE)
2013-02-13 22:01:48 +01:00
if (DOWNLOAD_SOUNDFONT)
2020-12-03 16:04:20 +01:00
include(DownloadSoundFont)
endif(DOWNLOAD_SOUNDFONT)
2020-10-20 16:20:58 +02:00
2020-12-10 16:44:43 +01:00
###########################################
# Add source tree
###########################################
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-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)
2021-04-08 11:18:35 +02:00
if (KDAB_DOCKWIDGETS)
if (NOT BUILD_SHARED_LIBS)
set(KDDockWidgets_STATIC ON)
endif(NOT BUILD_SHARED_LIBS)
set(KDDockWidgets_QTQUICK ON)
set(KDDockWidgets_EXAMPLES OFF)
add_subdirectory(thirdparty/KDDockWidgets)
2021-04-08 11:18:35 +02:00
endif(KDAB_DOCKWIDGETS)
2020-12-10 16:44:43 +01:00
###########################################
# Setup Packaging
###########################################
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
###########################################
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
COMMAND Qt5::lupdate ${PROJECT_BINARY_DIR}/mscore.pro
COMMAND ${PROJECT_SOURCE_DIR}/build/gen-instruments-projectfile ${PROJECT_SOURCE_DIR}/share/instruments > instruments.pro
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
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"
)
file(GLOB QT_TS_FILES
"share/locale/qt*.ts"
)
2012-05-26 14:49:10 +02:00
add_custom_target(lrelease
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}
COMMAND Qt5::lrelease ${QT_TS_FILES}
2012-05-26 14:49:10 +02:00
WORKING_DIRECTORY ${PROJECT_BINARY_DIR}
)
2020-12-11 11:14:51 +01:00