MuseScore/CMakeLists.txt

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

247 lines
7.5 KiB
CMake
Raw Normal View History

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)
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")
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)
option(BUILD_PCH "Build using precompiled headers." OFF)
2020-12-08 16:55:08 +01:00
option(BUILD_SHARED_LIB_IN_DEBUG "Build shared libs if possible in debug" ON)
option(QML_LOAD_FROM_SOURCE "Load qml files from source (not resource)" OFF)
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
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
###########################################
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)
if (APPLE)
set(MAC_APPCAST_URL "")
endif (APPLE)
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
add_subdirectory(share)
add_subdirectory(thirdparty/qzip)
add_subdirectory(src)
2014-06-26 13:33:16 +02:00
2020-12-10 16:44:43 +01:00
if (BUILD_UNIT_TESTS)
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)
enable_testing()
endif(BUILD_UNIT_TESTS)
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}
)