2020-04-25 18:50:24 +02:00
|
|
|
#=============================================================================
|
|
|
|
# MuseScore
|
|
|
|
# Music Composition & Notation
|
|
|
|
#
|
|
|
|
# Copyright (C) 2020 MuseScore BVBA 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.
|
|
|
|
#=============================================================================
|
|
|
|
|
|
|
|
## Setup
|
2020-04-25 18:50:24 +02:00
|
|
|
# set(MODULE somename) - set module (target) name
|
|
|
|
# set(MODULE_INCLUDE ...) - set include (by default see below include_directories)
|
2020-07-13 12:23:31 +02:00
|
|
|
# set(MODULE_DEF ...) - set definitions
|
2020-04-25 18:50:24 +02:00
|
|
|
# set(MODULE_SRC ...) - set sources and headers files
|
|
|
|
# set(MODULE_LINK ...) - set libraries for link
|
|
|
|
# set(MODULE_QRC somename.qrc) - set resource (qrc) file
|
2020-07-03 15:11:55 +02:00
|
|
|
# set(MODULE_UI ...) - set ui headers
|
2020-04-25 18:50:24 +02:00
|
|
|
# set(MODULE_QML_IMPORT ...) - set Qml import for QtCreator (so that there is code highlighting, jump, etc.)
|
2020-12-14 12:01:53 +01:00
|
|
|
# set(MODULE_USE_PCH_NONE ON) - set for disable PCH for module
|
2020-12-15 14:56:47 +01:00
|
|
|
# set(MODULE_USE_UNITY_NONE ON) - set for disable UNITY BUILD for module
|
2020-12-11 22:31:16 +01:00
|
|
|
|
2020-04-25 18:50:24 +02:00
|
|
|
|
|
|
|
# After all the settings you need to do:
|
2020-04-25 18:50:24 +02:00
|
|
|
# include(${PROJECT_SOURCE_DIR}/build/module.cmake)
|
|
|
|
|
|
|
|
message(STATUS "Configuring " ${MODULE})
|
|
|
|
|
2020-08-31 14:16:44 +02:00
|
|
|
if (MODULE_QRC)
|
2020-04-25 18:50:24 +02:00
|
|
|
qt5_add_resources(RCC_SOURCES ${MODULE_QRC})
|
|
|
|
endif()
|
|
|
|
|
2020-07-03 15:11:55 +02:00
|
|
|
if (MODULE_UI)
|
|
|
|
find_package(Qt5Widgets)
|
|
|
|
QT5_WRAP_UI(ui_headers ${MODULE_UI} )
|
|
|
|
endif()
|
|
|
|
|
2020-04-25 18:50:24 +02:00
|
|
|
if (NOT ${MODULE_QML_IMPORT} STREQUAL "")
|
|
|
|
set(QML_IMPORT_PATH "${QML_IMPORT_PATH};${MODULE_QML_IMPORT}" CACHE STRING "QtCreator extra import paths for QML modules" FORCE)
|
|
|
|
endif()
|
|
|
|
|
2020-12-21 15:57:14 +01:00
|
|
|
if (CC_IS_EMSCRIPTEN)
|
|
|
|
add_library(${MODULE} OBJECT)
|
|
|
|
else()
|
|
|
|
add_library(${MODULE}) # STATIC/SHARED set global in the SetupBuildEnvironment.cmake
|
|
|
|
endif()
|
2020-12-06 19:59:16 +01:00
|
|
|
|
2020-12-10 14:36:15 +01:00
|
|
|
if (BUILD_SHARED_LIBS)
|
|
|
|
install(TARGETS ${MODULE} DESTINATION ${SHARED_LIBS_INSTALL_DESTINATION})
|
2020-12-07 16:04:00 +01:00
|
|
|
|
|
|
|
if (NOT MSVC)
|
|
|
|
set_target_properties(${MODULE} PROPERTIES COMPILE_FLAGS "-fPIC")
|
|
|
|
endif (NOT MSVC)
|
2020-12-06 19:59:16 +01:00
|
|
|
endif()
|
|
|
|
|
2020-12-14 12:01:53 +01:00
|
|
|
if (BUILD_PCH)
|
|
|
|
if (MODULE_USE_PCH_NONE)
|
2020-12-15 14:56:47 +01:00
|
|
|
# disabled pch for current module
|
2020-12-11 22:31:16 +01:00
|
|
|
else()
|
2020-12-14 12:01:53 +01:00
|
|
|
if(NOT ${MODULE} MATCHES global)
|
|
|
|
target_precompile_headers(${MODULE} REUSE_FROM global)
|
|
|
|
target_compile_definitions(${MODULE} PRIVATE global_EXPORTS=1)
|
|
|
|
else()
|
|
|
|
target_precompile_headers(${MODULE} PRIVATE ${PROJECT_SOURCE_DIR}/build/pch/pch.h)
|
|
|
|
endif()
|
2020-12-11 22:31:16 +01:00
|
|
|
endif()
|
2020-12-14 12:01:53 +01:00
|
|
|
endif(BUILD_PCH)
|
2020-12-11 22:31:16 +01:00
|
|
|
|
2020-12-15 14:56:47 +01:00
|
|
|
if (BUILD_UNITY)
|
|
|
|
if (MODULE_USE_UNITY_NONE)
|
|
|
|
# disabled unity build for current module
|
|
|
|
else()
|
|
|
|
set_target_properties(${MODULE} PROPERTIES UNITY_BUILD ON)
|
|
|
|
endif()
|
|
|
|
endif(BUILD_UNITY)
|
|
|
|
|
2020-12-06 19:59:16 +01:00
|
|
|
target_sources(${MODULE} PRIVATE
|
2020-07-03 15:11:55 +02:00
|
|
|
${ui_headers}
|
2020-04-25 18:50:24 +02:00
|
|
|
${RCC_SOURCES}
|
|
|
|
${MODULE_SRC}
|
2020-12-06 19:59:16 +01:00
|
|
|
)
|
2020-04-25 18:50:24 +02:00
|
|
|
|
2020-07-13 12:23:31 +02:00
|
|
|
target_include_directories(${MODULE} PUBLIC
|
|
|
|
${PROJECT_BINARY_DIR}
|
|
|
|
${CMAKE_CURRENT_BINARY_DIR}
|
|
|
|
${PROJECT_SOURCE_DIR}
|
2020-12-03 10:31:16 +01:00
|
|
|
${PROJECT_SOURCE_DIR}/src/framework
|
|
|
|
${PROJECT_SOURCE_DIR}/src/framework/global
|
|
|
|
${PROJECT_SOURCE_DIR}/src
|
2020-07-13 12:23:31 +02:00
|
|
|
${MODULE_INCLUDE}
|
|
|
|
)
|
|
|
|
|
|
|
|
target_compile_definitions(${MODULE} PUBLIC
|
|
|
|
${MODULE_DEF}
|
2020-09-01 17:27:52 +02:00
|
|
|
${MODULE}_QML_IMPORT="${MODULE_QML_IMPORT}"
|
2020-07-13 12:23:31 +02:00
|
|
|
)
|
|
|
|
|
2020-08-31 14:16:44 +02:00
|
|
|
if(NOT ${MODULE} MATCHES global)
|
2020-04-25 18:50:24 +02:00
|
|
|
set(MODULE_LINK global ${MODULE_LINK})
|
|
|
|
endif()
|
|
|
|
|
2020-08-31 14:16:44 +02:00
|
|
|
set(MODULE_LINK ${QT_LIBRARIES} ${MODULE_LINK})
|
|
|
|
|
2020-12-06 19:59:16 +01:00
|
|
|
target_link_libraries(${MODULE} PRIVATE ${MODULE_LINK} )
|