2012-05-26 14:49:10 +02:00
#=============================================================================
# Mscore
# Linux Music Score Editor
#
# Copyright (C) 2002-2011 by Werner Schweer 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 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.
#=============================================================================
project ( mscore )
2013-03-10 18:50:22 +01:00
#minimum tested, report if it works with older
2016-04-12 19:44:31 +02:00
CMAKE_MINIMUM_REQUIRED ( VERSION 3.0.0 )
2013-02-12 20:51:17 +01:00
2015-04-15 10:14:06 +02:00
set ( CI $ENV{ CI } )
if ( CI )
SET_PROPERTY ( GLOBAL PROPERTY RULE_LAUNCH_COMPILE ccache )
SET_PROPERTY ( GLOBAL PROPERTY RULE_LAUNCH_LINK ccache )
endif ( CI )
2012-05-26 14:49:10 +02:00
cmake_policy ( SET CMP0003 NEW )
2013-07-11 23:18:17 +02:00
2015-03-04 11:05:23 +01:00
if ( POLICY CMP0053 )
cmake_policy ( SET CMP0053 OLD )
endif ( POLICY CMP0053 )
2014-07-06 00:21:52 +02:00
if ( POLICY CMP0045 )
cmake_policy ( SET CMP0045 OLD )
endif ( POLICY CMP0045 )
2013-07-11 23:18:17 +02:00
if ( POLICY CMP0020 )
cmake_policy ( SET CMP0020 OLD )
endif ( POLICY CMP0020 )
2012-05-26 14:49:10 +02:00
2016-03-30 13:31:15 +02:00
# silently ignore non-existent dependencies (mops1, mops2)
if ( POLICY CMP0046 )
cmake_policy ( SET CMP0046 OLD )
endif ( POLICY CMP0046 )
2016-04-18 19:23:45 +02:00
## look for Qt5
SET ( QT_MIN_VERSION "5.6.0" )
2013-03-12 11:42:10 +01:00
#include modules
2013-03-10 18:50:22 +01:00
set ( CMAKE_MODULE_PATH "${CMAKE_CURRENT_SOURCE_DIR}/build" ${ CMAKE_MODULE_PATH } )
2016-04-18 19:23:45 +02:00
include ( FindQt5 )
2016-03-30 04:14:49 +02:00
include ( UsePkgConfig1 ) #defines MACRO(PKGCONFIG1 _package _minVersion _include_DIR _link_DIR _link_FLAGS _cflags)
2013-03-10 18:50:22 +01:00
include ( FindPulseAudio )
include ( GetCompilerVersion )
2013-03-12 11:42:10 +01:00
include ( CreatePrecompiledHeader )
2013-03-10 18:50:22 +01:00
2012-05-26 14:49:10 +02:00
# for debugging the make system uncomment next line:
2016-03-30 22:33:04 +02:00
#set(CMAKE_VERBOSE_MAKEFILE ON)
2012-05-26 14:49:10 +02:00
2016-04-18 19:23:45 +02:00
set ( CMAKE_AUTOMOC TRUE )
2016-03-18 09:29:16 +01:00
set ( MSCORE_UNSTABLE TRUE ) # mark as unstable
2012-05-26 14:49:10 +02:00
set ( USE_SSE TRUE )
2012-07-09 14:50:03 +02:00
set ( SCRIPT_INTERFACE TRUE )
2012-05-26 14:49:10 +02:00
2016-01-02 13:30:37 +01:00
# Disable components not supported on Windows
if ( MINGW )
set ( WIN_NOT_AVAIL "not available on Windows" )
option ( BUILD_PULSEAUDIO ${ WIN_NOT_AVAIL } OFF )
option ( BUILD_ALSA ${ WIN_NOT_AVAIL } OFF )
endif ( MINGW )
# Disable components not supported on Mac
if ( APPLE )
set ( MAC_NOT_AVAIL "not available on Mac" )
option ( BUILD_PULSEAUDIO ${ MAC_NOT_AVAIL } OFF )
option ( BUILD_ALSA ${ MAC_NOT_AVAIL } OFF )
endif ( APPLE )
# Disable components not supported on Linux/BSD
if ( NOT APPLE AND NOT MINGW )
set ( NIX_NOT_AVAIL "not available on Linux/BSD" )
endif ( NOT APPLE AND NOT MINGW )
2014-08-12 22:34:44 +02:00
option ( AEOLUS "enable pipe organ synthesizer" OFF )
2013-03-26 19:59:51 +01:00
option ( ZERBERUS "enable experimental sfz sampler" ON )
option ( OSC "enable OSC remote control protocol" ON )
2015-11-12 16:20:17 +01:00
option ( OMR "enable PDF import" ON ) # OMR - optical music recognition
2013-03-12 11:42:10 +01:00
# for installation see: http://ubuntuforums.org/showthread.php?t=1647350
option ( OCR "enable OCR, requires OMR" OFF ) # requires tesseract 3.0, needs work on mac/win
2013-03-26 19:59:51 +01:00
option ( SOUNDFONT3 "ogg vorbis compressed fonts" ON ) # enable ogg vorbis compressed fonts, require ogg & vorbis
2015-06-01 18:09:55 +02:00
option ( HAS_AUDIOFILE "enable audio export" ON ) # requires libsndfile
2013-03-12 11:42:10 +01:00
option ( USE_SYSTEM_QTSINGLEAPPLICATION "Use system QtSingleApplication" OFF )
2015-07-25 01:26:54 +02:00
option ( BUILD_LAME "enable mp3 export" ON ) # requires libmp3lame (non-free), call CMake with -DBUILD_LAME="OFF" to disable
2012-05-26 14:49:10 +02:00
2013-03-12 11:42:10 +01:00
SET ( JACK_LONGNAME "jack (jack audio connection kit)" )
SET ( JACK_MIN_VERSION "0.98.0" )
2016-01-02 13:30:37 +01:00
option ( BUILD_JACK "Build with support for ${JACK_LONGNAME} audio backend. jack >= ${JACK_MIN_VERSION} will be needed." ON )
option ( BUILD_PULSEAUDIO "Build with support for Pulseaudio audio backend." ON )
option ( BUILD_ALSA "Build with support for ALSA audio backend." ON )
option ( BUILD_PORTAUDIO "Build with support for Portaudio audio backend." ON )
2016-05-03 16:54:03 +02:00
option ( BUILD_PCH "Build using precompiled headers." OFF )
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
# Currently, just 'ppc', 'i386' or 'ppc i386' are useful architectures,
# because the Flash-Player is not yet available as a 64-bit version.
# Flash is required for displaying the videos of MuseScore-Connect.
# See http://qt.gitorious.org/qt/pages/Qt470KnownIssues
# Since 10.6+ only runs on intel, just set it to i386.
set ( CMAKE_OSX_ARCHITECTURES x86_64 )
# Adjust and uncomment this variable, if you target a different version
# of MacOSX.
2014-12-19 16:30:18 +01:00
# set(CMAKE_OSX_SYSROOT /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.9.sdk)
2012-05-26 14:49:10 +02:00
2013-03-13 18:55:42 +01:00
set ( CMAKE_OSX_DEPLOYMENT_TARGET 10.7 ) #min version required
2012-05-26 14:49:10 +02:00
set ( HAS_AUDIOFILE TRUE ) # requires libsndfile
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 )
set ( OsxFrameworks ${ AudioToolboxFW } ${ AudioUnitFW } ${ CoreAudioFW } ${ CoreMidiFW } ${ SystemConfigurationFW } ${ CoreServicesFW } )
endif ( APPLE )
2013-02-13 22:01:48 +01:00
#
2013-04-06 11:01:30 +02:00
# Check for gcc compiler >= 4.7
2013-02-13 22:01:48 +01:00
#
if ( "${CMAKE_CXX_COMPILER_ID}" MATCHES "GNU" )
2013-03-26 19:59:51 +01:00
if ( ${ CMAKE_CXX_COMPILER_MAJOR } LESS 4
2013-04-06 11:01:30 +02:00
OR ( ( ${ CMAKE_CXX_COMPILER_MAJOR } EQUAL 4 ) AND ( ${ CMAKE_CXX_COMPILER_MINOR } LESS 7 ) ) )
2013-02-13 22:01:48 +01:00
message ( FATAL_ERROR "bad gcc compiler version " ${ CMAKE_CXX_COMPILER_VERSION }
2013-04-06 11:01:30 +02:00
" > = 4 . 7 r e q u i r e d " )
2013-02-13 22:01:48 +01:00
endif ( )
endif ( "${CMAKE_CXX_COMPILER_ID}" MATCHES "GNU" )
2013-03-13 18:55:42 +01:00
if ( APPLE )
2016-03-28 15:00:05 +02:00
set ( CMAKE_CXX_FLAGS_DEBUG "-std=c++11 -fPIC -stdlib=libc++ -g -Wno-inconsistent-missing-override" )
set ( CMAKE_CXX_FLAGS_RELEASE "-std=c++11 -fPIC -stdlib=libc++ -O2 -DNDEBUG -DQT_NO_DEBUG -Wno-inconsistent-missing-override" )
2016-04-14 16:20:44 +02:00
# this is necessary for genManual to be executed during the build phase
# it needs to be able to get the Qt libs.
SET ( CMAKE_INSTALL_RPATH_USE_LINK_PATH TRUE )
SET ( CMAKE_INSTALL_RPATH "${QT_INSTALL_PREFIX}/lib" )
2013-03-13 18:55:42 +01:00
else ( APPLE )
2013-05-14 17:25:16 +02:00
if ( MINGW )
2013-08-11 15:03:32 +02:00
# -mno-ms-bitfields see #22048
2016-03-28 15:00:05 +02:00
set ( CMAKE_CXX_FLAGS_DEBUG "-std=c++11 -mno-ms-bitfields -g" )
set ( CMAKE_CXX_FLAGS_RELEASE "-std=c++11 -mno-ms-bitfields -O2 -DNDEBUG -DQT_NO_DEBUG" )
2015-08-09 18:40:47 +02:00
set ( CMAKE_EXE_LINKER_FLAGS "-Wl,--large-address-aware" )
2013-05-14 17:25:16 +02:00
else ( MINGW )
2016-03-30 22:33:04 +02:00
set ( CMAKE_CXX_FLAGS_DEBUG "-std=c++11 -fPIC -g -Wall -Wextra" )
2016-03-18 09:29:16 +01:00
set ( CMAKE_CXX_FLAGS_RELEASE "-std=c++11 -fPIC -O2 -DNDEBUG -DQT_NO_DEBUG -DQT_NO_DEBUG_OUTPUT" )
2013-05-14 17:25:16 +02:00
endif ( MINGW )
2013-03-13 18:55:42 +01:00
endif ( APPLE )
2012-05-26 14:49:10 +02:00
set ( CMAKE_INCLUDE_CURRENT_DIR TRUE )
2015-07-25 01:26:54 +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 )
# The Mscore version number.
2016-05-03 16:54:03 +02:00
SET ( MUSESCORE_NAME "MuseScore" )
2016-04-21 12:57:41 +02:00
SET ( MUSESCORE_VERSION_MAJOR "3" )
SET ( MUSESCORE_VERSION_MINOR "0" )
2013-03-12 11:42:10 +01:00
SET ( MUSESCORE_VERSION_PATCH "0" )
SET ( MUSESCORE_VERSION "${MUSESCORE_VERSION_MAJOR}.${MUSESCORE_VERSION_MINOR}" )
2014-12-08 10:30:06 +01:00
SET ( MUSESCORE_NAME_VERSION "${MUSESCORE_NAME} ${MUSESCORE_VERSION_MAJOR}" )
2012-05-26 14:49:10 +02:00
#
# version schema x.x.x is hardcoded in source
#
2013-03-12 11:42:10 +01:00
SET ( MUSESCORE_VERSION_FULL "${MUSESCORE_VERSION}.${MUSESCORE_VERSION_PATCH}" )
2012-05-26 14:49:10 +02:00
2015-07-25 01:26:54 +02:00
if ( MUSESCORE_LABEL )
SET ( MUSESCORE_NAME_VERSION "${MUSESCORE_NAME_VERSION} ${MUSESCORE_LABEL}" )
endif ( MUSESCORE_LABEL )
if ( MSCORE_UNSTABLE )
SET ( MUSESCORE_NAME_VERSION "${MUSESCORE_NAME_VERSION} (${MUSESCORE_VERSION_FULL} unstable)" )
endif ( MSCORE_UNSTABLE )
2012-05-26 14:49:10 +02:00
if ( MINGW OR APPLE )
if ( MINGW )
SET ( Mscore_INSTALL_NAME "" )
SET ( Mscore_SHARE_NAME "./" )
else ( MINGW )
SET ( Mscore_INSTALL_NAME "Contents/Resources/" )
SET ( Mscore_SHARE_NAME "mscore.app/" )
endif ( MINGW )
else ( MINGW OR APPLE )
2015-07-25 01:26:54 +02:00
SET ( Mscore_INSTALL_NAME "mscore${MSCORE_INSTALL_SUFFIX}-${MUSESCORE_VERSION}/" )
2012-05-26 14:49:10 +02:00
SET ( Mscore_SHARE_NAME "share/" )
endif ( MINGW OR APPLE )
##
## alsa >= 1.0.0
##
2016-01-02 13:30:37 +01:00
if ( BUILD_ALSA )
2016-03-30 04:14:49 +02:00
PKGCONFIG1 ( alsa 1.0.0 ALSA_INCDIR ALSA_LIBDIR ALSA_LIB ALSA_CPP )
2012-05-26 14:49:10 +02:00
if ( NOT ALSA_INCDIR )
2016-01-02 13:30:37 +01:00
message ( SEND_ERROR "Error: ALSA support requested (BUILD_ALSA=${BUILD_ALSA}), but ALSA >= 1.0.0 was not found." )
2012-05-26 14:49:10 +02:00
else ( NOT ALSA_INCDIR )
2016-03-30 13:31:15 +02:00
message ( "ALSA >= 1.0.0 found. ALSA support enabled. INCDIR ${ALSA_INCDIR}, LIBDIR ${ALSA_LIBDIR}, LIB ${ALSA_LIB}, CPP ${ALSA_CPP}" )
2012-05-26 14:49:10 +02:00
set ( USE_ALSA 1 )
endif ( NOT ALSA_INCDIR )
2016-01-02 13:30:37 +01:00
else ( BUILD_ALSA )
message ( STATUS "ALSA support disabled" )
endif ( BUILD_ALSA )
2012-05-26 14:49:10 +02:00
##
2016-01-02 13:30:37 +01:00
## MIDI
2012-05-26 14:49:10 +02:00
##
if ( APPLE OR MINGW )
2016-01-02 13:30:37 +01:00
set ( HAS_MIDI 1 )
2012-05-26 14:49:10 +02:00
else ( APPLE OR MINGW )
2016-01-02 13:30:37 +01:00
if ( USE_ALSA )
set ( HAS_MIDI 1 )
endif ( USE_ALSA )
endif ( APPLE OR MINGW )
##
## pulseaudio
##
if ( BUILD_PULSEAUDIO )
2012-05-26 14:49:10 +02:00
if ( PULSEAUDIO_FOUND )
set ( USE_PULSEAUDIO 1 )
2016-01-02 13:30:37 +01:00
message ( "Pulseaudio found. Pulseaudio support enabled." )
2012-05-26 14:49:10 +02:00
else ( PULSEAUDIO_FOUND )
2016-01-02 13:30:37 +01:00
message ( SEND_ERROR "Error: Pulseaudio support requested (BUILD_PULSEAUDIO=${BUILD_PULSEAUDIO}), but Pulseaudio was not found." )
2012-05-26 14:49:10 +02:00
endif ( PULSEAUDIO_FOUND )
2016-01-02 13:30:37 +01:00
else ( BUILD_PULSEAUDIO )
message ( STATUS "Pulseaudio support disabled" )
endif ( BUILD_PULSEAUDIO )
2012-05-26 14:49:10 +02:00
2015-06-01 18:09:55 +02:00
##
## lame
##
2015-06-01 19:31:45 +02:00
if ( APPLE OR MINGW )
2015-06-01 19:41:21 +02:00
IF ( BUILD_LAME )
include ( FindLame )
set ( USE_LAME 1 )
ENDIF ( BUILD_LAME )
2015-06-01 19:31:45 +02:00
else ( APPLE OR MINGW )
IF ( BUILD_LAME )
include ( FindLame )
IF ( LAME_FOUND )
set ( USE_LAME 1 )
MESSAGE ( "LAME found." )
ELSE ( LAME_FOUND )
set ( USE_LAME 0 )
MESSAGE ( "LAME not found." )
ENDIF ( LAME_FOUND )
ELSE ( BUILD_LAME )
MESSAGE ( STATUS "LAME mp3 support disabled" )
ENDIF ( BUILD_LAME )
endif ( APPLE OR MINGW )
2012-05-26 14:49:10 +02:00
##
## find jack >= JACK_MIN_VERSION
##
IF ( BUILD_JACK )
IF ( MINGW )
set ( USE_JACK 1 )
IF ( "$ENV{PROCESSOR_ARCHITEW6432}" STREQUAL "" )
IF ( $ENV{ PROCESSOR_ARCHITECTURE } STREQUAL "x86" )
# "pure" 32-bit environment
set ( JACK_INCDIR "$ENV{PROGRAMFILES}/Jack/includes" )
set ( JACK_LIB "$ENV{PROGRAMFILES}/Jack/lib/libjack.a" )
ELSE ( $ENV{ PROCESSOR_ARCHITECTURE } STREQUAL "x86" )
# "pure" 64-bit environment
set ( JACK_INCDIR "$ENV{PROGRAMFILES(x86)}/Jack/includes" )
set ( JACK_LIB "$ENV{PROGRAMFILES(x86)}/Jack/lib/libjack.a" )
ENDIF ( $ENV{ PROCESSOR_ARCHITECTURE } STREQUAL "x86" )
ELSE ( "$ENV{PROCESSOR_ARCHITEW6432}" STREQUAL "" )
IF ( "$ENV{PROCESSOR_ARCHITECTURE}" STREQUAL "x86" )
# 32-bit program running with an underlying 64-bit environment
set ( JACK_INCDIR "$ENV{PROGRAMFILES(x86)}/Jack/includes" )
set ( JACK_LIB "$ENV{PROGRAMFILES(x86)}/Jack/lib/libjack.a" )
ELSE ( "$ENV{PROCESSOR_ARCHITECTURE}" STREQUAL "x86" )
# theoretically impossible case...
2016-01-02 13:30:37 +01:00
MESSAGE ( SEND_ERROR "Error: Impossible program/environment bitness combination deduced: 64-bit program running in 32-bit environment. This is a programming error. PROCESSOR_ARCHITEW6432=$ENV{PROCESSOR_ARCHITEW6432}. PROCESSOR_ARCHITECTURE=$ENV{PROCESSOR_ARCHITECTURE}" )
2012-05-26 14:49:10 +02:00
ENDIF ( "$ENV{PROCESSOR_ARCHITECTURE}" STREQUAL "x86" )
ENDIF ( "$ENV{PROCESSOR_ARCHITEW6432}" STREQUAL "" )
2016-01-02 13:30:37 +01:00
MESSAGE ( "jack support enabled." )
2012-05-26 14:49:10 +02:00
ELSE ( MINGW )
2016-03-30 04:14:49 +02:00
PKGCONFIG1 ( jack ${ JACK_MIN_VERSION } JACK_INCDIR JACK_LIBDIR JACK_LIB JACK_CPP )
2012-05-26 14:49:10 +02:00
IF ( JACK_INCDIR )
2016-01-02 13:30:37 +01:00
MESSAGE ( STATUS "${JACK_LONGNAME} >= ${JACK_MIN_VERSION} found. jack support enabled." )
2012-05-26 14:49:10 +02:00
SET ( USE_JACK 1 )
ELSE ( JACK_INCDIR )
MESSAGE ( STATUS "${JACK_LONGNAME} >= ${JACK_MIN_VERSION} not found" )
2016-01-02 13:30:37 +01:00
MESSAGE ( SEND_ERROR "Error: jack support requested (BUILD_JACK=${BUILD_JACK}), but jack was not found" )
2012-05-26 14:49:10 +02:00
ENDIF ( JACK_INCDIR )
ENDIF ( MINGW )
ELSE ( BUILD_JACK )
MESSAGE ( STATUS "${JACK_LONGNAME} support disabled" )
ENDIF ( BUILD_JACK )
##
## portaudio
##
2016-01-02 13:30:37 +01:00
if ( BUILD_PORTAUDIO )
if ( MINGW )
set ( USE_PORTAUDIO 1 )
set ( USE_PORTMIDI 1 )
else ( MINGW )
2016-03-30 04:14:49 +02:00
PKGCONFIG1 ( portaudio-2.0 19 PORTAUDIO_INCDIR PORTAUDIO_LIBDIR PORTAUDIO_LIB PORTAUDIO_CPP )
2016-01-02 13:30:37 +01:00
if ( PORTAUDIO_INCDIR )
2016-03-30 04:14:49 +02:00
message ( STATUS "Portaudio found. Portaudio support enabled. INCDIR ${PORTAUDIO_INCDIR}, LIBDIR ${PORTAUDIO_LIBDIR}, LIB ${PORTAUDIO_LIB}" )
2016-01-02 13:30:37 +01:00
set ( USE_PORTAUDIO 1 )
else ( PORTAUDIO_INCDIR )
message ( SEND_ERROR "Error: Portaudio support requested (BUILD_PORTAUDIO=${BUILD_PORTAUDIO}), but portaudio-2.0 Version 19 was not found (package portaudio19-dev)" )
endif ( PORTAUDIO_INCDIR )
if ( APPLE )
set ( USE_PORTMIDI 1 )
else ( APPLE )
set ( USE_PORTMIDI 0 )
endif ( APPLE )
endif ( MINGW )
else ( BUILD_PORTAUDIO )
message ( STATUS "Portaudio support disabled" )
endif ( BUILD_PORTAUDIO )
2012-05-26 14:49:10 +02:00
2013-05-21 17:53:14 +02:00
2013-05-21 18:26:08 +02:00
if ( APPLE )
2013-05-21 17:53:14 +02:00
if ( SOUNDFONT3 )
##
## libvorbis
##
2016-03-30 04:14:49 +02:00
PKGCONFIG1 ( vorbis 1.3.3 VORBIS_INCDIR VORBIS_LIBDIR VORBIS_LIB VORBIS_CPP )
2013-05-21 17:53:14 +02:00
if ( VORBIS_INCDIR )
message ( "libvorbis detected ${VORBIS_INCDIR} ${VORBIS_LIBDIR} ${VORBIS_LIB}" )
else ( VORBIS_INCDIR )
message ( "libvorbis not found\n" )
endif ( VORBIS_INCDIR )
##
## libogg
##
2016-03-30 04:14:49 +02:00
PKGCONFIG1 ( ogg 1.3.0 OGG_INCDIR OGG_LIBDIR OGG_LIB OGG_CPP )
2013-05-21 17:53:14 +02:00
if ( OGG_INCDIR )
message ( "libogg detected ${OGG_INCDIR} ${OGG_LIBDIR} ${OGG_LIB}" )
else ( OGG_INCDIR )
message ( "libogg not found\n" )
endif ( OGG_INCDIR )
endif ( SOUNDFONT3 )
if ( HAS_AUDIOFILE )
##
## libsndfile
##
2016-03-30 04:14:49 +02:00
PKGCONFIG1 ( sndfile 1.0.25 SNDFILE_INCDIR SNDFILE_LIBDIR SNDFILE_LIB SNDFILE_CPP )
2013-05-21 17:53:14 +02:00
if ( SNDFILE_INCDIR )
message ( "libsndfile detected ${SNDFILE_INCDIR} ${SNDFILE_LIBDIR} ${SNDFILE_LIB}" )
else ( SNDFILE_INCDIR )
message ( "libsndfile not found\n" )
endif ( SNDFILE_INCDIR )
endif ( HAS_AUDIOFILE )
2013-05-21 18:26:08 +02:00
else ( APPLE )
2013-06-03 12:54:11 +02:00
if ( MINGW )
2013-05-21 18:26:08 +02:00
set ( SNDFILE_LIB sndfile-1 )
else ( MINGW )
set ( SNDFILE_LIB sndfile )
endif ( MINGW )
2013-05-21 17:53:14 +02:00
set ( OGG_LIB ogg )
set ( VORBIS_LIB vorbis )
2013-05-21 18:26:08 +02:00
endif ( APPLE )
2013-05-21 17:53:14 +02:00
2013-03-12 11:42:10 +01:00
##
## QtSingleApplication
##
if ( USE_SYSTEM_QTSINGLEAPPLICATION )
find_path ( QTSINGLEAPPLICATION_INCLUDE_DIRS qtsingleapplication.h PATH_SUFFIXES QtSolutions )
find_library ( QTSINGLEAPPLICATION_LIBRARIES QtSolutions_SingleApplication-2.6 )
else ( USE_SYSTEM_QTSINGLEAPPLICATION )
subdirs ( thirdparty/singleapp )
set ( QTSINGLEAPPLICATION_INCLUDE_DIRS ${ PROJECT_SOURCE_DIR } /singleapp/src )
set ( QTSINGLEAPPLICATION_LIBRARIES qtsingleapp )
endif ( USE_SYSTEM_QTSINGLEAPPLICATION )
2012-05-26 14:49:10 +02:00
##
## produce config.h file
##
configure_file (
$ { P R O J E C T _ S O U R C E _ D I R } / b u i l d / c o n f i g . h . i n
$ { P R O J E C T _ B I N A R Y _ D I R } / c o n f i g . h
)
if ( NOT MINGW AND NOT APPLE )
2015-07-25 01:26:54 +02:00
#### PACKAGING for Linux and BSD based systems (more in mscore/CMakeLists.txt) ####
2013-03-12 11:42:10 +01:00
#
# set library search path for runtime linker to load the same
# qt libraries as we used at compile time
#
2015-07-25 01:26:54 +02:00
SET ( CMAKE_INSTALL_RPATH "${_qt5Core_install_prefix}/lib" ) # ignored if CMAKE_SKIP_RPATH="TRUE"
2016-01-04 02:36:36 +01:00
string ( TOUPPER "mscore${MSCORE_INSTALL_SUFFIX}" MAN_MSCORE_UPPER ) # Command name shown in uppercase in man pages by convention
if ( ${ MSCORE_INSTALL_SUFFIX } MATCHES "portable" ) # Note: "-portable-anything" would match
# Build portable AppImage as per https://github.com/probonopd/AppImageKit
2016-03-30 04:14:49 +02:00
if ( NOT DEFINED ARCH )
execute_process ( COMMAND arch OUTPUT_VARIABLE ARCH OUTPUT_STRIP_TRAILING_WHITESPACE ) # get architecture (strip trailing newline)
endif ( NOT DEFINED ARCH )
2016-01-04 02:36:36 +01:00
get_filename_component ( PORTABLE_INSTALL_PATH ${ CMAKE_INSTALL_PREFIX } PATH ) # get path (dirname)
get_filename_component ( PORTABLE_INSTALL_NAME ${ CMAKE_INSTALL_PREFIX } NAME ) # strip path (basename)
if ( NOT MSCORE_UNSTABLE )
set ( PORTABLE_INSTALL_NAME "${PORTABLE_INSTALL_NAME}-${MUSESCORE_VERSION_FULL}" ) # append version info.
endif ( NOT MSCORE_UNSTABLE )
set ( PORTABLE_INSTALL_NAME "${PORTABLE_INSTALL_NAME}-${ARCH}" ) # append system architecture.
set ( CMAKE_INSTALL_PREFIX ${ PORTABLE_INSTALL_PATH } / ${ PORTABLE_INSTALL_NAME } .AppDir ) # e.g. "MuseScore-X.Y.Z-x86_64.AppDir"
execute_process ( COMMAND echo ${ CMAKE_INSTALL_PREFIX } OUTPUT_FILE PREFIX.txt )
# Prepare portable scripts:
configure_file ( build/Linux+BSD/portable/AppRun.in AppRun @ONLY )
configure_file ( build/Linux+BSD/portable/portable-utils.in portable-utils @ONLY )
set ( SCRIPT_PERMS PERMISSIONS OWNER_READ OWNER_WRITE OWNER_EXECUTE GROUP_READ WORLD_READ )
install ( PROGRAMS ${ PROJECT_BINARY_DIR } /AppRun DESTINATION . COMPONENT portable ${ SCRIPT_PERMS } )
install ( PROGRAMS ${ PROJECT_BINARY_DIR } /portable-utils
b u i l d / L i n u x + B S D / p o r t a b l e / l d d - r e c u r s i v e
b u i l d / r m - e m p t y - d i r s D E S T I N A T I O N b i n C O M P O N E N T p o r t a b l e $ { S C R I P T _ P E R M S } )
install ( FILES build/Linux+BSD/portable/qt.conf DESTINATION bin COMPONENT portable )
else ( ${ MSCORE_INSTALL_SUFFIX } MATCHES "portable" )
set ( MAN_PORTABLE '.\ " ' ) # comment out lines in man page that are only relevent to the portable version
endif ( ${ MSCORE_INSTALL_SUFFIX } MATCHES "portable" )
2015-07-25 01:26:54 +02:00
# install desktop file (perform variable substitution first)
2016-01-04 02:36:36 +01:00
configure_file ( build/Linux+BSD/mscore.desktop.in mscore ${ MSCORE_INSTALL_SUFFIX } .desktop )
2015-07-25 01:26:54 +02:00
install ( FILES ${ PROJECT_BINARY_DIR } /mscore ${ MSCORE_INSTALL_SUFFIX } .desktop DESTINATION share/applications )
# substitute variables within man pages
set ( MAN_NAME mscore )
set ( MAN_ALIAS musescore )
set ( MAN_EXTENSION .1 )
set ( MAN_FULL_NAME ${ MAN_NAME } ${ MSCORE_INSTALL_SUFFIX } ${ MAN_EXTENSION } )
set ( MAN_FULL_ALIAS ${ MAN_ALIAS } ${ MSCORE_INSTALL_SUFFIX } ${ MAN_EXTENSION } )
2016-01-04 02:36:36 +01:00
set ( MAN_TARGET ${ PROJECT_SOURCE_DIR } /build/Linux+BSD/ ${ MAN_NAME } ${ MAN_EXTENSION } .in )
2015-07-25 01:26:54 +02:00
set ( MAN_BUILD ${ PROJECT_BINARY_DIR } / ${ MAN_FULL_NAME } )
configure_file ( ${ MAN_TARGET } ${ MAN_BUILD } )
2015-06-02 01:24:08 +02:00
# compress man pages if gzip is installed (don't on OpenBSD)
# note: compressing man pages is normal on Linux but not OpenBSD
find_program ( GZIP_EXECUTABLE gzip DOC "A tool for compressing manpages (optional)." )
if ( GZIP_EXECUTABLE AND NOT CMAKE_SYSTEM_NAME MATCHES "OpenBSD" )
message ( STATUS "Found gzip. Man pages will be compressed." )
2015-07-25 01:26:54 +02:00
set ( MAN_TARGET ${ MAN_BUILD } )
set ( MAN_EXTENSION ${ MAN_EXTENSION } .gz )
set ( MAN_FULL_NAME ${ MAN_NAME } ${ MSCORE_INSTALL_SUFFIX } ${ MAN_EXTENSION } )
set ( MAN_FULL_ALIAS ${ MAN_ALIAS } ${ MSCORE_INSTALL_SUFFIX } ${ MAN_EXTENSION } )
set ( MAN_BUILD ${ PROJECT_BINARY_DIR } / ${ MAN_FULL_NAME } )
2015-06-02 01:24:08 +02:00
add_custom_command (
O U T P U T $ { M A N _ B U I L D }
D E P E N D S $ { M A N _ T A R G E T }
2015-07-25 01:26:54 +02:00
C O M M A N D $ { G Z I P _ E X E C U T A B L E } - 9 < $ { M A N _ T A R G E T } > $ { M A N _ B U I L D }
2015-06-02 01:24:08 +02:00
)
2016-01-04 02:36:36 +01:00
add_custom_target ( manpages ALL
2015-06-02 01:24:08 +02:00
D E P E N D S $ { M A N _ B U I L D }
C O M M A N D e c h o " M a n p a g e s h a v e b e e n c o m p r e s s e d r e a d y f o r i n s t a l l a t i o n . "
V E R B A T I M
)
else ( GZIP_EXECUTABLE AND NOT CMAKE_SYSTEM_NAME MATCHES "OpenBSD" )
if ( CMAKE_SYSTEM_NAME MATCHES "OpenBSD" )
message ( STATUS "System is OpenBSD: Man pages will not be compressed." )
else ( CMAKE_SYSTEM_NAME MATCHES "OpenBSD" )
message ( STATUS "gzip not found (it is optional). Man pages will not be compressed." )
endif ( CMAKE_SYSTEM_NAME MATCHES "OpenBSD" )
2016-01-04 02:36:36 +01:00
add_custom_target ( manpages ALL
2015-06-02 01:24:08 +02:00
C O M M A N D e c h o " M a n p a g e s w i l l b e i n s t a l l e d u n c o m p r e s s e d . "
V E R B A T I M
)
endif ( GZIP_EXECUTABLE AND NOT CMAKE_SYSTEM_NAME MATCHES "OpenBSD" )
# install man pages in either compressed or uncompressed form
2015-07-25 01:26:54 +02:00
install ( FILES ${ MAN_BUILD } DESTINATION share/man/man1 COMPONENT doc )
# create symlink alias for man pages so `man musescore` = `man mscore`
find_program ( LN_EXECUTABLE ln DOC "A tool for creating symbolic link aliases (optional)." )
if ( LN_EXECUTABLE )
message ( STATUS "Found ln. Symlink aliases will be created for MuseScore executable and the man pages." )
add_custom_command (
T A R G E T m a n p a g e s
C O M M A N D e c h o " C r e a t i n g s y m l i n k a l i a s f o r m a n p a g e s . "
C O M M A N D $ { L N _ E X E C U T A B L E } - s f " $ { M A N _ F U L L _ N A M E } " " $ { M A N _ F U L L _ A L I A S } "
C O M M A N D e c h o ' S y m l i n k a l i a s : $ { M A N _ F U L L _ A L I A S } - > $ { M A N _ F U L L _ N A M E } '
)
install ( FILES ${ PROJECT_BINARY_DIR } / ${ MAN_FULL_ALIAS } DESTINATION share/man/man1 COMPONENT doc )
else ( LN_EXECUTABLE )
message ( STATUS "ln not found (it is optional). No symlink aliases will be created." )
endif ( LN_EXECUTABLE )
2015-06-02 01:24:08 +02:00
# add .MSCZ and .MSCX to MIME database (informs system that filetypes .MSCZ & .MSCX are MuseScore files)
2016-01-04 02:36:36 +01:00
configure_file ( build/Linux+BSD/musescore.xml.in musescore ${ MSCORE_INSTALL_SUFFIX } .xml )
2015-07-25 01:26:54 +02:00
install ( FILES ${ PROJECT_BINARY_DIR } /musescore ${ MSCORE_INSTALL_SUFFIX } .xml DESTINATION share/mime/packages COMPONENT doc )
2015-06-02 01:24:08 +02:00
# Note: must now run "update-mime-database" to apply changes. This is done in the Makefile.
2012-05-26 14:49:10 +02:00
endif ( NOT MINGW AND NOT APPLE )
#
# create precompiled header file
#
2013-02-04 16:56:01 +01:00
2013-03-13 18:55:42 +01:00
# all.h is expected in PROJECT_BINARY_DIR by subdirs
2012-06-05 16:32:54 +02:00
add_custom_command (
2013-03-13 18:55:42 +01:00
O U T P U T $ { P R O J E C T _ B I N A R Y _ D I R } / a l l . h
C O M M A N D $ { C M A K E _ C O M M A N D }
A R G S - E c o p y $ { P R O J E C T _ S O U R C E _ D I R } / a l l . h $ { P R O J E C T _ B I N A R Y _ D I R } / a l l . h
D E P E N D S $ { P R O J E C T _ S O U R C E _ D I R } / a l l . h
W O R K I N G _ D I R E C T O R Y $ { P R O J E C T _ B I N A R Y _ D I R }
)
2016-05-03 16:54:03 +02:00
if ( NOT MINGW )
2013-12-16 23:35:32 +01:00
set ( BUILD_PCH true )
2016-05-03 16:54:03 +02:00
endif ( NOT MINGW )
2014-06-26 13:33:16 +02:00
2013-12-16 23:35:32 +01:00
precompiled_header ( QT_INCLUDES all ${ BUILD_PCH } )
2014-06-26 13:33:16 +02:00
2012-05-26 14:49:10 +02:00
ADD_CUSTOM_TARGET ( mops1 DEPENDS ${ PROJECT_BINARY_DIR } /all.h )
ADD_CUSTOM_TARGET ( mops2 DEPENDS ${ PCH } )
2013-03-12 11:42:10 +01:00
##
## add subdirs
##
2013-04-15 10:38:16 +02:00
subdirs (
2013-06-03 12:54:11 +02:00
m s c o r e a w l b w w 2 m x m l s h a r e m i d i a u d i o f i l e f l u i d m s t y l e l i b m s c o r e s y n t h e s i z e r
2014-01-07 19:42:45 +01:00
e f f e c t s t h i r d p a r t y / r t f 2 h t m l t h i r d p a r t y / d i f f t h i r d p a r t y / b e a t r o o t
2016-03-05 10:29:38 +01:00
t h i r d p a r t y / q z i p t h i r d p a r t y / k Q O A u t h
2013-04-15 10:38:16 +02:00
)
2016-03-05 10:29:38 +01:00
# thirdparty/xmlstream
2014-06-23 16:07:33 +02:00
if ( APPLE AND CMAKE_BUILD_TYPE MATCHES "DEBUG" )
#with xcode, we need to have all the targets in the same project
add_subdirectory ( mtest )
else ( APPLE AND CMAKE_BUILD_TYPE MATCHES "DEBUG" )
2014-06-26 13:33:16 +02:00
add_subdirectory ( mtest EXCLUDE_FROM_ALL )
2014-06-23 16:07:33 +02:00
endif ( APPLE AND CMAKE_BUILD_TYPE MATCHES "DEBUG" )
2012-05-26 14:49:10 +02:00
2015-02-18 11:35:09 +01:00
add_subdirectory ( rdoc EXCLUDE_FROM_ALL )
2013-04-08 16:28:21 +02:00
add_subdirectory ( miditools EXCLUDE_FROM_ALL )
2013-11-06 15:58:05 +01:00
add_subdirectory ( fonttools EXCLUDE_FROM_ALL )
2012-08-07 20:47:48 +02:00
add_subdirectory ( manual )
2014-11-12 16:36:40 +01:00
add_subdirectory ( demos )
2012-05-26 14:49:10 +02:00
2013-03-12 11:42:10 +01:00
if ( USE_PORTMIDI )
2012-05-26 14:49:10 +02:00
subdirs ( thirdparty/portmidi )
2013-03-12 11:42:10 +01:00
endif ( USE_PORTMIDI )
2012-05-26 14:49:10 +02:00
if ( AEOLUS )
subdirs ( aeolus )
endif ( AEOLUS )
2013-03-26 19:59:51 +01:00
if ( ZERBERUS )
subdirs ( zerberus )
endif ( ZERBERUS )
2012-05-26 14:49:10 +02:00
if ( OMR )
2015-11-12 16:20:17 +01:00
subdirs ( omr thirdparty/poppler )
2012-05-26 14:49:10 +02:00
endif ( OMR )
if ( OSC )
subdirs ( thirdparty/ofqf )
endif ( OSC )
2015-11-16 17:05:51 +01:00
subdirs ( thirdparty/freetype )
2013-03-12 11:42:10 +01:00
##
## includes
##
2012-05-26 14:49:10 +02:00
include_directories (
$ { P R O J E C T _ S O U R C E _ D I R }
$ { P R O J E C T _ B I N A R Y _ D I R }
$ { A L S A _ I N C D I R }
$ { J A C K _ I N C D I R }
$ { P O R T A U D I O _ I N C D I R }
2013-05-21 17:53:14 +02:00
$ { O G G _ I N C D I R }
$ { V O R B I S _ I N C D I R }
$ { S N D F I L E _ I N C D I R }
$ { L A M E _ I N C L U D E _ D I R }
2015-11-16 14:24:47 +01:00
# ${FREETYPE_INCLUDE_DIRS}
$ { P R O J E C T _ S O U R C E _ D I R } / t h i r d p a r t y / f r e e t y p e / i n c l u d e
2012-05-26 14:49:10 +02:00
)
2015-11-12 16:20:17 +01:00
if ( OMR )
include_directories ( ${ PROJECT_SOURCE_DIR } /thirdparty/poppler )
include_directories ( ${ PROJECT_SOURCE_DIR } /thirdparty/poppler/poppler )
endif ( OMR )
2012-05-26 14:49:10 +02:00
##
2013-03-26 19:59:51 +01:00
## Include packaging
2012-05-26 14:49:10 +02:00
##
2013-03-12 11:42:10 +01:00
include ( Packaging )
2012-05-26 14:49:10 +02:00
2013-03-12 11:42:10 +01:00
##
## custom target for translation generation
##
2012-05-26 14:49:10 +02:00
add_custom_target ( lupdate
C O M M A N D $ { P R O J E C T _ S O U R C E _ D I R } / b u i l d / g e n - q t - p r o j e c t f i l e $ { P R O J E C T _ S O U R C E _ D I R } > m s c o r e . p r o
2016-04-18 19:23:45 +02:00
C O M M A N D Q t 5 : : l u p d a t e $ { P R O J E C T _ B I N A R Y _ D I R } / m s c o r e . p r o
2014-08-07 11:39:57 +02:00
C O M M A N D $ { P R O J E C T _ S O U R C E _ D I R } / b u i l d / g e n - i n s t r u m e n t s - p r o j e c t f i l e $ { P R O J E C T _ S O U R C E _ D I R } / s h a r e / i n s t r u m e n t s > i n s t r u m e n t s . p r o
2016-04-18 19:23:45 +02:00
C O M M A N D Q t 5 : : l u p d a t e $ { P R O J E C T _ B I N A R Y _ D I R } / i n s t r u m e n t s . p r o
2012-05-26 14:49:10 +02:00
W O R K I N G _ D I R E C T O R Y $ { P R O J E C T _ B I N A R Y _ D I R }
)
add_custom_target ( lrelease
2016-04-18 19:23:45 +02:00
C O M M A N D Q t 5 : : l r e l e a s e $ { P R O J E C T _ S O U R C E _ D I R } / s h a r e / l o c a l e / * . t s
2012-05-26 14:49:10 +02:00
W O R K I N G _ D I R E C T O R Y $ { P R O J E C T _ B I N A R Y _ D I R }
)
2013-03-12 11:42:10 +01:00
##
## create and install the plugin framework manual
##
2012-08-08 11:16:55 +02:00
add_custom_command ( OUTPUT ${ PROJECT_BINARY_DIR } /plugins
C O M M A N D g e n M a n u a l $ { P R O J E C T _ S O U R C E _ D I R } $ { P R O J E C T _ B I N A R Y _ D I R }
D E P E N D S g e n M a n u a l
)