diff --git a/CMakeLists.txt b/CMakeLists.txt index a4feae7..108f778 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -1,64 +1,70 @@ cmake_minimum_required(VERSION 2.8.12 FATAL_ERROR) project(minuet) set(CMAKE_AUTOMOC ON) # KDE Application Version, managed by release script set (KDE_APPLICATIONS_VERSION_MAJOR "18") set (KDE_APPLICATIONS_VERSION_MINOR "03") set (KDE_APPLICATIONS_VERSION_MICRO "70") #set (KDE_APPLICATIONS_VERSION "${KDE_APPLICATIONS_VERSION_MAJOR}.${KDE_APPLICATIONS_VERSION_MINOR}.${KDE_APPLICATIONS_VERSION_MICRO}") set (KDE_APPLICATIONS_VERSION "0.4.0") set(ECM_MIN_VERSION "5.15.0") set(QT_MIN_VERSION "5.7.0") find_package(ECM ${ECM_MIN_VERSION} CONFIG REQUIRED) -set(CMAKE_MODULE_PATH ${ECM_MODULE_PATH} ${ECM_KDE_MODULE_DIR}) +set(CMAKE_MODULE_PATH ${ECM_MODULE_PATH} ${ECM_KDE_MODULE_DIR} ${minuet_SOURCE_DIR}/cmake) include(GenerateExportHeader) include(ECMSetupVersion) include(ECMInstallIcons) include(ECMAddAppIcon) IF(NOT ${CMAKE_SYSTEM_NAME} MATCHES "Android") include(KDEInstallDirs) include(KDECMakeSettings) ENDIF(NOT ${CMAKE_SYSTEM_NAME} MATCHES "Android") include(FeatureSummary) ecm_setup_version(${KDE_APPLICATIONS_VERSION} VARIABLE_PREFIX MINUET VERSION_HEADER "${CMAKE_CURRENT_BINARY_DIR}/src/app/minuet_version.h" ) find_package(Qt5 ${QT_MIN_VERSION} CONFIG REQUIRED COMPONENTS Core Gui Qml Quick QuickControls2 Svg ) IF(NOT ${CMAKE_SYSTEM_NAME} MATCHES "Android") find_package(KF5 ${KF5_MIN_VERSION} REQUIRED COMPONENTS CoreAddons I18n Crash - DocTools + DocTools ) + +find_package(FluidSynth 1.1.6) +set_package_properties(FluidSynth PROPERTIES + TYPE OPTIONAL + PURPOSE "Needed if you want to build the fluidsynth sound controller" +) ENDIF(NOT ${CMAKE_SYSTEM_NAME} MATCHES "Android") feature_summary(WHAT ALL INCLUDE_QUIET_PACKAGES FATAL_ON_MISSING_REQUIRED_PACKAGES) include_directories(${minuet_SOURCE_DIR}/src/ ${minuet_BINARY_DIR}/src/) add_subdirectory(src) add_subdirectory(data) IF(NOT ${CMAKE_SYSTEM_NAME} MATCHES "Android") add_subdirectory(doc) ENDIF(NOT ${CMAKE_SYSTEM_NAME} MATCHES "Android") IF(NOT ${CMAKE_SYSTEM_NAME} MATCHES "Android") install(FILES org.kde.minuet.appdata.xml DESTINATION ${KDE_INSTALL_METAINFODIR}) ENDIF(NOT ${CMAKE_SYSTEM_NAME} MATCHES "Android") diff --git a/cmake/FindFluidSynth.cmake b/cmake/FindFluidSynth.cmake new file mode 100644 index 0000000..a8d6078 --- /dev/null +++ b/cmake/FindFluidSynth.cmake @@ -0,0 +1,105 @@ +#.rst: +# FindFluidSynth +# --------- +# +# Try to find the FluidSynth library. +# +# This will define the following variables: +# +# ``FluidSynth_FOUND`` +# System has FluidSynth. +# +# ``FluidSynth_VERSION`` +# The version of FluidSynth. +# +# ``FluidSynth_INCLUDE_DIRS`` +# This should be passed to target_include_directories() if +# the target is not used for linking. +# +# ``FluidSynth_LIBRARIES`` +# The FluidSynth library. +# This can be passed to target_link_libraries() instead of +# the ``FluidSynth::FluidSynth`` target +# +# If ``FluidSynth_FOUND`` is TRUE, the following imported target +# will be available: +# +# ``FluidSynth::FluidSynth`` +# The FluidSynth library +# +#============================================================================= +# Copyright 2018 Christophe Giboudeaux +# +# +# Redistribution and use in source and binary forms, with or without +# modification, are permitted provided that the following conditions +# are met: +# +# 1. Redistributions of source code must retain the copyright +# notice, this list of conditions and the following disclaimer. +# 2. Redistributions in binary form must reproduce the copyright +# notice, this list of conditions and the following disclaimer in the +# documentation and/or other materials provided with the distribution. +# 3. The name of the author may not be used to endorse or promote products +# derived from this software without specific prior written permission. +# +# THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR +# IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES +# OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. +# IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, +# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT +# NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF +# THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +#============================================================================= + +if(NOT ${FluidSynth_FIND_VERSION}) + set(FluidSynth_FIND_VERSION "1.1.6") +endif() + +find_package(PkgConfig QUIET) +pkg_check_modules(PC_FluidSynth QUIET fluidsynth>=${FluidSynth_FIND_VERSION}) + +find_library(FluidSynth_LIBRARIES + NAMES fluidsynth + HINTS ${PC_FluidSynth_LIBDIR} +) + +find_path(FluidSynth_INCLUDE_DIRS + NAMES fluidsynth.h + HINTS ${PC_FluidSynth_INCLUDEDIR} +) + +#set(FluidSynth_VERSION "${PC_FluidSynth_VERSION}") + +if(NOT FluidSynth_VERSION) + if(EXISTS "${FluidSynth_INCLUDE_DIRS}/fluidsynth/version.h") + file(STRINGS "${FluidSynth_INCLUDE_DIRS}/fluidsynth/version.h" _FLUIDSYNTH_VERSION_H + REGEX "^#define[ ]+FLUIDSYNTH_VERSION[ ]+\"[0-9].[0-9].[0-9]\"") + string(REGEX REPLACE "^#define[ ]+FLUIDSYNTH_VERSION[ ]+\"([0-9].[0-9].[0-9])\".*" "\\1" FluidSynth_VERSION "${_FLUIDSYNTH_VERSION_H}") + unset(_FLUIDSYNTH_VERSION_H) + endif() +endif() + +include(FindPackageHandleStandardArgs) +find_package_handle_standard_args(FluidSynth + FOUND_VAR FluidSynth_FOUND + REQUIRED_VARS FluidSynth_LIBRARIES FluidSynth_INCLUDE_DIRS + VERSION_VAR FluidSynth_VERSION +) + +if(FluidSynth_FOUND AND NOT TARGET FluidSynth::FluidSynth) + add_library(FluidSynth::FluidSynth UNKNOWN IMPORTED) + set_target_properties(FluidSynth::FluidSynth PROPERTIES + IMPORTED_LOCATION "${FluidSynth_LIBRARIES}" + INTERFACE_INCLUDE_DIRECTORIES "${FluidSynth_INCLUDE_DIRS}" + ) +endif() + +include(FeatureSummary) +set_package_properties(FluidSynth PROPERTIES + URL "http://www.fluidsynth.org/" + DESCRIPTION "A SoundFont Synthesizer" +) diff --git a/src/plugins/CMakeLists.txt b/src/plugins/CMakeLists.txt index 75e115b..201a48b 100644 --- a/src/plugins/CMakeLists.txt +++ b/src/plugins/CMakeLists.txt @@ -1,30 +1,5 @@ -IF(NOT ${CMAKE_SYSTEM_NAME} MATCHES "Android") - find_package(PkgConfig REQUIRED) - if(PKG_CONFIG_FOUND) - message(STATUS "Program pkg-config found (${PKG_CONFIG_EXECUTABLE})") - else() - message(FATAL_ERROR "Program pkg-config not found") - endif() - - pkg_check_modules(PC_FLUIDSYNTH REQUIRED fluidsynth>=1.1.6) - - if(NOT PC_FLUIDSYNTH_FOUND) - message(WARNING "Please install fluidsynth libraries and headers (package fluidsynth) if you want to build fluidsynth soundcontroller") - endif() - - if(PC_FLUIDSYNTH_FOUND) - find_library(FLUIDSYNTH_LIBRARIES - NAMES fluidsynth - HINTS ${PC_FLUIDSYNTH_LIBDIR} - ) - find_path(FLUIDSYNTH_INCLUDE_DIRS - NAMES fluidsynth.h - HINTS ${PC_FLUIDSYNTH_INCLUDEDIR} - ) - - add_subdirectory(fluidsynthsoundcontroller) - endif() -ENDIF(NOT ${CMAKE_SYSTEM_NAME} MATCHES "Android") -IF(${CMAKE_SYSTEM_NAME} MATCHES "Android") +if(NOT ${CMAKE_SYSTEM_NAME} MATCHES "Android" AND FluidSynth_FOUND) + add_subdirectory(fluidsynthsoundcontroller) +else() add_subdirectory(csoundsoundcontroller) -ENDIF(${CMAKE_SYSTEM_NAME} MATCHES "Android") +endif() diff --git a/src/plugins/fluidsynthsoundcontroller/CMakeLists.txt b/src/plugins/fluidsynthsoundcontroller/CMakeLists.txt index 84370a2..2263789 100644 --- a/src/plugins/fluidsynthsoundcontroller/CMakeLists.txt +++ b/src/plugins/fluidsynthsoundcontroller/CMakeLists.txt @@ -1,18 +1,16 @@ -include_directories(${FLUIDSYNTH_INCLUDE_DIRS}) - set(fluidsynthsoundcontroller_PLUGIN_SRCS fluidsynthsoundcontroller.cpp ) add_library(minuetfluidsynthsoundcontroller MODULE ${fluidsynthsoundcontroller_PLUGIN_SRCS}) target_link_libraries(minuetfluidsynthsoundcontroller Qt5::Core Minuet::Interfaces - ${FLUIDSYNTH_LIBRARIES} + FluidSynth::FluidSynth ) IF(NOT ${CMAKE_SYSTEM_NAME} MATCHES "Android") install(TARGETS minuetfluidsynthsoundcontroller DESTINATION ${PLUGIN_INSTALL_DIR}/minuet/) install(FILES GeneralUser-v1.47.sf2 DESTINATION ${KDE_INSTALL_DATADIR}/minuet/soundfonts) ENDIF(NOT ${CMAKE_SYSTEM_NAME} MATCHES "Android")