-
Notifications
You must be signed in to change notification settings - Fork 96
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add CMake (and make it "recommended")
Co-authored-by: Rossmaxx <[email protected]> Co-authored-by: Erick G. Islas-Osuna <[email protected]>
- Loading branch information
1 parent
57dbf5b
commit 37a238e
Showing
28 changed files
with
928 additions
and
5 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -35,3 +35,5 @@ dist/* | |
.cproject | ||
.project | ||
compile | ||
!config.h.cmake.in | ||
build/ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,214 @@ | ||
cmake_minimum_required(VERSION 3.15) | ||
|
||
project(calf) | ||
string(TOUPPER "${CMAKE_PROJECT_NAME}" PROJECT_NAME_UCASE) | ||
|
||
set(PROJECT_YEAR 2023) | ||
set(PROJECT_AUTHOR "CALF Developers") | ||
set(PROJECT_URL "https://calf-studio-gear.org/") | ||
set(PROJECT_DESCRIPTION "${CMAKE_PROJECT_NAME} Studio Gear") | ||
set(PROJECT_COPYRIGHT "2007-${PROJECT_YEAR} ${PROJECT_AUTHOR}") | ||
set(VERSION_MAJOR "0") | ||
set(VERSION_MINOR "90") | ||
set(VERSION_RELEASE "4") | ||
set(VERSION_STAGE "alpha") | ||
set(VERSION_BUILD "") | ||
set(VERSION "${VERSION_MAJOR}.${VERSION_MINOR}.${VERSION_RELEASE}") | ||
|
||
# | ||
# Options | ||
# | ||
|
||
option(WANT_GUI "Include Graphical User Interface" ON) | ||
option(WANT_JACK "Include JACK (Jack Audio Connection Kit) support" ON) | ||
option(WANT_LASH "Include LASH (LASH Audio Session Handler) support" ON) | ||
option(WANT_DEBUG "Create debug build" OFF) | ||
option(WANT_LV2 "Build Lv2 wrapper" ON) | ||
option(WANT_LV2_GUI "GUI executable will be used for LV2" ON) | ||
option(WANT_SORDI "Use the sordi tool to check Lv2 files" ON) | ||
option(WANT_EXPERIMENTAL "Enable experimental effects" OFF) | ||
|
||
# | ||
# Configuration | ||
# | ||
|
||
SET(CMAKE_MODULE_PATH "${CMAKE_SOURCE_DIR}/cmake" ${CMAKE_MODULE_PATH}) | ||
|
||
find_package(PkgConfig REQUIRED) | ||
find_package(EXPAT REQUIRED) | ||
|
||
if(WANT_GUI) | ||
if(PKG_CONFIG_FOUND) | ||
pkg_check_modules(GTK gtk+-2.0>=2.12.0 cairo>=1.2.0) | ||
endif() | ||
find_package(FluidSynth REQUIRED) | ||
if(GTK_FOUND AND FluidSynth_FOUND) | ||
include_directories(${GTK_INCLUDE_DIRS}) | ||
set(USE_GUI TRUE) | ||
set(STATUS_GUI "OK") | ||
elseif(NOT GTK_FOUND) | ||
set(STATUS_GUI "not found - (GTK+ 2.12 and cairo 1.2 or newer required)") | ||
elseif(NOT FluidSynth_FOUND) | ||
set(STATUS_GUI "not found - (FLUIDSYNTH required)") | ||
endif() | ||
else() | ||
set(STATUS_GUI "not built as requested") | ||
endif() | ||
|
||
if(WANT_JACK) | ||
if(PKG_CONFIG_FOUND) | ||
pkg_check_modules(JACK jack>=0.77) | ||
endif() | ||
if(JACK_FOUND) | ||
set(USE_JACK TRUE) | ||
if(JACK_VERSION VERSION_GREATER_EQUAL "0.105.0") | ||
set(OLD_JACK FALSE) | ||
else() | ||
set(OLD_JACK TRUE) | ||
endif() | ||
if(JACK_VERSION VERSION_GREATER_EQUAL "0.124.0") | ||
set(JACK_HAS_RENAME TRUE) | ||
else() | ||
set(JACK_HAS_RENAME FALSE) | ||
endif() | ||
set(STATUS_JACK "OK") | ||
else() | ||
set(STATUS_JACK "not found, install it or set PKG_CONFIG_PATH appropriately") | ||
endif() | ||
else() | ||
set(STATUS_JACK "not built as requested") | ||
endif() | ||
|
||
if(WANT_LASH) | ||
if(PKG_CONFIG_FOUND) | ||
pkg_search_module(LASH lash-1.0) | ||
endif() | ||
if(LASH_FOUND) | ||
include_directories(${LASH_INCLUDE_DIRS}) | ||
add_definitions(-DLASH=1) | ||
list(APPEND AUDIO_LIBRARIES ${LASH_LIBRARIES}) | ||
list(APPEND AUDIO_LIBRARY_DIRS ${LASH_LIBRARY_DIRS}) | ||
|
||
if(LASH_VERSION VERSION_GREATER_EQUAL "0.6") | ||
set(USE_LASH_0_6 TRUE) | ||
else() | ||
set(USE_LASH_0_6 FALSE) | ||
endif() | ||
set(STATUS_LASH "OK") | ||
else() | ||
set(STATUS_LASH "not found, install it or set PKG_CONFIG_PATH appropriately") | ||
endif() | ||
# mark_as_advanced(LASH_LIBRARIES) | ||
else() | ||
set(STATUS_LASH "not built as requested") | ||
endif() | ||
|
||
if(WANT_LV2) | ||
if(PKG_CONFIG_FOUND) | ||
pkg_check_modules(LV2 lv2) | ||
endif() | ||
if(NOT LV2_FOUND) | ||
unset(LV2_FOUND CACHE) | ||
find_package(LV2 CONFIG) | ||
endif() | ||
if(LV2_FOUND) | ||
set(USE_LV2 TRUE) | ||
set(STATUS_LV2 "OK") | ||
else() | ||
set(STATUS_LV2 "not found, install it or set PKG_CONFIG_PATH appropriately") | ||
endif() | ||
else() | ||
set(STATUS_LV2 "not built, as requested") | ||
endif() | ||
|
||
if(WANT_LV2_GUI) | ||
if(USE_LV2 AND USE_GUI) | ||
set(USE_LV2_GUI TRUE) | ||
set(STATUS_LV2_GUI "OK") | ||
elseif(USE_LV2 AND NOT USE_GUI) | ||
set(STATUS_LV2_GUI "not build, because no GUI support") | ||
elseif(NOT USE_LV2 AND USE_GUI) | ||
set(STATUS_LV2_GUI "not build, because no Lv2 support") | ||
else(NOT USE_LV2 AND USE_GUI) | ||
set(STATUS_LV2_GUI "not build, because no GUI and no Lv2 support") | ||
endif() | ||
else() | ||
set(STATUS_LV2_GUI "not built, as requested") | ||
endif() | ||
|
||
if(WANT_SORDI) | ||
find_program(SORDI NAMES sordi) | ||
if(SORDI) | ||
set(USE_SORDI TRUE) | ||
set(STATUS_SORDI "OK") | ||
else() | ||
set(STATUS_SORDI "not found") | ||
endif() | ||
else() | ||
set(STATUS_LV2_SORDI "not run, as requested") | ||
endif() | ||
|
||
if(WANT_EXPERIMENTAL) | ||
set(STATUS_EXPERIMENTAL "OK") | ||
set(ENABLE_EXPERIMENTAL TRUE) | ||
else() | ||
set(STATUS_EXPERIMENTAL "not built, as requested") | ||
endif() | ||
|
||
configure_file(config.h.cmake.in config.h) | ||
include_directories(${CMAKE_BINARY_DIR}) | ||
|
||
# | ||
# Compile & Install | ||
# | ||
|
||
add_subdirectory(src) | ||
add_subdirectory(gui) | ||
add_subdirectory(icons) | ||
|
||
# | ||
# Install targets (except src) | ||
# | ||
|
||
install(DIRECTORY ${CMAKE_SOURCE_DIR}/doc/manuals/ | ||
DESTINATION share/doc/${PROJECT_NAME} FILES_MATCHING PATTERN "*.html") | ||
install(DIRECTORY ${CMAKE_SOURCE_DIR}/doc/manuals/images/ | ||
DESTINATION share/doc/${PROJECT_NAME}/images FILES_MATCHING PATTERN "*.png") | ||
install(DIRECTORY ${CMAKE_SOURCE_DIR}/doc/manuals/images/ | ||
DESTINATION share/doc/${PROJECT_NAME}/images FILES_MATCHING PATTERN "*.jpg") | ||
install(DIRECTORY ${CMAKE_SOURCE_DIR}/doc/manuals/images/prettyPhoto/dark_rounded/ | ||
DESTINATION share/doc/${PROJECT_NAME}/images/prettyPhoto/dark_rounded) | ||
install(DIRECTORY ${CMAKE_SOURCE_DIR}/doc/manuals/images/icons/ | ||
DESTINATION share/doc/${PROJECT_NAME}/images/icons) | ||
install(DIRECTORY ${CMAKE_SOURCE_DIR}/doc/manuals/scripts | ||
DESTINATION share/doc/${PROJECT_NAME} FILES_MATCHING PATTERN "*.css") | ||
install(DIRECTORY ${CMAKE_SOURCE_DIR}/doc/manuals/scripts/ | ||
DESTINATION share/doc/${PROJECT_NAME}/scripts FILES_MATCHING PATTERN "*.js") | ||
install(DIRECTORY ${CMAKE_SOURCE_DIR}/sf2/ | ||
DESTINATION share/${PROJECT_NAME}/sf2 FILES_MATCHING PATTERN "*.sf2") | ||
|
||
# | ||
# Status | ||
# | ||
|
||
message( | ||
"\n" | ||
"Summary\n" | ||
"-------\n" | ||
"* Build product : ${PROJECT_NAME} ${VERSION}\n") | ||
if(CMAKE_BUILD_TYPE) | ||
message("* Build type : ${CMAKE_BUILD_TYPE}\n") | ||
endif() | ||
message( | ||
"* Install Prefix : ${CMAKE_INSTALL_PREFIX}\n" | ||
"* Jack : ${STATUS_JACK}\n" | ||
"* LASH : ${STATUS_LASH}\n" | ||
"* GUI : ${STATUS_GUI}\n" | ||
"* LV2 : ${STATUS_LV2}\n" | ||
"* LV2 GUI : ${STATUS_LV2_GUI}\n" | ||
"* Sordi sanity checks : ${STATUS_SORDI}\n" | ||
"* Experimental plugins : ${STATUS_EXPERIMENTAL}\n" | ||
) | ||
|
||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
# CMake install instructions | ||
|
||
## Requirements | ||
|
||
All: fluidsynth and its development packages | ||
Windows: vcpkg (reommended) | ||
|
||
## Build | ||
|
||
Note: This is mostly a copy of `.github/workflows/`. If in doubt, | ||
look there. | ||
|
||
### Linux or MacOS | ||
|
||
```sh | ||
mkdir build && cd $_ | ||
cmake .. | ||
make | ||
make install | ||
``` | ||
|
||
The typical `cmake` options apply, e.g. | ||
|
||
```sh | ||
cmake -DCMAKE_INSTALL_PREFIX=$PWD/../install .. | ||
cmake -DCMAKE_BUILD_TYPE=Debug .. | ||
``` | ||
|
||
### Windows | ||
|
||
``` | ||
cmake -DCMAKE_TOOLCHAIN_FILE=C:/vcpkg/scripts/buildsystems/vcpkg.cmake . | ||
cmake --build . | ||
``` | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
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. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,73 @@ | ||
# Copyright (c) 2022 Dominic Clark | ||
# | ||
# Redistribution and use is allowed according to the terms of the New BSD license. | ||
# For details see the accompanying COPYING-CMAKE-SCRIPTS file. | ||
|
||
# Return if we already have FluidSynth | ||
if(TARGET fluidsynth) | ||
set(FluidSynth_FOUND 1) | ||
return() | ||
endif() | ||
|
||
# Attempt to find FluidSynth using PkgConfig | ||
find_package(PkgConfig QUIET) | ||
if(PKG_CONFIG_FOUND) | ||
pkg_check_modules(FLUIDSYNTH_PKG fluidsynth) | ||
endif() | ||
|
||
# Find the library and headers using the results from PkgConfig as a guide | ||
find_path(FluidSynth_INCLUDE_DIRS | ||
NAMES "fluidsynth.h" | ||
HINTS ${FLUIDSYNTH_PKG_INCLUDE_DIRS} | ||
) | ||
|
||
find_library(FluidSynth_LIBRARY | ||
NAMES "fluidsynth" | ||
HINTS ${FLUIDSYNTH_PKG_LIBRARY_DIRS} | ||
) | ||
|
||
if(FluidSynth_INCLUDE_DIRS AND FluidSynth_LIBRARY) | ||
add_library(fluidsynth UNKNOWN IMPORTED) | ||
set_target_properties(fluidsynth PROPERTIES | ||
INTERFACE_INCLUDE_DIRECTORIES "${FluidSynth_INCLUDE_DIRS}" | ||
) | ||
|
||
if(VCPKG_INSTALLED_DIR) | ||
include(ImportedTargetHelpers) | ||
get_vcpkg_library_configs(FluidSynth_IMPLIB_RELEASE FluidSynth_IMPLIB_DEBUG "${FluidSynth_LIBRARY}") | ||
else() | ||
set(FluidSynth_IMPLIB_RELEASE "${FluidSynth_LIBRARY}") | ||
endif() | ||
|
||
if(FluidSynth_IMPLIB_DEBUG) | ||
set_target_properties(fluidsynth PROPERTIES | ||
IMPORTED_LOCATION_RELEASE "${FluidSynth_IMPLIB_RELEASE}" | ||
IMPORTED_LOCATION_DEBUG "${FluidSynth_IMPLIB_DEBUG}" | ||
) | ||
else() | ||
set_target_properties(fluidsynth PROPERTIES | ||
IMPORTED_LOCATION "${FluidSynth_IMPLIB_RELEASE}" | ||
) | ||
endif() | ||
|
||
if(EXISTS "${FluidSynth_INCLUDE_DIRS}/fluidsynth/version.h") | ||
file(STRINGS | ||
"${FluidSynth_INCLUDE_DIRS}/fluidsynth/version.h" | ||
_version_string | ||
REGEX "^#[\t ]*define[\t ]+FLUIDSYNTH_VERSION[\t ]+\".*\"" | ||
) | ||
string(REGEX REPLACE | ||
"^.*FLUIDSYNTH_VERSION[\t ]+\"([^\"]*)\".*$" | ||
"\\1" | ||
FluidSynth_VERSION_STRING | ||
"${_version_string}" | ||
) | ||
unset(_version_string) | ||
endif() | ||
endif() | ||
|
||
include(FindPackageHandleStandardArgs) | ||
find_package_handle_standard_args(FluidSynth | ||
REQUIRED_VARS FluidSynth_LIBRARY FluidSynth_INCLUDE_DIRS | ||
VERSION_VAR FluidSynth_VERSION_STRING | ||
) |
Oops, something went wrong.