-
Notifications
You must be signed in to change notification settings - Fork 20
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Document expand and test new clap-first cmake api (#356)
1. Move the test to new cmake api 2. DOcument the test, document the clap first cmake, and include a link to six sines for a more expansive implementation 3. Add an option for inline-auv2-config with make_clap_first if you don't want to implement the extension
- Loading branch information
Showing
6 changed files
with
152 additions
and
167 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
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 |
---|---|---|
@@ -1,103 +1,53 @@ | ||
project(clap-first-distortion) | ||
|
||
# By A "Clap First" plugin, we mean a plugin which is *just* implmented as | ||
# CLAP and uses this wrapper to project into the various other platforms. | ||
# | ||
# One special form of clap first plugin does that by creating a | ||
# the platform plugins with the entire clap library built in. While there's | ||
# a few ways to do this the pattern which eemse to work best is | ||
# | ||
# 1. Write the etnire DSP, handling, etc... of your clap as a library without | ||
# the clap entry | ||
# 2. Have a minimal clap entry c++ file which just exposes the entry points from | ||
# that static library | ||
# 3. Make each of the clap, vst3, auv2 etc... link the static library from 1 but | ||
# recomile the entry from 2, so the resulting plugin has the entry point exposed. | ||
# This is a test of our clap-first makefiles we use in CI, and as such serves as | ||
# an example of doign this without helpers, with the absolute smalles cmake, and | ||
# so forth. A more fulsome example, using C++, setting up compiler options for | ||
# wider deployment, and so forth can be found at | ||
# | ||
# We show an example of that here with a slightly modified version of the | ||
# basic c99 distortion plugin, here re-coded using a C++ compiler. | ||
# https://github.com/baconpaul/six-sines | ||
|
||
# So first make the actual plugin as a static library | ||
add_library(${PROJECT_NAME}_base STATIC distortion_clap.cpp) | ||
target_link_libraries(${PROJECT_NAME}_base PUBLIC clap) | ||
project(clap-first-distortion) | ||
|
||
set(PRODUCT_NAME "ClapFirst Bad Distortion") | ||
|
||
# Now build and configure the CLAP. | ||
add_library(${PROJECT_NAME}_clap MODULE | ||
distortion_clap_entry.cpp | ||
) | ||
target_link_libraries(${PROJECT_NAME}_clap ${PROJECT_NAME}_base) | ||
# Step one is to create a static 'impl' library which contains a static | ||
# implementation of clap_init, clap_deinit and clap_get_factor. Here those | ||
# are all in one cpp file, but a common idiom is to have an -entry-impl file | ||
# separate from the rest of your clap, especially in multi-plugin claps. | ||
add_library(${PROJECT_NAME}-impl STATIC distortion_clap.cpp) | ||
target_link_libraries(${PROJECT_NAME}-impl PUBLIC clap) | ||
|
||
if(APPLE) | ||
set_target_properties(${PROJECT_NAME}_clap PROPERTIES | ||
BUNDLE True | ||
BUNDLE_EXTENSION clap | ||
LIBRARY_OUTPUT_NAME ClapFirstDistortion | ||
MACOSX_BUNDLE TRUE | ||
MACOSX_BUNDLE_GUI_IDENTIFIER org.free-audio.clapfirst | ||
MACOSX_BUNDLE_BUNDLE_NAME ClapFirstDistortion | ||
MACOSX_BUNDLE_BUNDLE_VERSION "1" | ||
MACOSX_BUNDLE_SHORT_VERSION_STRING "1" | ||
XCODE_ATTRIBUTE_GENERATE_PKGINFO_FILE "YES" | ||
) | ||
elseif(UNIX) | ||
set_target_properties(${PROJECT_NAME}_clap PROPERTIES OUTPUT_NAME ClapFirstDistortion SUFFIX ".clap" PREFIX "") | ||
# Then we use make_clapfirst_plugin, provided by the wrappers, to create the | ||
# project out of the impl and the cpp file which exports the entry | ||
make_clapfirst_plugins( | ||
TARGET_NAME ${PROJECT_NAME} | ||
IMPL_TARGET ${PROJECT_NAME}-impl | ||
|
||
else() | ||
set_target_properties(${PROJECT_NAME}_clap | ||
PROPERTIES | ||
OUTPUT_NAME ClapFirstDistortion | ||
SUFFIX ".clap" PREFIX "" | ||
LIBRARY_OUTPUT_DIRECTORY CLAP | ||
) | ||
endif() | ||
OUTPUT_NAME "${PRODUCT_NAME}" | ||
|
||
# Building a VST3 is now easy. Make a MODULE library which compiles the entry code | ||
# and links the base library, then use the wraper cmake code to expose it as a VST3 | ||
set(VST3_TARGET ${PROJECT_NAME}_vst3) | ||
add_library(${VST3_TARGET} MODULE) | ||
target_sources(${VST3_TARGET} PRIVATE distortion_clap_entry.cpp) | ||
target_add_vst3_wrapper(TARGET ${VST3_TARGET} | ||
OUTPUT_NAME "ClapFirstDistortion" | ||
) | ||
target_link_libraries(${VST3_TARGET} PRIVATE ${PROJECT_NAME}_base) | ||
ENTRY_SOURCE "distortion_clap_entry.cpp" | ||
|
||
BUNDLE_IDENTIFER "org.free-audio.clap-first-bad-distortion" | ||
BUNDLE_VERSION ${PROJECT_VERSION} | ||
|
||
# And the same for the standalone | ||
set(SA_TARGET ${PROJECT_NAME}_standalone) | ||
add_executable(${SA_TARGET}) | ||
target_sources(${SA_TARGET} PRIVATE distortion_clap_entry.cpp) | ||
target_link_libraries(${SA_TARGET} PRIVATE ${PROJECT_NAME}_base) | ||
target_add_standalone_wrapper(TARGET ${SA_TARGET} | ||
OUTPUT_NAME "ClapFirstDistortion" | ||
STATICALLY_LINKED_CLAP_ENTRY True | ||
PLUGIN_ID "org.free-audio.clap-first-bad-distortion") | ||
COPY_AFTER_BUILD FALSE | ||
|
||
if (APPLE) | ||
# And the same for the AUV2 | ||
set(AUV2_TARGET ${PROJECT_NAME}_auv2) | ||
add_library(${AUV2_TARGET} MODULE) | ||
target_sources(${AUV2_TARGET} PRIVATE distortion_clap_entry.cpp) | ||
target_link_libraries(${AUV2_TARGET} PRIVATE ${PROJECT_NAME}_base) | ||
target_add_auv2_wrapper( | ||
TARGET ${AUV2_TARGET} | ||
OUTPUT_NAME "ClapFirstDistortion" | ||
BUNDLE_IDENTIFIER "org.freeaudio.bad-clap-first" | ||
BUNDLE_VERSION "1" | ||
PLUGIN_FORMATS CLAP VST3 AUV2 | ||
|
||
MANUFACTURER_NAME "FreeAudio Team" | ||
MANUFACTURER_CODE "FrAU" | ||
SUBTYPE_CODE "clDi" | ||
INSTRUMENT_TYPE "aufx" | ||
ASSET_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/${PROJECT_NAME}_assets | ||
|
||
CLAP_TARGET_FOR_CONFIG ${PROJECT_NAME}_clap | ||
) | ||
endif() | ||
# You can set up the AUv2 for a single plugin here, or you can | ||
# set it up with the auv2 extension in your clap | ||
AUV2_MANUFACTURER_NAME "Free Audio" | ||
AUV2_MANUFACTURER_CODE "FrAD" | ||
AUV2_SUBTYPE_CODE "BdDt" | ||
AUV2_INSTRUMENT_TYPE "aufx" | ||
|
||
# You can add a target-per-standalone you want. Syntax here is | ||
# target-postfix output-name clap-id | ||
# This allows you to make multiple standalones from a multi-plugin clap | ||
# In this case, the standalone has no UI and is an audio to audio effect | ||
# so it isn't very useful | ||
# STANDALONE_CONFIGURATIONS | ||
# standalone "${PRODUCT_NAME}" "org.free-audio.clap-first-bad-distortion" | ||
) | ||
|
||
# FInally collect those all in a utility target | ||
add_custom_target(${PROJECT_NAME}_all_plugins) | ||
add_dependencies(${PROJECT_NAME}_all_plugins ${PROJECT_NAME}_clap ${PROJECT_NAME}_vst3 ${PROJECT_NAME}_standalone) | ||
if (APPLE) | ||
add_dependencies(${PROJECT_NAME}_all_plugins ${PROJECT_NAME}_auv2) | ||
endif() |
Oops, something went wrong.