diff --git a/cmake/enable_sdks.cmake b/cmake/enable_sdks.cmake index cbf83f5d..6c3805c1 100644 --- a/cmake/enable_sdks.cmake +++ b/cmake/enable_sdks.cmake @@ -9,6 +9,7 @@ # make CPM available include(cmake/CPM.cmake) + if (${CLAP_WRAPPER_DOWNLOAD_DEPENDENCIES}) message(STATUS "clap-wrapper: Downloading dependencies using CPM") @@ -247,6 +248,22 @@ if (APPLE) endif() endif() + +add_library(clap-wrapper-compile-options INTERFACE) +target_compile_options(clap-wrapper-compile-options INTERFACE -D${CLAP_WRAPPER_PLATFORM}=1) +if (APPLE) + target_link_libraries(clap-wrapper-compile-options INTERFACE macos_filesystem_support) +endif() +if(CMAKE_CXX_COMPILER_ID MATCHES "Clang|GNU") + target_compile_options(clap-wrapper-compile-options INTERFACE -Wall -Wextra -Wno-unused-parameter -Wpedantic -Werror) + if (${CLAP_WRAPPER_ENABLE_ASAN}) + message(STATUS "clap-wrapper: enabling asan build") + target_compile_options(clap-wrapper-compile-options INTERFACE -fsanitize=address -fsanitize=undefined) + target_link_options(clap-wrapper-compile-options INTERFACE -fsanitize=address -fsanitize=undefined) + endif() +endif() + + # define libraries function(target_add_vst3_wrapper) set(oneValueArgs @@ -322,19 +339,11 @@ function(target_add_vst3_wrapper) target_link_libraries(${V3_TARGET}-clap-wrapper-vst3-lib PUBLIC clap base-sdk-vst3) # clap-wrapper-extensions are PUBLIC, so a clap linking the library can access the clap-wrapper-extensions - target_compile_definitions(${V3_TARGET}-clap-wrapper-vst3-lib PUBLIC -D${CLAP_WRAPPER_PLATFORM}=1) - target_link_libraries(${V3_TARGET}-clap-wrapper-vst3-lib PUBLIC clap-wrapper-extensions clap-wrapper-shared-detail) + target_link_libraries(${V3_TARGET}-clap-wrapper-vst3-lib PUBLIC clap-wrapper-extensions clap-wrapper-compile-options clap-wrapper-shared-detail) target_compile_options(${V3_TARGET}-clap-wrapper-vst3-lib PRIVATE -DCLAP_SUPPORTS_ALL_NOTE_EXPRESSIONS=$,1,0> ) - - if(CMAKE_CXX_COMPILER_ID MATCHES "Clang|GNU") - target_compile_options(${V3_TARGET}-clap-wrapper-vst3-lib PRIVATE -Wall -Wextra -Wno-unused-parameter -Wpedantic -Werror) - endif() - if (APPLE) - target_link_libraries(${V3_TARGET}-clap-wrapper-vst3-lib PUBLIC macos_filesystem_support) - endif() endif() @@ -588,8 +597,7 @@ if (APPLE) target_link_libraries(${AUV2_TARGET}-clap-wrapper-auv2-lib INTERFACE clap base-sdk-auv2) # clap-wrapper-extensions are PUBLIC, so a clap linking the library can access the clap-wrapper-extensions - target_compile_definitions(${AUV2_TARGET}-clap-wrapper-auv2-lib INTERFACE -D${CLAP_WRAPPER_PLATFORM}=1) - target_link_libraries(${AUV2_TARGET}-clap-wrapper-auv2-lib INTERFACE clap-wrapper-extensions clap-wrapper-shared-detail macos_filesystem_support) + target_link_libraries(${AUV2_TARGET}-clap-wrapper-auv2-lib INTERFACE clap-wrapper-extensions clap-wrapper-shared-detail clap-wrapper-compile-options) endif() @@ -653,15 +661,10 @@ add_library(clap-wrapper-shared-detail STATIC src/detail/clap/fsutil.cpp src/detail/clap/automation.h ) -target_compile_options(clap-wrapper-shared-detail PUBLIC -D${CLAP_WRAPPER_PLATFORM}=1) -target_link_libraries(clap-wrapper-shared-detail PUBLIC clap clap-wrapper-extensions) +target_link_libraries(clap-wrapper-shared-detail PUBLIC clap 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) -if(CMAKE_CXX_COMPILER_ID MATCHES "Clang|GNU") - target_compile_options(clap-wrapper-shared-detail PRIVATE -Wall -Wextra -Wno-unused-parameter -Wpedantic -Werror) -endif() - if (APPLE) target_sources(clap-wrapper-shared-detail PRIVATE diff --git a/src/detail/auv2/auv2_shared.h b/src/detail/auv2/auv2_shared.h index 99ce22df..b3f445c9 100644 --- a/src/detail/auv2/auv2_shared.h +++ b/src/detail/auv2/auv2_shared.h @@ -53,7 +53,7 @@ struct ClapBridge if (_clapid.empty()) { - if (_idx < 0 || _idx >= _library.plugins.size()) + if (_idx < 0 || _idx >= (int)_library.plugins.size()) { std::cout << "[ERROR] cannot load by index" << std::endl; return; diff --git a/src/detail/auv2/build-helper/build-helper.cpp b/src/detail/auv2/build-helper/build-helper.cpp index 06b59521..97594ded 100644 --- a/src/detail/auv2/build-helper/build-helper.cpp +++ b/src/detail/auv2/build-helper/build-helper.cpp @@ -132,13 +132,16 @@ bool buildUnitsFromClap(const std::string &clapfile, const std::string &clapname clap_plugin_info_as_auv2_t v2inf; auto res = loader._pluginFactoryAUv2Info->get_auv2_info(loader._pluginFactoryAUv2Info, idx, &v2inf); - if (v2inf.au_type[0] != 0) + if (res) { - u.type = v2inf.au_type; - } - if (v2inf.au_subt[0] != 0) - { - u.subt = v2inf.au_subt; + if (v2inf.au_type[0] != 0) + { + u.type = v2inf.au_type; + } + if (v2inf.au_subt[0] != 0) + { + u.subt = v2inf.au_subt; + } } }