Skip to content

Commit

Permalink
Make Plugin derive from clap::helpers::Host
Browse files Browse the repository at this point in the history
  • Loading branch information
Trinitou committed Jan 24, 2024
1 parent 6b21ae2 commit 8d70785
Show file tree
Hide file tree
Showing 8 changed files with 152 additions and 223 deletions.
3 changes: 2 additions & 1 deletion .github/workflows/pullreq.yml
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@ jobs:
mkdir deps
cd deps
git clone https://github.com/free-audio/clap
git clone https://github.com/free-audio/clap-helpers
git clone https://github.com/steinbergmedia/vst3sdk
cd vst3sdk
# temporary workaround, switch to vst3 sdk 3.7.7
Expand All @@ -39,7 +40,7 @@ jobs:
- name: Build project
run: |
cmake -S . -B ./build -DCMAKE_BUILD_TYPE=Debug -DCMAKE_OSX_ARCHITECTURES="arm64;x86_64" -DCLAP_SDK_ROOT=deps/clap -DVST3_SDK_ROOT=deps/vst3sdk -DCLAP_WRAPPER_OUTPUT_NAME=testplug
cmake -S . -B ./build -DCMAKE_BUILD_TYPE=Debug -DCMAKE_OSX_ARCHITECTURES="arm64;x86_64" -DCLAP_SDK_ROOT=deps/clap -DCLAP_HELPERS_SDK_ROOT=deps/clap-helpers -DVST3_SDK_ROOT=deps/vst3sdk -DCLAP_WRAPPER_OUTPUT_NAME=testplug
cmake --build ./build --config Debug
- name: Show Build Results
Expand Down
1 change: 1 addition & 0 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
# complete description
#
# CLAP_SDK_ROOT The location of the clap library. Defaults to ../clap
# CLAP_HELPERS_SDK_ROOT The location of the clap-helpers library. Defaults to ../clap-helpers
# VST3_SDK_ROOT The location of the VST3 sdk. Defaults tp ../vst3sdk
#
# CLAP_WRAPPER_OUTPUT_NAME The name of the resulting .vst3 or .component
Expand Down
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,7 @@ git clone https://github.com/free-audio/clap-wrapper.git
mkdir build
cmake -B build \
-DCLAP_SDK_ROOT={path to clap sdk} \
-DCLAP_HELPERS_SDK_ROOT={path to clap-helpers sdk} \
-DVST3_SDK_ROOT={path to vst3 sdk} \
-DCLAP_WRAPPER_OUTPUT_NAME="The Name of your CLAP"
```
Expand Down
35 changes: 35 additions & 0 deletions cmake/base_sdks.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -91,6 +91,41 @@ function(guarantee_clap)
add_subdirectory(${CLAP_SDK_ROOT} base-sdk-clap EXCLUDE_FROM_ALL)
endfunction(guarantee_clap)

function(guarantee_clap_helpers)
if (TARGET clap-helpers)
if (NOT TARGET base-sdk-clap-helpers)
add_library(base-sdk-clap-helpers ALIAS clap-helpers)
endif()
return()
endif()


if (NOT "${CLAP_HELPERS_SDK_ROOT}" STREQUAL "")
# Use the provided root
elseif (${CLAP_WRAPPER_DOWNLOAD_DEPENDENCIES})
guarantee_cpm()
CPMAddPackage(
NAME "clap-helpers"
GITHUB_REPOSITORY "free-audio/clap-helpers"
GIT_TAG "7b53a685e11465154b4ccba3065224dbcbf8a893"
EXCLUDE_FROM_ALL TRUE
DOWNLOAD_ONLY TRUE
SOURCE_DIR cpm/clap-helpers
)
set(CLAP_HELPERS_SDK_ROOT "${CMAKE_CURRENT_BINARY_DIR}/cpm/clap-helpers")
else()
search_for_sdk_source(SDKDIR clap-helpers RESULT CLAP_HELPERS_SDK_ROOT)
endif()

cmake_path(CONVERT "${CLAP_HELPERS_SDK_ROOT}" TO_CMAKE_PATH_LIST CLAP_HELPERS_SDK_ROOT)
if(NOT EXISTS "${CLAP_HELPERS_SDK_ROOT}/include/clap/helpers/macros.hh")
message(FATAL_ERROR "There is no CLAP_HELPERS SDK at ${CLAP_HELPERS_SDK_ROOT}. Please set CLAP_HELPERS_SDK_ROOT appropriately ")
endif()

message(STATUS "clap-wrapper: Configuring clap-helpers sdk")
add_subdirectory(${CLAP_HELPERS_SDK_ROOT} base-sdk-clap-helpers EXCLUDE_FROM_ALL)
endfunction(guarantee_clap_helpers)

function(guarantee_vst3sdk)
if (TARGET base-sdk-vst3)
return()
Expand Down
2 changes: 1 addition & 1 deletion cmake/shared_prologue.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -142,7 +142,7 @@ function(guarantee_clap_wrapper_shared)
src/detail/clap/fsutil.cpp
src/detail/clap/automation.h
)
target_link_libraries(clap-wrapper-shared-detail PUBLIC clap clap-wrapper-extensions clap-wrapper-compile-options)
target_link_libraries(clap-wrapper-shared-detail PUBLIC clap clap-helpers clap-wrapper-extensions clap-wrapper-compile-options)
target_include_directories(clap-wrapper-shared-detail PUBLIC libs/fmt)
target_include_directories(clap-wrapper-shared-detail PUBLIC src)

Expand Down
1 change: 1 addition & 0 deletions cmake/wrapper_functions.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ include(cmake/shared_prologue.cmake)
include(cmake/base_sdks.cmake)

guarantee_clap()
guarantee_clap_helpers()
guarantee_clap_wrapper_shared()


Expand Down
Loading

0 comments on commit 8d70785

Please sign in to comment.