Skip to content

Commit 3c0f2a3

Browse files
committed
Finally all working
1 parent 3e7ab73 commit 3c0f2a3

7 files changed

Lines changed: 493 additions & 43 deletions

File tree

CMakeLists.txt

Lines changed: 16 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,9 +36,13 @@ set_property (GLOBAL PROPERTY USE_FOLDERS ON)
3636
# Options
3737
option (YUP_TARGET_ANDROID "Target Android project" OFF)
3838
option (YUP_TARGET_ANDROID_BUILD_GRADLE "When building for Android, build the gradle infrastructure" OFF)
39+
option (YUP_EXPORT_MODULES "Export the modules to the parent project" ON)
3940
option (YUP_ENABLE_PROFILING "Enable the profiling code using Perfetto SDK" OFF)
4041
option (YUP_ENABLE_COVERAGE "Enable code coverage collection for tests" OFF)
41-
option (YUP_EXPORT_MODULES "Export the modules to the parent project" ON)
42+
option (YUP_ENABLE_VST3_VALIDATOR "Enable the Steinberg VST3 validator for VST3 plugins" ${PROJECT_IS_TOP_LEVEL})
43+
option (YUP_ENABLE_CLAP_VALIDATOR "Enable clap-validator validation for CLAP plugins" ${PROJECT_IS_TOP_LEVEL})
44+
option (YUP_ENABLE_AUVAL_VALIDATOR "Enable auval validation for AU plugins" ${PROJECT_IS_TOP_LEVEL})
45+
option (YUP_ENABLE_PLUGINVAL "Enable pluginval validation for VST3/AU plugins" ${PROJECT_IS_TOP_LEVEL})
4246
option (YUP_ENABLE_STATIC_PYTHON_LIBS "Use static Python libraries" OFF)
4347
option (YUP_BUILD_JAVA_SUPPORT "Build the Java support" OFF)
4448
option (YUP_BUILD_EXAMPLES "Build the examples" ${PROJECT_IS_TOP_LEVEL})
@@ -70,6 +74,17 @@ if (YUP_ENABLE_PROFILING)
7074
_yup_fetch_perfetto()
7175
endif()
7276

77+
# Setup validation tools
78+
if (YUP_ENABLE_PLUGINVAL)
79+
_yup_message (STATUS "Setting up pluginval")
80+
yup_setup_pluginval()
81+
endif()
82+
83+
if (YUP_ENABLE_CLAP_VALIDATOR)
84+
_yup_message (STATUS "Setting up clap-validator")
85+
yup_setup_clap_validator()
86+
endif()
87+
7388
# Targets
7489
if (YUP_BUILD_EXAMPLES)
7590
_yup_message (STATUS "Building examples")

cmake/yup.cmake

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -95,6 +95,8 @@ include (${CMAKE_CURRENT_LIST_DIR}/yup_utilities.cmake)
9595
include (${CMAKE_CURRENT_LIST_DIR}/yup_dependencies.cmake)
9696
include (${CMAKE_CURRENT_LIST_DIR}/yup_modules.cmake)
9797
include (${CMAKE_CURRENT_LIST_DIR}/yup_standalone.cmake)
98+
include (${CMAKE_CURRENT_LIST_DIR}/yup_pluginval.cmake)
99+
include (${CMAKE_CURRENT_LIST_DIR}/yup_codesign.cmake)
98100
include (${CMAKE_CURRENT_LIST_DIR}/yup_audio_plugin.cmake)
99101
include (${CMAKE_CURRENT_LIST_DIR}/yup_embed_binary.cmake)
100102
include (${CMAKE_CURRENT_LIST_DIR}/yup_python.cmake)

cmake/yup_audio_plugin.cmake

Lines changed: 64 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -120,7 +120,11 @@ function (yup_audio_plugin)
120120

121121
# Create CLAP plugin target
122122
_yup_message (STATUS "Creating CLAP plugin target")
123-
add_library (${target_name}_clap_plugin SHARED)
123+
if (YUP_PLATFORM_MAC)
124+
add_library (${target_name}_clap_plugin MODULE)
125+
else()
126+
add_library (${target_name}_clap_plugin SHARED)
127+
endif()
124128

125129
target_compile_features (${target_name}_clap_plugin PRIVATE cxx_std_20)
126130

@@ -150,10 +154,30 @@ function (yup_audio_plugin)
150154
OBJC_VISIBILITY_PRESET hidden
151155
OBJCXX_VISIBILITY_PRESET hidden
152156
VISIBILITY_INLINES_HIDDEN ON
153-
SUFFIX ".clap"
154157
FOLDER "${YUP_ARG_TARGET_IDE_GROUP}"
155158
XCODE_GENERATE_SCHEME ON)
156159

160+
if (YUP_PLATFORM_MAC)
161+
set_target_properties (${target_name}_clap_plugin PROPERTIES
162+
BUNDLE TRUE
163+
BUNDLE_EXTENSION "clap"
164+
MACOSX_BUNDLE TRUE
165+
MACOSX_BUNDLE_BUNDLE_NAME "${target_name}_clap_plugin"
166+
MACOSX_BUNDLE_GUI_IDENTIFIER "${target_bundle_id}.clap"
167+
PREFIX "")
168+
169+
set (clap_plugin_path "$<TARGET_BUNDLE_DIR:${target_name}_clap_plugin>")
170+
else()
171+
set_target_properties (${target_name}_clap_plugin PROPERTIES
172+
SUFFIX ".clap")
173+
174+
set (clap_plugin_path "$<TARGET_FILE:${target_name}_clap_plugin>")
175+
endif()
176+
177+
yup_codesign_target (${target_name}_clap_plugin "${clap_plugin_path}")
178+
179+
yup_validate_clap_plugin (${target_name}_clap_plugin "${clap_plugin_path}")
180+
157181
yup_audio_plugin_copy_bundle (${target_name} clap)
158182
endif()
159183

@@ -201,27 +225,6 @@ function (yup_audio_plugin)
201225
${additional_libraries}
202226
${YUP_ARG_MODULES})
203227

204-
if (YUP_PLATFORM_MAC)
205-
smtg_target_set_bundle (${target_name}_vst3_plugin
206-
BUNDLE_IDENTIFIER "${target_bundle_id}"
207-
COMPANY_NAME "kunitoki")
208-
209-
#smtg_target_set_debug_executable(MyPlugin
210-
# "/Applications/VST3PluginTestHost.app"
211-
# "--pluginfolder;$(BUILT_PRODUCTS_DIR)")
212-
213-
if (NOT XCODE)
214-
add_custom_command(
215-
TARGET ${target_name}_vst3_plugin POST_BUILD
216-
COMMAND ${CMAKE_COMMAND} -E echo [SMTG] Validator started...
217-
COMMAND
218-
$<TARGET_FILE:validator>
219-
"${CMAKE_BINARY_DIR}/VST3/${CMAKE_BUILD_TYPE}/${CMAKE_BUILD_TYPE}/${target_name}_vst3_plugin.vst3"
220-
WORKING_DIRECTORY "${CMAKE_RUNTIME_OUTPUT_DIRECTORY}"
221-
COMMAND ${CMAKE_COMMAND} -E echo [SMTG] Validator finished.)
222-
endif()
223-
endif()
224-
225228
set_target_properties (${target_name}_vst3_plugin PROPERTIES
226229
C_VISIBILITY_PRESET hidden
227230
CXX_VISIBILITY_PRESET hidden
@@ -232,6 +235,27 @@ function (yup_audio_plugin)
232235
FOLDER "${YUP_ARG_TARGET_IDE_GROUP}"
233236
XCODE_GENERATE_SCHEME ON)
234237

238+
set (vst3_plugin_binary_path "$<TARGET_FILE:${target_name}_vst3_plugin>")
239+
set (vst3_pluginval_path "${vst3_plugin_binary_path}")
240+
get_target_property (vst3_plugin_package_path ${target_name}_vst3_plugin SMTG_PLUGIN_PACKAGE_PATH)
241+
if (vst3_plugin_package_path)
242+
set (vst3_pluginval_path "${vst3_plugin_package_path}")
243+
else()
244+
set (vst3_plugin_package_path "${vst3_plugin_binary_path}")
245+
endif()
246+
if (YUP_PLATFORM_MAC)
247+
smtg_target_set_bundle (${target_name}_vst3_plugin
248+
BUNDLE_IDENTIFIER "${target_bundle_id}"
249+
COMPANY_NAME "kunitoki") # TODO - make company name configurable
250+
if ("${vst3_plugin_package_path}" STREQUAL "${vst3_plugin_binary_path}")
251+
set (vst3_plugin_package_path "$<TARGET_BUNDLE_DIR:${target_name}_vst3_plugin>")
252+
endif()
253+
set (vst3_pluginval_path "${vst3_plugin_package_path}")
254+
endif()
255+
yup_validate_smtg_vst3_plugin (${target_name}_vst3_plugin "${vst3_plugin_package_path}")
256+
257+
yup_validate_pluginval (${target_name}_vst3_plugin "${vst3_pluginval_path}")
258+
235259
yup_audio_plugin_copy_bundle (${target_name} vst3)
236260
endif()
237261

@@ -375,7 +399,22 @@ function (yup_audio_plugin)
375399
COMMENT "Generating AU PkgInfo"
376400
VERBATIM)
377401

402+
yup_codesign_target (${target_name}_au_plugin "$<TARGET_BUNDLE_DIR:${target_name}_au_plugin>")
403+
378404
yup_audio_plugin_copy_bundle (${target_name} au)
405+
406+
set (au_pluginval_path "$ENV{HOME}/Library/Audio/Plug-Ins/Components/${target_name}_au_plugin.component")
407+
408+
yup_validate_au_plugin (
409+
${target_name}_au_plugin
410+
"${AU_ARGS_PLUGIN_NAME}"
411+
"${au_bundle_type}"
412+
"${AU_ARGS_PLUGIN_AU_SUBTYPE}"
413+
"${AU_ARGS_PLUGIN_AU_MANUFACTURER}")
414+
415+
yup_validate_pluginval (
416+
${target_name}_au_plugin
417+
"${au_pluginval_path}")
379418
endif()
380419
endif()
381420

@@ -431,8 +470,8 @@ function (yup_audio_plugin_copy_bundle target_name plugin_type)
431470
if ("${plugin_type}" STREQUAL "clap")
432471
add_custom_command(TARGET ${dependency_target} POST_BUILD
433472
COMMAND ${CMAKE_COMMAND} -E make_directory "${plugin_target_path}"
434-
COMMAND ${CMAKE_COMMAND} -E rm -f "${plugin_path}"
435-
COMMAND ${CMAKE_COMMAND} -E create_symlink "$<TARGET_FILE:${dependency_target}>" "${plugin_path}"
473+
COMMAND ${CMAKE_COMMAND} -E rm -rf "${plugin_path}"
474+
COMMAND ${CMAKE_COMMAND} -E create_symlink "$<TARGET_BUNDLE_DIR:${dependency_target}>" "${plugin_path}"
436475
COMMENT "Symlinking CLAP plugin ${plugin_type_upper} plugin to ${plugin_path}"
437476
VERBATIM)
438477
elseif ("${plugin_type}" STREQUAL "vst3")
@@ -450,7 +489,6 @@ function (yup_audio_plugin_copy_bundle target_name plugin_type)
450489
add_custom_command(TARGET ${dependency_target} POST_BUILD
451490
COMMAND ${CMAKE_COMMAND} -E rm -rf "${plugin_path}"
452491
COMMAND ${CMAKE_COMMAND} -E copy_directory "$<TARGET_BUNDLE_DIR:${dependency_target}>" "${plugin_path}"
453-
COMMAND codesign --force --sign - "${plugin_path}"
454492
COMMENT "Copying AU plugin ${plugin_type_upper} to ${plugin_path}"
455493
VERBATIM)
456494
else()

cmake/yup_codesign.cmake

Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
# ==============================================================================
2+
#
3+
# This file is part of the YUP library.
4+
# Copyright (c) 2026 - kunitoki@gmail.com
5+
#
6+
# YUP is an open source library subject to open-source licensing.
7+
#
8+
# The code included in this file is provided under the terms of the ISC license
9+
# http://www.isc.org/downloads/software-support-policy/isc-license. Permission
10+
# To use, copy, modify, and/or distribute this software for any purpose with or
11+
# without fee is hereby granted provided that the above copyright notice and
12+
# this permission notice appear in all copies.
13+
#
14+
# YUP IS PROVIDED "AS IS" WITHOUT ANY WARRANTY, AND ALL WARRANTIES, WHETHER
15+
# EXPRESSED OR IMPLIED, INCLUDING MERCHANTABILITY AND FITNESS FOR PURPOSE, ARE
16+
# DISCLAIMED.
17+
#
18+
# ==============================================================================
19+
20+
# ==============================================================================
21+
22+
function (yup_codesign_target target_name bundle_path)
23+
if (NOT YUP_PLATFORM_MAC)
24+
return()
25+
endif()
26+
27+
add_custom_command (TARGET ${target_name} POST_BUILD
28+
COMMAND codesign --force --sign - "${bundle_path}"
29+
COMMENT "Codesigning ${target_name}"
30+
VERBATIM)
31+
endfunction()

0 commit comments

Comments
 (0)