Update CMake files, generic LV2 configuration
This commit is contained in:
parent
e41ef4121b
commit
f38c538ee1
6 changed files with 175 additions and 33 deletions
|
|
@ -4,11 +4,15 @@
|
|||
# Top-most EditorConfig file
|
||||
root = true
|
||||
|
||||
# No trailing whitespaces, but with a newline ending every file,
|
||||
# UTF-8 charset, set indent to spaces with width of four
|
||||
# UTF-8 charset, set indent to spaces with width of four,
|
||||
# with no trailing whitespaces and a newline ending every file.
|
||||
[*]
|
||||
charset = utf-8
|
||||
indent_size = 4
|
||||
indent_style = space
|
||||
insert_final_newline = true
|
||||
trim_trailing_whitespace = true
|
||||
charset = utf-8
|
||||
|
||||
[*.{ttl,ttl.in}]
|
||||
indent_size = 2
|
||||
indent_style = space
|
||||
indent_size = 4
|
||||
|
|
|
|||
|
|
@ -8,10 +8,10 @@ include (SfizzConfig)
|
|||
# Build Options
|
||||
set (BUILD_TESTING OFF CACHE BOOL "Disable Abseil's tests [default: OFF]")
|
||||
|
||||
set (SFIZZ_LV2_DIR "${CMAKE_INSTALL_PREFIX}/lib/lv2" CACHE STRING
|
||||
set (LV2PLUGIN_INSTALL_DIR "${CMAKE_INSTALL_PREFIX}/lib/lv2" CACHE STRING
|
||||
"Install destination for LV2 bundle [default: ${CMAKE_INSTALL_PREFIX}/lib/lv2]")
|
||||
|
||||
option (SFIZZ_USE_LTO "Enable Link Time Optimization [default: ON]" ON)
|
||||
option (ENABLE_LTO "Enable Link Time Optimization [default: ON]" ON)
|
||||
option (SFIZZ_JACK "Enable JACK stand-alone build [default: ON]" ON)
|
||||
option (SFIZZ_LV2 "Enable LV2 plug-in build [default: ON]" ON)
|
||||
option (SFIZZ_BENCHMARKS "Enable benchmarks build [default: OFF]" OFF)
|
||||
|
|
@ -44,7 +44,7 @@ endif()
|
|||
message (STATUS "
|
||||
Project name: ${CMAKE_PROJECT_NAME}
|
||||
Build type: ${CMAKE_BUILD_TYPE}
|
||||
Build using LTO: ${SFIZZ_USE_LTO}
|
||||
Build using LTO: ${ENABLE_LTO}
|
||||
Build as shared library: ${SFIZZ_SHARED}
|
||||
Build JACK stand-alone client: ${SFIZZ_JACK}
|
||||
Build LV2 plug-in: ${SFIZZ_LV2}
|
||||
|
|
@ -52,7 +52,7 @@ Build benchmarks: ${SFIZZ_BENCHMARKS}
|
|||
Build tests: ${SFIZZ_TESTS}
|
||||
|
||||
Install prefix: ${CMAKE_INSTALL_PREFIX}
|
||||
LV2 destination directory: ${SFIZZ_LV2_DIR}
|
||||
LV2 destination directory: ${LV2PLUGIN_INSTALL_DIR}
|
||||
|
||||
Compiler CXX debug flags: ${CMAKE_CXX_FLAGS_DEBUG}
|
||||
Compiler CXX release flags: ${CMAKE_CXX_FLAGS_RELEASE}
|
||||
|
|
|
|||
|
|
@ -1,30 +1,53 @@
|
|||
project (sfizz)
|
||||
project (lv2plugin)
|
||||
|
||||
add_library (sfizz_lv2 SHARED sfizz.c)
|
||||
set_target_properties (sfizz_lv2 PROPERTIES PREFIX "")
|
||||
set_target_properties (sfizz_lv2 PROPERTIES OUTPUT_NAME "sfizz")
|
||||
target_link_libraries (sfizz_lv2 sfizz::sfizz)
|
||||
# CMAKE_PROJECT_NAME is the top level project name, not the current one
|
||||
set (LV2PLUGIN_PRJ_NAME "${CMAKE_PROJECT_NAME}_lv2")
|
||||
|
||||
add_custom_command (TARGET sfizz_lv2 POST_BUILD
|
||||
COMMAND ${CMAKE_COMMAND} -E copy
|
||||
${CMAKE_SOURCE_DIR}/lv2/sfizz.ttl
|
||||
${CMAKE_CURRENT_BINARY_DIR}/sfizz.ttl)
|
||||
# Set the build directory as <build_dir>/lv2/<plugin_name>.lv2/
|
||||
set (PROJECT_BINARY_DIR "${PROJECT_BINARY_DIR}/${CMAKE_PROJECT_NAME}.lv2")
|
||||
|
||||
add_custom_command (TARGET sfizz_lv2 POST_BUILD
|
||||
COMMAND ${CMAKE_COMMAND} -E copy
|
||||
${CMAKE_SOURCE_DIR}/lv2/manifest.ttl
|
||||
${CMAKE_CURRENT_BINARY_DIR}/manifest.ttl)
|
||||
if (SFIZZ_USE_LTO)
|
||||
set_property (TARGET sfizz_lv2 PROPERTY INTERPROCEDURAL_OPTIMIZATION True)
|
||||
# Configuration for this plugin
|
||||
# TODO: generate version from git
|
||||
set (LV2PLUGIN_VERSION_MINOR 0)
|
||||
set (LV2PLUGIN_VERSION_MICRO 1)
|
||||
set (LV2PLUGIN_NAME "Sfizz")
|
||||
set (LV2PLUGIN_COMMENT "SFZ sampler")
|
||||
set (LV2PLUGIN_URI "http://sfztools.github.io/sfizz")
|
||||
set (LV2PLUGIN_AUTHOR "Paul Ferrand")
|
||||
set (LV2PLUGIN_SPDX_LICENSE_ID "BSD-2-Clause")
|
||||
|
||||
if (WIN32)
|
||||
set (LV2PLUGIN_EXT "dll")
|
||||
elseif (APPLE)
|
||||
set (LV2PLUGIN_EXT "dylib")
|
||||
else()
|
||||
set (LV2PLUGIN_EXT "so")
|
||||
endif()
|
||||
|
||||
if (UNIX)
|
||||
if (NOT LV2_INSTALL_PREFIX)
|
||||
set (LV2_INSTALL_PREFIX ${CMAKE_INSTALL_LIBDIR}/lv2/sfizz.lv2)
|
||||
endif()
|
||||
install (TARGETS sfizz_lv2
|
||||
ARCHIVE DESTINATION ${LV2_INSTALL_PREFIX}
|
||||
LIBRARY DESTINATION ${LV2_INSTALL_PREFIX})
|
||||
install (FILES ${CMAKE_BINARY_DIR}/lv2/sfizz.ttl DESTINATION ${LV2_INSTALL_PREFIX})
|
||||
install (FILES ${CMAKE_BINARY_DIR}/lv2/manifest.ttl DESTINATION ${LV2_INSTALL_PREFIX})
|
||||
# Keep non build turtle files in IDE
|
||||
set (LV2PLUGIN_TTL_SRC_FILES
|
||||
manifest.ttl.in
|
||||
${CMAKE_PROJECT_NAME}.ttl.in
|
||||
)
|
||||
add_library (${LV2PLUGIN_PRJ_NAME} SHARED ${CMAKE_PROJECT_NAME}.c ${LV2PLUGIN_TTL_SRC_FILES})
|
||||
target_link_libraries (${LV2PLUGIN_PRJ_NAME} ${CMAKE_PROJECT_NAME}::${CMAKE_PROJECT_NAME})
|
||||
|
||||
if (ENABLE_LTO)
|
||||
set_property (TARGET ${LV2PLUGIN_PRJ_NAME} PROPERTY INTERPROCEDURAL_OPTIMIZATION True)
|
||||
endif()
|
||||
|
||||
# Remove the "lib" prefix, rename the target name and build it in the .lv build dir
|
||||
# <build_dir>/lv2/<plugin_name>_lv2.<ext> to
|
||||
# <build_dir>/lv2/<plugin_name>.lv2/<plugin_name>.<ext>
|
||||
set_target_properties (${LV2PLUGIN_PRJ_NAME} PROPERTIES PREFIX "")
|
||||
set_target_properties (${LV2PLUGIN_PRJ_NAME} PROPERTIES OUTPUT_NAME "${CMAKE_PROJECT_NAME}")
|
||||
set_target_properties (${LV2PLUGIN_PRJ_NAME} PROPERTIES LIBRARY_OUTPUT_DIRECTORY "${PROJECT_BINARY_DIR}")
|
||||
|
||||
# Generate *.ttl files from *.in sources,
|
||||
# create the destination directory if it doesn't exists and copy needed files
|
||||
file (MAKE_DIRECTORY ${PROJECT_BINARY_DIR})
|
||||
configure_file (manifest.ttl.in ${PROJECT_BINARY_DIR}/manifest.ttl)
|
||||
configure_file (${CMAKE_PROJECT_NAME}.ttl.in ${PROJECT_BINARY_DIR}/${CMAKE_PROJECT_NAME}.ttl)
|
||||
|
||||
# Installation
|
||||
install (DIRECTORY ${PROJECT_BINARY_DIR} DESTINATION ${LV2PLUGIN_INSTALL_DIR})
|
||||
|
|
|
|||
7
lv2/manifest.ttl.in
Normal file
7
lv2/manifest.ttl.in
Normal file
|
|
@ -0,0 +1,7 @@
|
|||
@prefix lv2: <http://lv2plug.in/ns/lv2core#> .
|
||||
@prefix rdfs: <http://www.w3.org/2000/01/rdf-schema#> .
|
||||
|
||||
<@LV2PLUGIN_URI@>
|
||||
a lv2:Plugin ;
|
||||
lv2:binary <@CMAKE_PROJECT_NAME@.@LV2PLUGIN_EXT@> ;
|
||||
rdfs:seeAlso <@CMAKE_PROJECT_NAME@.ttl> .
|
||||
108
lv2/sfizz.ttl.in
Normal file
108
lv2/sfizz.ttl.in
Normal file
|
|
@ -0,0 +1,108 @@
|
|||
@prefix atom: <http://lv2plug.in/ns/ext/atom#> .
|
||||
@prefix bufsize: <http://lv2plug.in/ns/ext/buf-size#> .
|
||||
@prefix doap: <http://usefulinc.com/ns/doap#> .
|
||||
@prefix foaf: <http://xmlns.com/foaf/0.1/> .
|
||||
@prefix lv2: <http://lv2plug.in/ns/lv2core#> .
|
||||
@prefix midi: <http://lv2plug.in/ns/ext/midi#> .
|
||||
@prefix opts: <http://lv2plug.in/ns/ext/options#> .
|
||||
@prefix patch: <http://lv2plug.in/ns/ext/patch#> .
|
||||
@prefix pg: <http://lv2plug.in/ns/ext/port-groups#> .
|
||||
@prefix pprop: <http://lv2plug.in/ns/ext/port-props#> .
|
||||
@prefix rdf: <http://www.w3.org/1999/02/22-rdf-syntax-ns#> .
|
||||
@prefix rdfs: <http://www.w3.org/2000/01/rdf-schema#> .
|
||||
@prefix state: <http://lv2plug.in/ns/ext/state#> .
|
||||
@prefix units: <http://lv2plug.in/ns/extensions/units#> .
|
||||
@prefix urid: <http://lv2plug.in/ns/ext/urid#> .
|
||||
@prefix work: <http://lv2plug.in/ns/ext/worker#> .
|
||||
|
||||
<#config>
|
||||
a pg:Group ;
|
||||
lv2:symbol "config" ;
|
||||
lv2:name "Configuration" .
|
||||
|
||||
<@LV2PLUGIN_URI@:sfzfile>
|
||||
a lv2:Parameter ;
|
||||
rdfs:label "SFZ file" ;
|
||||
rdfs:range atom:Path .
|
||||
|
||||
<@LV2PLUGIN_URI@:numvoices>
|
||||
a lv2:Parameter ;
|
||||
rdfs:label "Polyphony" ;
|
||||
rdfs:range atom:Int .
|
||||
|
||||
<@LV2PLUGIN_URI@>
|
||||
a doap:Project, lv2:Plugin, lv2:InstrumentPlugin ;
|
||||
|
||||
doap:name "@LV2PLUGIN_NAME@" ;
|
||||
doap:license <https://spdx.org/licenses/@LV2PLUGIN_SPDX_LICENSE_ID@> ;
|
||||
doap:maintainer [
|
||||
foaf:name "@LV2PLUGIN_AUTHOR@" ;
|
||||
foaf:homepage <@LV2PLUGIN_URI@> ;
|
||||
] ;
|
||||
rdfs:comment "@LV2PLUGIN_COMMENT@" ;
|
||||
|
||||
lv2:minorVersion @LV2PLUGIN_VERSION_MINOR@ ;
|
||||
lv2:microVersion @LV2PLUGIN_VERSION_MICRO@ ;
|
||||
|
||||
lv2:requiredFeature urid:map, bufsize:boundedBlockLength, work:schedule ;
|
||||
lv2:optionalFeature lv2:hardRTCapable, opts:options ;
|
||||
lv2:extensionData opts:interface, state:interface, work:interface ;
|
||||
|
||||
patch:writable <@LV2PLUGIN_URI@:sfzfile> ;
|
||||
|
||||
lv2:port [
|
||||
a lv2:InputPort, atom:AtomPort ;
|
||||
atom:bufferType atom:Sequence ;
|
||||
atom:supports patch:Message, midi:MidiEvent ;
|
||||
lv2:designation lv2:control ;
|
||||
lv2:index 0 ;
|
||||
lv2:symbol "control" ;
|
||||
lv2:name "Control"
|
||||
] , [
|
||||
a lv2:OutputPort, atom:AtomPort ;
|
||||
atom:bufferType atom:Sequence ;
|
||||
atom:supports patch:Message ;
|
||||
lv2:designation lv2:control ;
|
||||
lv2:index 1 ;
|
||||
lv2:symbol "notify" ;
|
||||
lv2:name "Notify" ;
|
||||
] , [
|
||||
a lv2:AudioPort , lv2:OutputPort ;
|
||||
lv2:index 2 ;
|
||||
lv2:symbol "out_left" ;
|
||||
lv2:name "Left Output"
|
||||
] , [
|
||||
a lv2:AudioPort , lv2:OutputPort ;
|
||||
lv2:index 3 ;
|
||||
lv2:symbol "out_right" ;
|
||||
lv2:name "Right Output"
|
||||
] , [
|
||||
a lv2:InputPort, lv2:ControlPort ;
|
||||
lv2:index 4 ;
|
||||
lv2:symbol "volume" ;
|
||||
lv2:name "Volume" ;
|
||||
lv2:default 0.0 ;
|
||||
lv2:minimum -80.0 ;
|
||||
lv2:maximum 6.0 ;
|
||||
lv2:portProperty pprop:notAutomatic ;
|
||||
units:unit units:db
|
||||
] , [
|
||||
a lv2:InputPort, lv2:ControlPort ;
|
||||
lv2:index 5 ;
|
||||
lv2:symbol "num_voices" ;
|
||||
lv2:name "Polyphony" ;
|
||||
pg:group <#config> ;
|
||||
lv2:portProperty pprop:notAutomatic ;
|
||||
lv2:portProperty pprop:expensive ;
|
||||
lv2:portProperty lv2:integer ;
|
||||
lv2:portProperty lv2:enumeration ;
|
||||
lv2:default 64 ;
|
||||
lv2:minimum 8 ;
|
||||
lv2:maximum 256 ;
|
||||
lv2:scalePoint [ rdfs:label "8 voices"; rdf:value 8 ] ;
|
||||
lv2:scalePoint [ rdfs:label "16 voices"; rdf:value 16 ] ;
|
||||
lv2:scalePoint [ rdfs:label "32 voices"; rdf:value 32 ] ;
|
||||
lv2:scalePoint [ rdfs:label "64 voices"; rdf:value 64 ] ;
|
||||
lv2:scalePoint [ rdfs:label "128 voices"; rdf:value 128 ] ;
|
||||
lv2:scalePoint [ rdfs:label "256 voices"; rdf:value 256 ] ;
|
||||
] .
|
||||
|
|
@ -32,7 +32,7 @@ if (UNIX)
|
|||
target_link_libraries (sfizz PUBLIC atomic)
|
||||
endif()
|
||||
|
||||
if (SFIZZ_USE_LTO)
|
||||
if (ENABLE_LTO)
|
||||
set_property (TARGET sfizz_parser PROPERTY INTERPROCEDURAL_OPTIMIZATION True)
|
||||
set_property (TARGET sfizz PROPERTY INTERPROCEDURAL_OPTIMIZATION True)
|
||||
endif()
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue