CMake definitions and format rearrangement

- Rename some SFIZZ_ prefixed definitions where possible to permit some modules
  to be generic and be reused in other projects, keep project' information
  in the same place and more explicit
- Fixed non-compliant code formatting
This commit is contained in:
redtide 2023-05-20 12:37:22 +02:00
parent 9d59e18472
commit 6878125b92
No known key found for this signature in database
8 changed files with 79 additions and 72 deletions

View file

@ -308,7 +308,7 @@ jobs:
-D CMAKE_BUILD_TYPE=${{ env.build_type }}
-D CMAKE_CXX_STANDARD=17
-D ENABLE_LTO=OFF
-D SFIZZ_STATIC_DEPENDENCIES=ON
-D SFIZZ_SNDFILE_STATIC=ON
-D SFIZZ_JACK=OFF
)
${{ matrix.platform }}-w64-mingw32-cmake "${options[@]}"

View file

@ -8,8 +8,12 @@ else()
endif()
endif()
project (libsfizz VERSION 1.2.2 LANGUAGES CXX C)
project(libsfizz
LANGUAGES CXX C
VERSION 1.2.2
)
set(PROJECT_DESCRIPTION "A library to load SFZ description files and use them to render music.")
set(PROJECT_REPOSITORY https://github.com/sfztools/sfizz)
# External configuration CMake scripts
set(CMAKE_MODULE_PATH "${CMAKE_MODULE_PATH};${CMAKE_CURRENT_SOURCE_DIR}/cmake")
@ -37,12 +41,12 @@ option_ex (SFIZZ_USE_SYSTEM_KISS_FFT "Use KISS FFT libraries preinstalled on sys
option_ex(SFIZZ_USE_SYSTEM_PUGIXML "Use pugixml libraries preinstalled on system" OFF)
option_ex(SFIZZ_USE_SYSTEM_CXXOPTS "Use CXXOPTS libraries preinstalled on system" OFF)
option_ex(SFIZZ_USE_SYSTEM_CATCH "Use Catch libraries preinstalled on system" OFF)
option_ex (SFIZZ_STATIC_DEPENDENCIES "Link dependencies statically" OFF)
option_ex(SFIZZ_RELEASE_ASSERTS "Forced assertions in release builds" OFF)
option_ex(SFIZZ_PROFILE_BUILD "Profile the build time" OFF)
option_ex(SFIZZ_SNDFILE_STATIC "Link the sndfile library statically" OFF)
# The fixed number of controller parameters
set(MIDI_CC_MAX 512 CACHE STRING "Maximum amount of Control Change Messages")
# Continuous Controller count (0 to 511)
set(MIDI_CC_COUNT 512 CACHE STRING "Maximum number of managed Control Change messages")
include(SfizzConfig)
include(SfizzDeps)

View file

@ -32,6 +32,6 @@ Quit
.SH SEE ALSO
sfizz_render(1)
.SH BUGS
See the main repository at @SFIZZ_REPOSITORY@.
See the main repository at @PROJECT_REPOSITORY@.
.SH AUTHOR
Contributors can be seen on the main repository at @SFIZZ_REPOSITORY@.
Contributors can be seen on the main repository at @PROJECT_REPOSITORY@.

View file

@ -25,6 +25,6 @@ Show help
.SH SEE ALSO
sfizz_jack(1)
.SH BUGS
See the main repository at @SFIZZ_REPOSITORY@.
See the main repository at @PROJECT_REPOSITORY@.
.SH AUTHOR
Contributors can be seen on the main repository at @SFIZZ_REPOSITORY@.
Contributors can be seen on the main repository at @PROJECT_REPOSITORY@.

View file

@ -123,13 +123,10 @@ if(USE_LIBCPP)
add_link_options(-lc++abi) # New command on CMake master, not in 3.12 release
endif()
set(SFIZZ_REPOSITORY https://github.com/sfztools/sfizz)
include(GNUInstallDirs)
if(PROJECT_SOURCE_DIR STREQUAL CMAKE_SOURCE_DIR)
set(PROJECT_IS_MAIN TRUE)
else()
set(PROJECT_IS_MAIN FALSE)
endif()
# Don't show build information when building a different project
@ -137,7 +134,7 @@ function(show_build_info_if_needed)
if(PROJECT_IS_MAIN)
message(STATUS "
Project name: ${PROJECT_NAME}
CMAKE_CXX_STANDARD: ${CMAKE_CXX_STANDARD}
C++ standard version: ${CMAKE_CXX_STANDARD}
Build type: ${CMAKE_BUILD_TYPE}
Build processor: ${PROJECT_SYSTEM_PROCESSOR}
Build using LTO: ${ENABLE_LTO}
@ -148,9 +145,11 @@ Build benchmarks: ${SFIZZ_BENCHMARKS}
Build tests: ${SFIZZ_TESTS}
Build demos: ${SFIZZ_DEMOS}
Build devtools: ${SFIZZ_DEVTOOLS}
Use sndfile: ${SFIZZ_USE_SNDFILE}
Statically link sndfile: ${SFIZZ_SNDFILE_STATIC}
Use vcpkg: ${SFIZZ_USE_VCPKG}
Statically link dependencies: ${SFIZZ_STATIC_DEPENDENCIES}
Use clang libc++: ${USE_LIBCPP}
Release asserts: ${SFIZZ_RELEASE_ASSERTS}
@ -163,24 +162,28 @@ Use system pugixml: ${SFIZZ_USE_SYSTEM_PUGIXML}
Use system simde: ${SFIZZ_USE_SYSTEM_SIMDE}")
if(CMAKE_PROJECT_NAME STREQUAL "sfizz")
message(STATUS "
Build AU plug-in: ${SFIZZ_AU}
Build LV2 plug-in: ${SFIZZ_LV2}
Build LV2 user interface: ${SFIZZ_LV2_UI}
Build VST plug-in: ${SFIZZ_VST}
Use system lv2: ${SFIZZ_USE_SYSTEM_LV2}
Use system vst3sdk sources: ${SFIZZ_USE_SYSTEM_VST3SDK}
LV2 plugin-side CC automation ${SFIZZ_LV2_PSA}
Build AU plug-in: ${PLUGIN_AU}
Build LV2 plug-in: ${PLUGIN_LV2}
Build LV2 user interface: ${PLUGIN_LV2_UI}
LV2 plugin-side CC automation ${PLUGIN_LV2_PSA}
Build Pure Data plug-in: ${PLUGIN_PUREDATA}
Build VST plug-in: ${PLUGIN_VST}
AU destination directory: ${AU_PLUGIN_INSTALL_DIR}
LV2 destination directory: ${LV2PLUGIN_INSTALL_DIR}
Pd destination directory: ${PD_PLUGIN_INSTALL_DIR}
VST destination directory: ${VSTPLUGIN_INSTALL_DIR}")
endif()
message(STATUS "
Install prefix: ${CMAKE_INSTALL_PREFIX}
Compiler CXX debug flags: ${CMAKE_CXX_FLAGS_DEBUG}
Compiler CXX release flags: ${CMAKE_CXX_FLAGS_RELEASE}
Compiler CXX min size flags: ${CMAKE_CXX_FLAGS_MINSIZEREL}
CXX Debug flags: ${CMAKE_CXX_FLAGS_DEBUG}
CXX Release flags: ${CMAKE_CXX_FLAGS_RELEASE}
CXX MinSize flags: ${CMAKE_CXX_FLAGS_MINSIZEREL}
CXX RelWithDebInfo flags: ${CMAKE_CXX_FLAGS_RELWITHDEBINFO}
")
endif()
endfunction()

View file

@ -26,8 +26,8 @@ if(OPENMP_FOUND)
$<$<COMPILE_LANGUAGE:CXX>:${SFIZZ_OpenMP_CXX_OPTIONS}>)
endif()
# FIXME: remove UI libs which was used by plugins only
# Find macOS system libraries
# TODO: remove UI libs which was used by plugins only
if(APPLE)
find_library(APPLE_COREFOUNDATION_LIBRARY "CoreFoundation")
find_library(APPLE_FOUNDATION_LIBRARY "Foundation")
@ -122,7 +122,7 @@ if(SFIZZ_USE_SNDFILE OR SFIZZ_DEMOS OR SFIZZ_DEVTOOLS OR SFIZZ_BENCHMARKS)
find_package(PkgConfig REQUIRED)
pkg_check_modules(SNDFILE "sndfile" REQUIRED)
target_include_directories(sfizz_sndfile INTERFACE ${SNDFILE_INCLUDE_DIRS})
if(SFIZZ_STATIC_DEPENDENCIES)
if(SFIZZ_SNDFILE_STATIC)
target_link_libraries(sfizz_sndfile INTERFACE ${SNDFILE_STATIC_LIBRARIES})
else()
target_link_libraries(sfizz_sndfile INTERFACE ${SNDFILE_LIBRARIES})

View file

@ -310,7 +310,7 @@ sfizz_enable_fast_math(sfizz_internal)
# Check that sfizz and cmake-side definitions are matching
file(WRITE "${CMAKE_CURRENT_BINARY_DIR}/sfizz_match_definitions.cpp" "
#include \"Config.h\"
static_assert(sfz::config::numCCs == ${MIDI_CC_MAX}, \"MIDI_CC_MAX did not match\");
static_assert(sfz::config::numCCs == ${MIDI_CC_COUNT}, \"MIDI_CC_COUNT did not match\");
")
add_library(sfizz_match_definitions STATIC "${CMAKE_CURRENT_BINARY_DIR}/sfizz_match_definitions.cpp")
target_link_libraries(sfizz_match_definitions PRIVATE sfizz::internal)