Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ cmake_minimum_required(VERSION 3.21)
cmake_policy(SET CMP0091 NEW)
cmake_policy(SET CMP0149 NEW)
if (NOT DEFINED CMAKE_OSX_DEPLOYMENT_TARGET)
message(STATUS "[clap-wrapper]: OSX_DEPLOYEMNT_TARGET is undefined. Setting to 10.13")
message(STATUS "[clap-wrapper]: OSX_DEPLOYMENT_TARGET is undefined. Setting to 10.13")
set(CMAKE_OSX_DEPLOYMENT_TARGET 10.13 CACHE STRING "Minimum macOS version")
endif()
if (NOT DEFINED CMAKE_OSX_ARCHITECTURES)
Expand Down
29 changes: 29 additions & 0 deletions cmake/embed_clap.cmake
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
# embed_clap.cmake — find an installed .clap bundle and copy it into the target
# Called as a post-build script with -DCLAP_NAME=<name>.clap -DDST=<destination path>

if(NOT DEFINED CLAP_NAME OR NOT DEFINED DST)
message(FATAL_ERROR "embed_clap.cmake requires -DCLAP_NAME and -DDST")
endif()

# Search standard CLAP install locations
set(_search_paths
"$ENV{HOME}/Library/Audio/Plug-Ins/CLAP"
"/Library/Audio/Plug-Ins/CLAP"
)

set(_found "")
foreach(_dir IN LISTS _search_paths)
set(_candidate "${_dir}/${CLAP_NAME}")
if(IS_DIRECTORY "${_candidate}")
set(_found "${_candidate}")
break()
endif()
endforeach()

if(_found STREQUAL "")
message(WARNING "embed_clap: '${CLAP_NAME}' not found in standard CLAP paths, appex will search at runtime")
return()
endif()

message(STATUS "embed_clap: copying ${_found} -> ${DST}")
file(COPY "${_found}" DESTINATION "${DST}/..")
68 changes: 67 additions & 1 deletion cmake/make_clapfirst.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -76,20 +76,22 @@ function(make_clapfirst_plugins)
if (ANY_WASM_TOOLCHAIN)
set(C1ST_PLUGIN_FORMATS WCLAP)
else()
set(C1ST_PLUGIN_FORMATS CLAP VST3 AUV2 AAX)
set(C1ST_PLUGIN_FORMATS CLAP VST3 AUV2 AUV3 AAX)
endif()
endif()

if(ANY_WASM_TOOLCHAIN)
set(BUILD_CLAP -1)
set(BUILD_VST3 -1)
set(BUILD_AUV2 -1)
set(BUILD_AUV3 -1)
set(BUILD_AAX -1)
list(FIND C1ST_PLUGIN_FORMATS "WCLAP" BUILD_WCLAP)
else()
list(FIND C1ST_PLUGIN_FORMATS "CLAP" BUILD_CLAP)
list(FIND C1ST_PLUGIN_FORMATS "VST3" BUILD_VST3)
list(FIND C1ST_PLUGIN_FORMATS "AUV2" BUILD_AUV2)
list(FIND C1ST_PLUGIN_FORMATS "AUV3" BUILD_AUV3)
list(FIND C1ST_PLUGIN_FORMATS "AAX" BUILD_AAX)
set(BUILD_WCLAP -1)

Expand Down Expand Up @@ -215,6 +217,70 @@ function(make_clapfirst_plugins)
add_dependencies(${ALL_TARGET} ${AUV2_TARGET})
endif()

if (APPLE AND ${BUILD_AUV3} GREATER -1)
message(STATUS "clap-wrapper: ClapFirst is making an AUv3")
set(AUV3_TARGET ${C1ST_TARGET_NAME}_auv3)
add_executable(${AUV3_TARGET})
target_sources(${AUV3_TARGET} PRIVATE ${C1ST_ENTRY_SOURCE})
target_link_libraries(${AUV3_TARGET} PRIVATE ${C1ST_IMPL_TARGET})
if (DEFINED C1ST_AUV2_MANUFACTURER_CODE)
target_add_auv3_wrapper(
TARGET ${AUV3_TARGET}
OUTPUT_NAME "${C1ST_OUTPUT_NAME}"
BUNDLE_IDENTIFIER "${C1ST_BUNDLE_IDENTIFER}.auv3"
BUNDLE_VERSION "${C1ST_BUNDLE_VERSION}"
RESOURCE_DIRECTORY "${C1ST_RESOURCE_DIRECTORY}"

MANUFACTURER_NAME "${C1ST_AUV2_MANUFACTURER_NAME}"
MANUFACTURER_CODE "${C1ST_AUV2_MANUFACTURER_CODE}"
SUBTYPE_CODE "${C1ST_AUV2_SUBTYPE_CODE}"
INSTRUMENT_TYPE "${C1ST_AUV2_INSTRUMENT_TYPE}"
)
else()
target_add_auv3_wrapper(
TARGET ${AUV3_TARGET}
OUTPUT_NAME "${C1ST_OUTPUT_NAME}"
BUNDLE_IDENTIFIER "${C1ST_BUNDLE_IDENTIFER}.auv3"
BUNDLE_VERSION "${C1ST_BUNDLE_VERSION}"
RESOURCE_DIRECTORY "${C1ST_RESOURCE_DIRECTORY}"

CLAP_TARGET_FOR_CONFIG "${CLAP_TARGET}"
)
endif()

if (DEFINED C1ST_ASSET_OUTPUT_DIRECTORY)
set_target_properties(${AUV3_TARGET} PROPERTIES
LIBRARY_OUTPUT_DIRECTORY ${C1ST_ASSET_OUTPUT_DIRECTORY})
endif()

add_dependencies(${ALL_TARGET} ${AUV3_TARGET})

# AUv3 Standalone host app (embeds the .appex)
if (DEFINED C1ST_AUV2_MANUFACTURER_CODE)
set(AUV3SA_TARGET ${C1ST_TARGET_NAME}_auv3_standalone)
message(STATUS "clap-wrapper: ClapFirst is making an AUv3 Standalone")
add_executable(${AUV3SA_TARGET})
target_add_auv3_standalone_wrapper(
TARGET ${AUV3SA_TARGET}
OUTPUT_NAME "${C1ST_OUTPUT_NAME} AUv3"
BUNDLE_IDENTIFIER "${C1ST_BUNDLE_IDENTIFER}.auv3standalone"
BUNDLE_VERSION "${C1ST_BUNDLE_VERSION}"
AUV3_TARGET ${AUV3_TARGET}
AU_TYPE "${C1ST_AUV2_INSTRUMENT_TYPE}"
AU_SUBTYPE "${C1ST_AUV2_SUBTYPE_CODE}"
AU_MANUFACTURER "${C1ST_AUV2_MANUFACTURER_CODE}"
MACOS_ICON "${C1ST_STANDALONE_MACOS_ICON}"
)

if (DEFINED C1ST_ASSET_OUTPUT_DIRECTORY)
set_target_properties(${AUV3SA_TARGET} PROPERTIES
RUNTIME_OUTPUT_DIRECTORY ${C1ST_ASSET_OUTPUT_DIRECTORY})
endif()

add_dependencies(${ALL_TARGET} ${AUV3SA_TARGET})
endif()
endif()

## ----------------------
if (CLAP_WRAPPER_CAN_BUILD_AAX AND ${BUILD_AAX} GREATER -1)
message(STATUS "clap-wrapper: ClapFirst is making an AAX")
Expand Down
4 changes: 4 additions & 0 deletions cmake/shared_prologue.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -172,6 +172,10 @@ function(target_copy_after_build)
set(postfix "component")
set(macdir "Components")
set(lindir ".component")
elseif (${CAB_FLAVOR} STREQUAL "auv3")
set(postfix "appex")
set(macdir "Components")
set(lindir ".appex")
elseif (${CAB_FLAVOR} STREQUAL "clap")
set(postfix "clap")
set(macdir "CLAP")
Expand Down
38 changes: 38 additions & 0 deletions cmake/top_level_default.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,44 @@ if (PROJECT_IS_TOP_LEVEL)
endif()
endif()

if (APPLE)
if (${CLAP_WRAPPER_BUILD_AUV3})
add_executable(${pluginname}_as_auv3)
target_add_auv3_wrapper(
TARGET ${pluginname}_as_auv3
OUTPUT_NAME "${CLAP_WRAPPER_OUTPUT_NAME}"
BUNDLE_IDENTIFIER "${CLAP_WRAPPER_BUNDLE_IDENTIFIER}"
BUNDLE_VERSION "${CLAP_WRAPPER_BUNDLE_VERSION}"

INSTRUMENT_TYPE "aumu"
MANUFACTURER_NAME "cleveraudio.org"
MANUFACTURER_CODE "clAd"
SUBTYPE_CODE "gWrq"
)

# Embed the installed .clap into the appex so it can find the plugin at runtime
set(_clap_bundle_name "${CLAP_WRAPPER_OUTPUT_NAME}.clap")
set(_clap_embed_dst "$<TARGET_BUNDLE_DIR:${pluginname}_as_auv3>/Contents/PlugIns/${_clap_bundle_name}")
add_custom_command(TARGET ${pluginname}_as_auv3 POST_BUILD
COMMAND ${CMAKE_COMMAND} "-DCLAP_NAME=${_clap_bundle_name}" "-DDST=${_clap_embed_dst}"
-P "${CLAP_WRAPPER_CMAKE_CURRENT_SOURCE_DIR}/cmake/embed_clap.cmake"
COMMENT "Embedding ${_clap_bundle_name} in AUv3 appex"
)

add_executable(${pluginname}_as_auv3_standalone)
target_add_auv3_standalone_wrapper(
TARGET ${pluginname}_as_auv3_standalone
OUTPUT_NAME "${CLAP_WRAPPER_OUTPUT_NAME} AUv3"
BUNDLE_IDENTIFIER "${CLAP_WRAPPER_BUNDLE_IDENTIFIER}"
BUNDLE_VERSION "${CLAP_WRAPPER_BUNDLE_VERSION}"
AUV3_TARGET ${pluginname}_as_auv3
AU_TYPE "aumu"
AU_SUBTYPE "gWwp"
AU_MANUFACTURER "clAA"
)
endif()
endif()

if (${CLAP_WRAPPER_BUILD_STANDALONE})
add_executable(${pluginname}_as_standalone)
target_add_standalone_wrapper(TARGET ${pluginname}_as_standalone
Expand Down
Loading
Loading