MuseScore/CMakeLists.txt

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

363 lines
12 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-03 16:04:20 +01:00
project(mscore LANGUAGES C CXX)
2018-06-27 15:37:05 +02:00
2020-12-03 16:04:20 +01:00
# Conflicted with PCH on Linux, will be resolve later
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-03 16:04:20 +01:00
include(TryUseCcache)
include(SetupCMakePolicy)
include(GetCompilerInfo)
include(GetUtilsFunctions) # library of CMake functions ("fn__" namespace)
This commit contains all the changes to the CMake build system required to generate a valid Visual Studio 2017 solution and projects for MuseScore. In detail, changes are as follows: - Changed .gitignore to ignore VS-specific files and directories. - VS uses a global settings file for the CMake build process: CMakeSettings.json. This is a text file, which is conceptually equivalent to the Makefile used to invoke CMake through Make. This file might need to be changed on an individual user basis, if dependencies are not installed in default paths. - New cmake macros to copy files in build\CopyFilesMacros.cmake. The code is from https://cmake.org/pipermail/cmake/2009-March/027892.html - Pre-compiled headers: Visual Studio requires to create pre-compiled headers per-project (a general per-solution PCH file, although possible, is extremely problematic and not recommended). Therefore, the new macro vstudio_pch in CreatePrecompiledHeader.cmake was created to add the pre-compiled header creation step to an existing target (similar to what is done for XCode). The existing macro precompiled_header was modified to set the values for a group of variables. As part of this, the empty file all.cpp was added to the root of the source tree, as VS requires a source file to create pre-compiled headers (the header file alone can not be compiled). - all.h is not copied to binary dir for MSVC, as I could determine no need to do this. Because of this, and the differences in PCH handling, the pseudo-targets mops1 and mops2 are not created for MSVC. - Revised all steps conditional on toolchain, and added MSVC paths as needed. In many instances, the MSVC path is the same as the MINGW path, but not always. - The manual (genManual) target used the getopt() functionality defined in POSIX libraries, which is not available on Windows. An LGPL'd port of getopt() for Windows was added in manual\getopt. The original source is in GitHub: nanoporetech/getopt-win32, based on a CodeProject article: https://www.codeproject.com/KB/cpp/getopt4win.aspx?msg=3987371. The corresponding CMakeLists.txt file was modified to include this files when compiling with MSVC. - Changes in CMakeLists.txt files to create valid MSVC targets. The changes, always conditional on the MSVC toolchain, consist of: x Setting target properties for MSVC x Using all.h in source dir x Adding pre-compiled headers to target x Removing dependency from mops1 and mops2 Notes: - The INSTALL target has NOT BEEN UPDATED for MSVC.
2018-05-01 17:48:42 +02:00
# We need this early, before FindQt5
option(BUILD_WEBENGINE "Built in webengine support" ON)
if (BUILD_WEBENGINE)
2020-12-03 16:04:20 +01:00
if (COMPILER_IS_MINGW)
set(USE_WEBENGINE 0)
2020-12-03 16:04:20 +01:00
else (COMPILER_IS_MINGW)
set(USE_WEBENGINE 1)
2020-12-03 16:04:20 +01:00
endif(COMPILER_IS_MINGW)
else (BUILD_WEBENGINE)
set(USE_WEBENGINE 0)
endif (BUILD_WEBENGINE)
2020-12-03 16:04:20 +01:00
set(QT_MIN_VERSION "5.15.0")
include(FindQt5)
include(UsePkgConfig1) # Defines MACRO(PKGCONFIG1 _package _minVersion _include_DIR _link_DIR _link_FLAGS _cflags)
2020-10-29 09:35:30 +01:00
# Setup version number and general 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
2020-12-03 16:04:20 +01:00
include(${CMAKE_CURRENT_LIST_DIR}/config.cmake)
2020-12-03 16:04:20 +01:00
set(SCRIPT_INTERFACE TRUE)
2016-06-10 10:37:53 +02:00
option(ZERBERUS "Enable experimental SFZ sampler" ON)
option(OSC "Enable OSC remote control protocol" ON)
2020-03-12 13:32:43 +01:00
option(SOUNDFONT3 "Ogg Vorbis compressed fonts" ON) # Enable Ogg Vorbis compressed fonts, requires Ogg & Vorbis
2013-03-12 11:42:10 +01:00
option(USE_SYSTEM_QTSINGLEAPPLICATION "Use system QtSingleApplication" OFF)
2020-03-12 13:32:43 +01:00
option(USE_SYSTEM_FREETYPE "Use system FreeType" OFF) # requires freetype >= 2.5.2, does not work on win
option(DOWNLOAD_SOUNDFONT "Download the latest soundfont version as part of the build process" ON)
2020-12-05 16:59:48 +01:00
option(BUILD_PCH "Build using precompiled headers." OFF)
option(BUILD_FOR_WINSTORE "Build for the Windows Store." OFF)
option(COVERAGE "Build with instrumentation to record code coverage." OFF)
option(BUILD_64 "Build 64 bit version of editor" ON)
option(BUILD_AUTOUPDATE "Build with autoupdate support" OFF)
2020-11-30 09:56:15 +01:00
set(CRASH_REPORT_URL "" CACHE STRING "URL where to send crash reports")
option(BUILD_TELEMETRY_MODULE "Build with telemetry module" ON)
set(TELEMETRY_TRACK_ID "" CACHE STRING "Telemetry track id")
option(BUILD_PORTABLEAPPS "Windows build for PortableApps.com" OFF)
2020-06-29 16:48:29 +02:00
option(BUILD_UNIT_TESTS "Build gtest unit test" OFF)
2020-09-01 17:27:52 +02:00
option(QML_LOAD_FROM_SOURCE "Load qml files from source (not resource)" OFF)
2020-10-13 15:52:14 +02:00
option(PACKAGE_FILE_ASSOCIATION "File types association" OFF)
2020-12-05 16:59:48 +01:00
# Temporary OFF
set(BUILD_PCH OFF)
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)
if (BUILD_JACK)
include(FindJack)
endif(BUILD_JACK)
2020-04-08 20:29:53 +02:00
add_definitions(-DQT_QML_DEBUG)
2020-09-19 18:27:48 +02:00
add_definitions(-D_USE_MATH_DEFINES)
2020-04-08 20:29:53 +02:00
2020-11-30 09:56:15 +01:00
message("[cmake] CRASH_REPORT_URL: ${CRASH_REPORT_URL}")
2020-04-08 20:29:53 +02:00
message(STATUS "CMAKE_CXX_COMPILER_ID: ${CMAKE_CXX_COMPILER_ID}")
if (MSCORE_UNSTABLE OR TELEMETRY_TRACK_ID STREQUAL "")
message("Telemetry feature is disabled")
if (TELEMETRY_TRACK_ID STREQUAL "")
message("Telemetry track id is empty")
else(TELEMETRY_TRACK_ID STREQUAL "")
message("Telemetry track id isn't empty")
endif(TELEMETRY_TRACK_ID STREQUAL "")
add_definitions(-DTELEMETRY_DISABLED)
endif(MSCORE_UNSTABLE OR TELEMETRY_TRACK_ID STREQUAL "")
2012-05-26 14:49:10 +02:00
if (APPLE)
set (CMAKE_CXX_COMPILER clang++)
2013-02-13 22:01:48 +01:00
set (CMAKE_CXX_COMPILER_ID "Clang")
2012-05-26 14:49:10 +02:00
set(CMAKE_OSX_ARCHITECTURES x86_64)
2020-10-13 15:52:14 +02:00
set(MACOSX_DEPLOYMENT_TARGET 10.10)
set(CMAKE_OSX_DEPLOYMENT_TARGET 10.10)
2012-05-26 14:49:10 +02:00
set(MAC_APPCAST_URL "")
2012-05-26 14:49:10 +02:00
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})
2012-05-26 14:49:10 +02:00
endif (APPLE)
#
# Set up Windows arch variables/paths
#
if (BUILD_64 STREQUAL "ON")
SET (ARCH_TYPE "_x64")
SET (DEPENDENCIES_DIR "${PROJECT_SOURCE_DIR}/dependencies/libx64")
else (BUILD_64 STREQUAL "ON")
SET (ARCH_TYPE "_x86")
SET (DEPENDENCIES_DIR "${PROJECT_SOURCE_DIR}/dependencies/libx86")
endif (BUILD_64 STREQUAL "ON")
if (BUILD_PORTABLEAPPS STREQUAL "ON")
SET (WIN_PORTABLE 1)
endif (BUILD_PORTABLEAPPS STREQUAL "ON")
#
# Sparkle/WinSparkle routine
#
2020-12-03 16:04:20 +01:00
if (BUILD_AUTOUPDATE)
include(SetupSparkle)
endif(BUILD_AUTOUPDATE)
2013-02-13 22:01:48 +01:00
This commit contains all the changes to the CMake build system required to generate a valid Visual Studio 2017 solution and projects for MuseScore. In detail, changes are as follows: - Changed .gitignore to ignore VS-specific files and directories. - VS uses a global settings file for the CMake build process: CMakeSettings.json. This is a text file, which is conceptually equivalent to the Makefile used to invoke CMake through Make. This file might need to be changed on an individual user basis, if dependencies are not installed in default paths. - New cmake macros to copy files in build\CopyFilesMacros.cmake. The code is from https://cmake.org/pipermail/cmake/2009-March/027892.html - Pre-compiled headers: Visual Studio requires to create pre-compiled headers per-project (a general per-solution PCH file, although possible, is extremely problematic and not recommended). Therefore, the new macro vstudio_pch in CreatePrecompiledHeader.cmake was created to add the pre-compiled header creation step to an existing target (similar to what is done for XCode). The existing macro precompiled_header was modified to set the values for a group of variables. As part of this, the empty file all.cpp was added to the root of the source tree, as VS requires a source file to create pre-compiled headers (the header file alone can not be compiled). - all.h is not copied to binary dir for MSVC, as I could determine no need to do this. Because of this, and the differences in PCH handling, the pseudo-targets mops1 and mops2 are not created for MSVC. - Revised all steps conditional on toolchain, and added MSVC paths as needed. In many instances, the MSVC path is the same as the MINGW path, but not always. - The manual (genManual) target used the getopt() functionality defined in POSIX libraries, which is not available on Windows. An LGPL'd port of getopt() for Windows was added in manual\getopt. The original source is in GitHub: nanoporetech/getopt-win32, based on a CodeProject article: https://www.codeproject.com/KB/cpp/getopt4win.aspx?msg=3987371. The corresponding CMakeLists.txt file was modified to include this files when compiling with MSVC. - Changes in CMakeLists.txt files to create valid MSVC targets. The changes, always conditional on the MSVC toolchain, consist of: x Setting target properties for MSVC x Using all.h in source dir x Adding pre-compiled headers to target x Removing dependency from mops1 and mops2 Notes: - The INSTALL target has NOT BEEN UPDATED for MSVC.
2018-05-01 17:48:42 +02:00
if (NOT MSVC)
set(CMAKE_CXX_FLAGS_DEBUG "-g")
set(CMAKE_CXX_FLAGS_RELEASE "-O2 -DNDEBUG -DQT_NO_DEBUG")
endif (NOT MSVC)
2013-03-13 18:55:42 +01:00
if (APPLE)
2020-10-02 10:33:34 +02:00
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++17 -fPIC -stdlib=libc++ -Wno-inconsistent-missing-override -Wno-deprecated-register")
set(CMAKE_CXX_STANDARD 17)
2016-06-10 10:37:53 +02:00
# This is necessary for genManual to be executed during the build phase,
2016-04-14 16:20:44 +02:00
# it needs to be able to get the Qt libs.
# TODO: is it still needed? genManual is removed.
2016-04-14 16:20:44 +02:00
SET(CMAKE_INSTALL_RPATH_USE_LINK_PATH TRUE)
SET(CMAKE_INSTALL_RPATH "${QT_INSTALL_LIBS}")
2013-03-13 18:55:42 +01:00
else (APPLE)
This commit contains all the changes to the CMake build system required to generate a valid Visual Studio 2017 solution and projects for MuseScore. In detail, changes are as follows: - Changed .gitignore to ignore VS-specific files and directories. - VS uses a global settings file for the CMake build process: CMakeSettings.json. This is a text file, which is conceptually equivalent to the Makefile used to invoke CMake through Make. This file might need to be changed on an individual user basis, if dependencies are not installed in default paths. - New cmake macros to copy files in build\CopyFilesMacros.cmake. The code is from https://cmake.org/pipermail/cmake/2009-March/027892.html - Pre-compiled headers: Visual Studio requires to create pre-compiled headers per-project (a general per-solution PCH file, although possible, is extremely problematic and not recommended). Therefore, the new macro vstudio_pch in CreatePrecompiledHeader.cmake was created to add the pre-compiled header creation step to an existing target (similar to what is done for XCode). The existing macro precompiled_header was modified to set the values for a group of variables. As part of this, the empty file all.cpp was added to the root of the source tree, as VS requires a source file to create pre-compiled headers (the header file alone can not be compiled). - all.h is not copied to binary dir for MSVC, as I could determine no need to do this. Because of this, and the differences in PCH handling, the pseudo-targets mops1 and mops2 are not created for MSVC. - Revised all steps conditional on toolchain, and added MSVC paths as needed. In many instances, the MSVC path is the same as the MINGW path, but not always. - The manual (genManual) target used the getopt() functionality defined in POSIX libraries, which is not available on Windows. An LGPL'd port of getopt() for Windows was added in manual\getopt. The original source is in GitHub: nanoporetech/getopt-win32, based on a CodeProject article: https://www.codeproject.com/KB/cpp/getopt4win.aspx?msg=3987371. The corresponding CMakeLists.txt file was modified to include this files when compiling with MSVC. - Changes in CMakeLists.txt files to create valid MSVC targets. The changes, always conditional on the MSVC toolchain, consist of: x Setting target properties for MSVC x Using all.h in source dir x Adding pre-compiled headers to target x Removing dependency from mops1 and mops2 Notes: - The INSTALL target has NOT BEEN UPDATED for MSVC.
2018-05-01 17:48:42 +02:00
if (MSVC)
# Set compiler options for VS2017/19 toolchain.
This commit contains all the changes to the CMake build system required to generate a valid Visual Studio 2017 solution and projects for MuseScore. In detail, changes are as follows: - Changed .gitignore to ignore VS-specific files and directories. - VS uses a global settings file for the CMake build process: CMakeSettings.json. This is a text file, which is conceptually equivalent to the Makefile used to invoke CMake through Make. This file might need to be changed on an individual user basis, if dependencies are not installed in default paths. - New cmake macros to copy files in build\CopyFilesMacros.cmake. The code is from https://cmake.org/pipermail/cmake/2009-March/027892.html - Pre-compiled headers: Visual Studio requires to create pre-compiled headers per-project (a general per-solution PCH file, although possible, is extremely problematic and not recommended). Therefore, the new macro vstudio_pch in CreatePrecompiledHeader.cmake was created to add the pre-compiled header creation step to an existing target (similar to what is done for XCode). The existing macro precompiled_header was modified to set the values for a group of variables. As part of this, the empty file all.cpp was added to the root of the source tree, as VS requires a source file to create pre-compiled headers (the header file alone can not be compiled). - all.h is not copied to binary dir for MSVC, as I could determine no need to do this. Because of this, and the differences in PCH handling, the pseudo-targets mops1 and mops2 are not created for MSVC. - Revised all steps conditional on toolchain, and added MSVC paths as needed. In many instances, the MSVC path is the same as the MINGW path, but not always. - The manual (genManual) target used the getopt() functionality defined in POSIX libraries, which is not available on Windows. An LGPL'd port of getopt() for Windows was added in manual\getopt. The original source is in GitHub: nanoporetech/getopt-win32, based on a CodeProject article: https://www.codeproject.com/KB/cpp/getopt4win.aspx?msg=3987371. The corresponding CMakeLists.txt file was modified to include this files when compiling with MSVC. - Changes in CMakeLists.txt files to create valid MSVC targets. The changes, always conditional on the MSVC toolchain, consist of: x Setting target properties for MSVC x Using all.h in source dir x Adding pre-compiled headers to target x Removing dependency from mops1 and mops2 Notes: - The INSTALL target has NOT BEEN UPDATED for MSVC.
2018-05-01 17:48:42 +02:00
# Note: /D_CRT_SECURE_NO WARNINGS disables warnings when using "non-secure" library functions like sscanf...
set(CMAKE_CXX_FLAGS "/MP /DWIN32 /D_WINDOWS /GR /EHsc /D_UNICODE /DUNICODE /D_CRT_SECURE_NO_WARNINGS /execution-charset:utf-8 /source-charset:utf-8")
set(CMAKE_C_FLAGS "/MP /DWIN32 /D_WINDOWS /D_CRT_SECURE_NO_WARNINGS")
2020-10-02 10:33:34 +02:00
set(CMAKE_CXX_FLAGS_DEBUG "/MT /permissive- /std:c++17 /W4 /Zi /Ob0 /Od /RTC1")
set(CMAKE_CXX_FLAGS_RELEASE "/MT /permissive- /std:c++17 /W4 /O2 /Ob2 /DNDEBUG /DQT_NO_DEBUG /DQT_NO_DEBUG_OUTPUT")
set(CMAKE_CXX_FLAGS_RELWITHDEBINFO "/MT /permissive- /std:c++17 /W4 /Zi /O2 /Ob1 /DNDEBUG /DQT_NO_DEBUG /DQT_NO_DEBUG_OUTPUT")
2019-02-15 08:21:49 +01:00
set(CMAKE_C_FLAGS_DEBUG "/MT /W4 /Zi /Ob0 /Od /RTC1")
set(CMAKE_C_FLAGS_RELEASE "/MT /W4 /O2 /Ob2 /DNDEBUG")
set(CMAKE_C_FLAGS_RELWITHDEBINFO "/MT /W4 /Zi /O2 /Ob1 /DNDEBUG")
set(CMAKE_EXE_LINKER_FLAGS "/DYNAMICBASE:NO")
This commit contains all the changes to the CMake build system required to generate a valid Visual Studio 2017 solution and projects for MuseScore. In detail, changes are as follows: - Changed .gitignore to ignore VS-specific files and directories. - VS uses a global settings file for the CMake build process: CMakeSettings.json. This is a text file, which is conceptually equivalent to the Makefile used to invoke CMake through Make. This file might need to be changed on an individual user basis, if dependencies are not installed in default paths. - New cmake macros to copy files in build\CopyFilesMacros.cmake. The code is from https://cmake.org/pipermail/cmake/2009-March/027892.html - Pre-compiled headers: Visual Studio requires to create pre-compiled headers per-project (a general per-solution PCH file, although possible, is extremely problematic and not recommended). Therefore, the new macro vstudio_pch in CreatePrecompiledHeader.cmake was created to add the pre-compiled header creation step to an existing target (similar to what is done for XCode). The existing macro precompiled_header was modified to set the values for a group of variables. As part of this, the empty file all.cpp was added to the root of the source tree, as VS requires a source file to create pre-compiled headers (the header file alone can not be compiled). - all.h is not copied to binary dir for MSVC, as I could determine no need to do this. Because of this, and the differences in PCH handling, the pseudo-targets mops1 and mops2 are not created for MSVC. - Revised all steps conditional on toolchain, and added MSVC paths as needed. In many instances, the MSVC path is the same as the MINGW path, but not always. - The manual (genManual) target used the getopt() functionality defined in POSIX libraries, which is not available on Windows. An LGPL'd port of getopt() for Windows was added in manual\getopt. The original source is in GitHub: nanoporetech/getopt-win32, based on a CodeProject article: https://www.codeproject.com/KB/cpp/getopt4win.aspx?msg=3987371. The corresponding CMakeLists.txt file was modified to include this files when compiling with MSVC. - Changes in CMakeLists.txt files to create valid MSVC targets. The changes, always conditional on the MSVC toolchain, consist of: x Setting target properties for MSVC x Using all.h in source dir x Adding pre-compiled headers to target x Removing dependency from mops1 and mops2 Notes: - The INSTALL target has NOT BEEN UPDATED for MSVC.
2018-05-01 17:48:42 +02:00
else (MSVC)
2020-10-02 10:33:34 +02:00
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++17")
This commit contains all the changes to the CMake build system required to generate a valid Visual Studio 2017 solution and projects for MuseScore. In detail, changes are as follows: - Changed .gitignore to ignore VS-specific files and directories. - VS uses a global settings file for the CMake build process: CMakeSettings.json. This is a text file, which is conceptually equivalent to the Makefile used to invoke CMake through Make. This file might need to be changed on an individual user basis, if dependencies are not installed in default paths. - New cmake macros to copy files in build\CopyFilesMacros.cmake. The code is from https://cmake.org/pipermail/cmake/2009-March/027892.html - Pre-compiled headers: Visual Studio requires to create pre-compiled headers per-project (a general per-solution PCH file, although possible, is extremely problematic and not recommended). Therefore, the new macro vstudio_pch in CreatePrecompiledHeader.cmake was created to add the pre-compiled header creation step to an existing target (similar to what is done for XCode). The existing macro precompiled_header was modified to set the values for a group of variables. As part of this, the empty file all.cpp was added to the root of the source tree, as VS requires a source file to create pre-compiled headers (the header file alone can not be compiled). - all.h is not copied to binary dir for MSVC, as I could determine no need to do this. Because of this, and the differences in PCH handling, the pseudo-targets mops1 and mops2 are not created for MSVC. - Revised all steps conditional on toolchain, and added MSVC paths as needed. In many instances, the MSVC path is the same as the MINGW path, but not always. - The manual (genManual) target used the getopt() functionality defined in POSIX libraries, which is not available on Windows. An LGPL'd port of getopt() for Windows was added in manual\getopt. The original source is in GitHub: nanoporetech/getopt-win32, based on a CodeProject article: https://www.codeproject.com/KB/cpp/getopt4win.aspx?msg=3987371. The corresponding CMakeLists.txt file was modified to include this files when compiling with MSVC. - Changes in CMakeLists.txt files to create valid MSVC targets. The changes, always conditional on the MSVC toolchain, consist of: x Setting target properties for MSVC x Using all.h in source dir x Adding pre-compiled headers to target x Removing dependency from mops1 and mops2 Notes: - The INSTALL target has NOT BEEN UPDATED for MSVC.
2018-05-01 17:48:42 +02:00
if (MINGW)
# -mno-ms-bitfields see #22048
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -mno-ms-bitfields")
if (NOT BUILD_64)
set(CMAKE_EXE_LINKER_FLAGS "-Wl,--large-address-aware")
endif (NOT BUILD_64)
This commit contains all the changes to the CMake build system required to generate a valid Visual Studio 2017 solution and projects for MuseScore. In detail, changes are as follows: - Changed .gitignore to ignore VS-specific files and directories. - VS uses a global settings file for the CMake build process: CMakeSettings.json. This is a text file, which is conceptually equivalent to the Makefile used to invoke CMake through Make. This file might need to be changed on an individual user basis, if dependencies are not installed in default paths. - New cmake macros to copy files in build\CopyFilesMacros.cmake. The code is from https://cmake.org/pipermail/cmake/2009-March/027892.html - Pre-compiled headers: Visual Studio requires to create pre-compiled headers per-project (a general per-solution PCH file, although possible, is extremely problematic and not recommended). Therefore, the new macro vstudio_pch in CreatePrecompiledHeader.cmake was created to add the pre-compiled header creation step to an existing target (similar to what is done for XCode). The existing macro precompiled_header was modified to set the values for a group of variables. As part of this, the empty file all.cpp was added to the root of the source tree, as VS requires a source file to create pre-compiled headers (the header file alone can not be compiled). - all.h is not copied to binary dir for MSVC, as I could determine no need to do this. Because of this, and the differences in PCH handling, the pseudo-targets mops1 and mops2 are not created for MSVC. - Revised all steps conditional on toolchain, and added MSVC paths as needed. In many instances, the MSVC path is the same as the MINGW path, but not always. - The manual (genManual) target used the getopt() functionality defined in POSIX libraries, which is not available on Windows. An LGPL'd port of getopt() for Windows was added in manual\getopt. The original source is in GitHub: nanoporetech/getopt-win32, based on a CodeProject article: https://www.codeproject.com/KB/cpp/getopt4win.aspx?msg=3987371. The corresponding CMakeLists.txt file was modified to include this files when compiling with MSVC. - Changes in CMakeLists.txt files to create valid MSVC targets. The changes, always conditional on the MSVC toolchain, consist of: x Setting target properties for MSVC x Using all.h in source dir x Adding pre-compiled headers to target x Removing dependency from mops1 and mops2 Notes: - The INSTALL target has NOT BEEN UPDATED for MSVC.
2018-05-01 17:48:42 +02:00
else (MINGW)
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -fPIC")
set(CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS_DEBUG} -Wall -Wextra -Woverloaded-virtual")
set(CMAKE_CXX_FLAGS_RELEASE "${CMAKE_CXX_FLAGS_RELEASE} -DQT_NO_DEBUG_OUTPUT")
endif (MINGW)
endif (MSVC)
2013-03-13 18:55:42 +01:00
endif(APPLE)
2012-05-26 14:49:10 +02:00
set(CMAKE_BUILD_WITH_INSTALL_RPATH ON) # Call CMake with option -DCMAKE_SKIP_RPATH to not set RPATH (Debian packaging requirement)
2012-05-26 14:49:10 +02:00
set(CMAKE_SKIP_RULE_DEPENDENCY TRUE)
# Download MuseScore SoundFont
if (DOWNLOAD_SOUNDFONT)
2020-12-03 16:04:20 +01:00
include(DownloadSoundFont)
endif(DOWNLOAD_SOUNDFONT)
if (BUILD_FOR_WINSTORE)
set(FOR_WINSTORE 1)
endif(BUILD_FOR_WINSTORE)
include(SetupFreetype)
2020-10-20 16:20:58 +02:00
if(SOUNDFONT3)
include(SetupVorbisAndOgg)
endif(SOUNDFONT3)
2013-03-12 11:42:10 +01:00
##
## Include packaging
2013-03-12 11:42:10 +01:00
##
include(SetupAppImagePackaging)
include(Packaging)
2013-03-12 11:42:10 +01:00
set(CMAKE_INSTALL_RPATH "${CMAKE_INSTALL_RPATH};${CMAKE_INSTALL_PREFIX}/bin")
#set(CMAKE_INSTALL_RPATH "$ORIGIN")
2012-05-26 14:49:10 +02:00
#
2016-06-10 10:37:53 +02:00
# Create precompiled header file
2012-05-26 14:49:10 +02:00
#
2013-02-04 16:56:01 +01:00
if (BUILD_PCH)
2014-06-26 13:33:16 +02:00
include(CreatePrecompiledHeader)
2014-06-26 13:33:16 +02:00
# all.h is expected in PROJECT_BINARY_DIR by subdirs, except for MSVC
if (NOT MSVC)
execute_process(
COMMAND ${CMAKE_COMMAND} -E copy ${PROJECT_SOURCE_DIR}/all.h ${PROJECT_BINARY_DIR}/all.h
WORKING_DIRECTORY ${PROJECT_BINARY_DIR}
)
endif (NOT MSVC)
precompiled_header(QT_INCLUDES all ${BUILD_PCH})
# MSVC does not require these targets, as all.h is not copied and the
# PCH generation is done per-project
if (NOT MSVC)
ADD_CUSTOM_TARGET(mops1 DEPENDS ${PROJECT_BINARY_DIR}/all.h)
ADD_CUSTOM_TARGET(mops2 DEPENDS ${PCH})
endif (NOT MSVC)
endif(BUILD_PCH)
2012-05-26 14:49:10 +02:00
2013-03-12 11:42:10 +01:00
##
2016-06-10 10:37:53 +02:00
## Includes
2013-03-12 11:42:10 +01:00
##
2012-05-26 14:49:10 +02:00
include_directories(
${PROJECT_SOURCE_DIR}
${PROJECT_BINARY_DIR}
${ALSA_INCDIR}
${OGG_INCDIR}
${VORBIS_INCDIR}
${SNDFILE_INCDIR}
2012-05-26 14:49:10 +02:00
)
if (MSVC)
include_directories(${PROJECT_SOURCE_DIR}/dependencies)
include_directories(${PROJECT_SOURCE_DIR}/dependencies/include)
include_directories(${PROJECT_SOURCE_DIR}/dependencies/include/vorbis)
include_directories(${SNDFILE_INCLUDE_DIR})
include_directories(${VORBIS_INCLUDE_DIR})
include_directories(${OGG_INCLUDE_DIR})
endif (MSVC)
2020-12-05 00:15:50 +01:00
if (MINGW)
include_directories(${SNDFILE_INCLUDE_DIR})
endif(MINGW)
##
## produce config.h file
##
configure_file (
${PROJECT_SOURCE_DIR}/build/config.h.in
${PROJECT_BINARY_DIR}/config.h
)
add_subdirectory(share)
add_subdirectory(thirdparty/qzip)
2012-05-26 14:49:10 +02:00
2013-03-12 11:42:10 +01:00
##
2016-06-10 10:37:53 +02:00
## Custom target for translation generation
2013-03-12 11:42:10 +01:00
##
2012-05-26 14:49:10 +02: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}
)
## 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}
)
2013-03-12 11:42:10 +01:00
2020-10-19 09:42:11 +02: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."
)
if (BUILD_UNIT_TESTS)
add_subdirectory(thirdparty/googletest)
enable_testing()
endif(BUILD_UNIT_TESTS)
add_subdirectory(thirdparty/singleapp)
set(QTSINGLEAPPLICATION_INCLUDE_DIRS ${PROJECT_SOURCE_DIR}/singleapp/src)
set(QTSINGLEAPPLICATION_LIBRARIES qtsingleapp)
2020-12-03 10:31:16 +01:00
add_subdirectory(src)
2020-04-25 18:50:24 +02:00
This commit contains all the changes to the CMake build system required to generate a valid Visual Studio 2017 solution and projects for MuseScore. In detail, changes are as follows: - Changed .gitignore to ignore VS-specific files and directories. - VS uses a global settings file for the CMake build process: CMakeSettings.json. This is a text file, which is conceptually equivalent to the Makefile used to invoke CMake through Make. This file might need to be changed on an individual user basis, if dependencies are not installed in default paths. - New cmake macros to copy files in build\CopyFilesMacros.cmake. The code is from https://cmake.org/pipermail/cmake/2009-March/027892.html - Pre-compiled headers: Visual Studio requires to create pre-compiled headers per-project (a general per-solution PCH file, although possible, is extremely problematic and not recommended). Therefore, the new macro vstudio_pch in CreatePrecompiledHeader.cmake was created to add the pre-compiled header creation step to an existing target (similar to what is done for XCode). The existing macro precompiled_header was modified to set the values for a group of variables. As part of this, the empty file all.cpp was added to the root of the source tree, as VS requires a source file to create pre-compiled headers (the header file alone can not be compiled). - all.h is not copied to binary dir for MSVC, as I could determine no need to do this. Because of this, and the differences in PCH handling, the pseudo-targets mops1 and mops2 are not created for MSVC. - Revised all steps conditional on toolchain, and added MSVC paths as needed. In many instances, the MSVC path is the same as the MINGW path, but not always. - The manual (genManual) target used the getopt() functionality defined in POSIX libraries, which is not available on Windows. An LGPL'd port of getopt() for Windows was added in manual\getopt. The original source is in GitHub: nanoporetech/getopt-win32, based on a CodeProject article: https://www.codeproject.com/KB/cpp/getopt4win.aspx?msg=3987371. The corresponding CMakeLists.txt file was modified to include this files when compiling with MSVC. - Changes in CMakeLists.txt files to create valid MSVC targets. The changes, always conditional on the MSVC toolchain, consist of: x Setting target properties for MSVC x Using all.h in source dir x Adding pre-compiled headers to target x Removing dependency from mops1 and mops2 Notes: - The INSTALL target has NOT BEEN UPDATED for MSVC.
2018-05-01 17:48:42 +02:00
## TEMP: Display all variables!
### message(STATUS "===========================================================")
### message(STATUS "VARIABLES:")
### message(STATUS "")
### get_cmake_property(_variableNames VARIABLES)
### list (SORT _variableNames)
### foreach (_variableName ${_variableNames})
### message(STATUS "${_variableName}=${${_variableName}}")
### endforeach()
### message(STATUS "===========================================================")