Skip to content

Commit

Permalink
Update for newer version of clap-helpers & include them via cmake
Browse files Browse the repository at this point in the history
  • Loading branch information
Trinitou committed Dec 6, 2023
1 parent f0670e4 commit b1fc19f
Show file tree
Hide file tree
Showing 13 changed files with 46 additions and 581 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/pullreq.yml
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,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 "64ee8eddea392da7f9db04b409fce69f9248a474"
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
6 changes: 3 additions & 3 deletions src/clap_proxy.cpp
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
#include "clap_proxy.h"
#include "detail/clap/fsutil.h"
#include "detail/clap/helpers/host.hxx"
#include <clap/helpers/host.hxx>
#include <cstring>

#if MAC || LIN
Expand Down Expand Up @@ -274,7 +274,7 @@ void Plugin::logLog(clap_log_severity severity, const char* msg) const noexcept
#endif
}

bool Plugin::threadCheckIsMainThread() noexcept
bool Plugin::threadCheckIsMainThread() const noexcept
{
if (this->_main_thread_override > 0)
{
Expand All @@ -283,7 +283,7 @@ bool Plugin::threadCheckIsMainThread() noexcept
return _main_thread_id == std::this_thread::get_id();
}

bool Plugin::threadCheckIsAudioThread() noexcept
bool Plugin::threadCheckIsAudioThread() const noexcept
{
if (this->_audio_thread_override > 0)
{
Expand Down
6 changes: 3 additions & 3 deletions src/clap_proxy.h
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@
#endif

#include "detail/clap/fsutil.h"
#include "detail/clap/helpers/host.hh"
#include <clap/helpers/host.hh>

namespace Clap
{
Expand Down Expand Up @@ -232,8 +232,8 @@ class Plugin : Clap::PluginHostBase
bool timerSupportUnregisterTimer(clap_id timerId) noexcept override;

// clap_host_thread_check
bool threadCheckIsMainThread() noexcept override;
bool threadCheckIsAudioThread() noexcept override;
bool threadCheckIsMainThread() const noexcept override;
bool threadCheckIsAudioThread() const noexcept override;

private:
IHost* _parentHost = nullptr;
Expand Down
9 changes: 0 additions & 9 deletions src/detail/clap/helpers/checking-level.hh

This file was deleted.

179 changes: 0 additions & 179 deletions src/detail/clap/helpers/host.hh

This file was deleted.

Loading

0 comments on commit b1fc19f

Please sign in to comment.