MuseScore/src/main/CMakeLists.txt

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

193 lines
5.7 KiB
CMake
Raw Normal View History

2012-05-26 14:49:10 +02:00
#=============================================================================
# MuseScore
# Music Composition & Notation
2012-05-26 14:49:10 +02:00
#
# Copyright (C) 2019 MuseScore BVBA
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-08 11:48:52 +01:00
# Setup main application
include(GetPlatformInfo)
# Common
set(EXECUTABLE_NAME mscore)
# Platform specific
if (PLATFORM_IS_WINDOWS)
set(MSCORE_OUTPUT_NAME ${MUSESCORE_NAME}${MUSESCORE_VERSION_MAJOR})
include(GetCompilerInfo)
if (COMPILER_IS_MSVC)
# MSVC recognizes a *.rc file and will invoke the resource compiler to link it
set (ICON_RES_FILE ${CMAKE_CURRENT_LIST_DIR}/res/mscore.rc)
endif(COMPILER_IS_MSVC)
if (COMPILER_IS_MINGW)
set(ICON_RES_FILE ${PROJECT_BINARY_DIR}/resfile.o)
add_custom_command(
OUTPUT ${PROJECT_BINARY_DIR}/resfile.o
COMMAND ${CMAKE_RC_COMPILER} -i mscore.rc -o ${PROJECT_BINARY_DIR}/resfile.o
DEPENDS ${PROJECT_SOURCE_DIR}/src/main/res/mscore.rc
WORKING_DIRECTORY ${PROJECT_SOURCE_DIR}/src/main/res
)
set_source_files_properties(${PROJECT_BINARY_DIR}/resfile.o PROPERTIES generated true)
endif(COMPILER_IS_MINGW)
elseif(PLATFORM_IS_LINUX)
if (MSCORE_INSTALL_SUFFIX)
set(MSCORE_OUTPUT_NAME "${EXECUTABLE_NAME}${MSCORE_INSTALL_SUFFIX}")
endif(MSCORE_INSTALL_SUFFIX)
elseif(PLATFORM_IS_MACOS)
set(EXECUTABLE_NAME mscore MACOSX_BUNDLE)
set(MACOSX_BUNDLE_ICON_FILE mscore.icns)
set(MACOSX_BUNDLE_GUI_IDENTIFIER org.musescore.${MUSESCORE_NAME})
set(MACOSX_BUNDLE_BUNDLE_NAME ${MUSESCORE_NAME})
set(MACOSX_BUNDLE_LONG_VERSION_STRING ${MUSESCORE_VERSION_FULL})
set(MACOSX_BUNDLE_SHORT_VERSION_STRING ${MUSESCORE_VERSION})
set(MACOSX_BUNDLE_BUNDLE_VERSION ${MUSESCORE_VERSION_FULL})
set(MACOSX_BUNDLE_COPYRIGHT musescore.org)
else()
message(FATAL_ERROR "Unsopported Platform: ${CMAKE_HOST_SYSTEM_NAME}")
endif()
2012-05-26 14:49:10 +02:00
if (APPLE)
2020-12-08 11:48:52 +01:00
# if(CMAKE_BUILD_NUMBER)
# set (MACOSX_BUNDLE_SHORT_VERSION_STRING ${MUSESCORE_VERSION_FULL}.${CMAKE_BUILD_NUMBER})
# set (MACOSX_BUNDLE_BUNDLE_VERSION ${MUSESCORE_VERSION_FULL}.${CMAKE_BUILD_NUMBER})
# endif(CMAKE_BUILD_NUMBER)
2012-05-26 14:49:10 +02:00
endif (APPLE)
2020-12-08 11:48:52 +01:00
add_executable(${EXECUTABLE_NAME}
${ICON_RES_FILE}
main.cpp
2020-03-12 13:32:43 +01:00
modulessetup.cpp
modulessetup.h
2012-05-26 14:49:10 +02:00
)
2016-06-10 10:37:53 +02:00
# If MSCORE_OUTPUT_NAME is set (e.g, when cmake is called by the user), the output executable will be
# called MSCORE_OUTPUT_NAME instead of 'mscore'. This can be used to have MuseScore stable and unstable
# both installed in the same prefix on a Linux system.
if (MSCORE_OUTPUT_NAME)
2020-12-08 11:48:52 +01:00
set_target_properties(${EXECUTABLE_NAME} PROPERTIES OUTPUT_NAME ${MSCORE_OUTPUT_NAME})
endif (MSCORE_OUTPUT_NAME)
2020-12-08 11:48:52 +01:00
if (PLATFORM_IS_MACOS)
set_target_properties(${EXECUTABLE_NAME} PROPERTIES MACOSX_BUNDLE_INFO_PLIST ${PROJECT_SOURCE_DIR}/build/MacOSXBundleInfo.plist.in)
endif (PLATFORM_IS_MACOS)
set(FREETYPE_LIB )
if (USE_SYSTEM_FREETYPE)
set(FREETYPE_LIB ${FREETYPE_LIBRARIES})
else (USE_SYSTEM_FREETYPE)
set(FREETYPE_LIB mscore_freetype)
endif (USE_SYSTEM_FREETYPE)
set(LINK_LIB
${FREETYPE_LIB}
${QT_LIBRARIES}
global
ui
uicomponents
fonts
system
network
)
if (BUILD_TELEMETRY_MODULE)
set(LINK_LIB ${LINK_LIB} telemetry)
endif(BUILD_TELEMETRY_MODULE)
2020-12-03 08:58:32 +01:00
set(LINK_LIB ${LINK_LIB}
libmscore
2020-12-03 08:58:32 +01:00
actions
appshell
cloud
context
shortcuts
workspace
2020-12-03 16:04:20 +01:00
audio
midi
2020-12-03 08:58:32 +01:00
midi_old
userscores
extensions
languages
importexport
notation
commonscene
palette
inspector
playback
instruments
plugins
)
2020-12-03 08:58:32 +01:00
if (BUILD_VST)
set(LINK_LIB ${LINK_LIB} vst)
endif(BUILD_VST)
2020-12-08 11:48:52 +01:00
add_dependencies(${EXECUTABLE_NAME} workspaces)
2012-05-26 14:49:10 +02:00
2020-12-08 11:48:52 +01:00
target_link_libraries(${EXECUTABLE_NAME} ${LINK_LIB} )
2012-05-26 14:49:10 +02:00
if (MSCORE_OUTPUT_NAME)
2020-12-08 11:48:52 +01:00
set(MSCORE_EXECUTABLE_NAME ${MSCORE_OUTPUT_NAME})
else (MSCORE_OUTPUT_NAME)
2020-12-08 11:48:52 +01:00
set(MSCORE_EXECUTABLE_NAME ${EXECUTABLE_NAME})
endif (MSCORE_OUTPUT_NAME)
2020-12-08 11:48:52 +01:00
set(MSCORE_EXECUTABLE_NAME "${MSCORE_EXECUTABLE_NAME}" PARENT_SCOPE)
2020-12-03 10:31:16 +01:00
##
## Miscellaneous Microsoft Visual Studio settings
##
if (MSVC)
# Force the "install" and "package" targets not to depend on the "all" target.
set(CMAKE_SKIP_INSTALL_ALL_DEPENDENCY true)
set(CMAKE_SKIP_PACKAGE_ALL_DEPENDENCY true)
# Set the startup project to "mscore".
if (NOT ${CMAKE_VERSION} VERSION_LESS "3.6.0")
set_property(DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR} PROPERTY VS_STARTUP_PROJECT mscore)
endif ()
# Set the debugging properties for the "mscore" project.
file(TO_NATIVE_PATH "${CMAKE_INSTALL_PREFIX}/bin" VS_DEBUGGER_WORKING_DIRECTORY)
if (NOT ${CMAKE_VERSION} VERSION_LESS "3.12.0")
2020-12-08 11:48:52 +01:00
set_target_properties(${EXECUTABLE_NAME} PROPERTIES VS_DEBUGGER_COMMAND "${VS_DEBUGGER_WORKING_DIRECTORY}\\${MSCORE_EXECUTABLE_NAME}${CMAKE_EXECUTABLE_SUFFIX}")
2020-12-03 10:31:16 +01:00
endif ()
if (NOT ${CMAKE_VERSION} VERSION_LESS "3.8.0")
2020-12-08 11:48:52 +01:00
set_target_properties(${EXECUTABLE_NAME} PROPERTIES VS_DEBUGGER_WORKING_DIRECTORY "${VS_DEBUGGER_WORKING_DIRECTORY}")
2020-12-03 10:31:16 +01:00
endif ()
if (NOT ${CMAKE_VERSION} VERSION_LESS "3.13.0")
2020-12-08 11:48:52 +01:00
set_target_properties(${EXECUTABLE_NAME} PROPERTIES VS_DEBUGGER_COMMAND_ARGUMENTS "--debug")
2020-12-03 10:31:16 +01:00
endif ()
endif (MSVC)