Skip to content

Commit 50dd616

Browse files
committed
Enable pluginval integration
1 parent ff3114f commit 50dd616

File tree

4 files changed

+154
-1
lines changed

4 files changed

+154
-1
lines changed

CMakeLists.txt

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,9 +34,10 @@ set_property (GLOBAL PROPERTY USE_FOLDERS ON)
3434
# Options
3535
option (YUP_TARGET_ANDROID "Target Android project" OFF)
3636
option (YUP_TARGET_ANDROID_BUILD_GRADLE "When building for Android, build the gradle infrastructure" OFF)
37+
option (YUP_EXPORT_MODULES "Export the modules to the parent project" ON)
3738
option (YUP_ENABLE_PROFILING "Enable the profiling code using Perfetto SDK" OFF)
3839
option (YUP_ENABLE_COVERAGE "Enable code coverage collection for tests" OFF)
39-
option (YUP_EXPORT_MODULES "Export the modules to the parent project" ON)
40+
option (YUP_ENABLE_PLUGINVAL "Enable pluginval validation for VST3 plugins" OFF)
4041
option (YUP_ENABLE_STATIC_PYTHON_LIBS "Use static Python libraries" OFF)
4142
option (YUP_BUILD_JAVA_SUPPORT "Build the Java support" OFF)
4243
option (YUP_BUILD_EXAMPLES "Build the examples" ${PROJECT_IS_TOP_LEVEL})
@@ -67,6 +68,12 @@ if (YUP_ENABLE_PROFILING)
6768
_yup_fetch_perfetto()
6869
endif()
6970

71+
# Setup pluginval
72+
if (YUP_ENABLE_PLUGINVAL)
73+
_yup_message (STATUS "Setting up pluginval")
74+
yup_setup_pluginval()
75+
endif()
76+
7077
# Targets
7178
if (YUP_BUILD_EXAMPLES)
7279
_yup_message (STATUS "Building examples")

cmake/yup.cmake

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -94,6 +94,7 @@ include (${CMAKE_CURRENT_LIST_DIR}/yup_audio_plugin.cmake)
9494
include (${CMAKE_CURRENT_LIST_DIR}/yup_embed_binary.cmake)
9595
include (${CMAKE_CURRENT_LIST_DIR}/yup_android_java.cmake)
9696
include (${CMAKE_CURRENT_LIST_DIR}/yup_python.cmake)
97+
include (${CMAKE_CURRENT_LIST_DIR}/yup_pluginval.cmake)
9798

9899
#==============================================================================
99100

cmake/yup_audio_plugin.cmake

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -209,6 +209,11 @@ function (yup_audio_plugin)
209209
FOLDER "${YUP_ARG_TARGET_IDE_GROUP}"
210210
XCODE_GENERATE_SCHEME ON)
211211

212+
# Add pluginval validation if enabled
213+
if (YUP_ENABLE_PLUGINVAL)
214+
yup_validate_plugin (${target_name}_vst3_plugin "$<TARGET_FILE:${target_name}_vst3_plugin>")
215+
endif()
216+
212217
yup_audio_plugin_copy_bundle (${target_name} vst3)
213218
endif()
214219

cmake/yup_pluginval.cmake

Lines changed: 140 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,140 @@
1+
# ==============================================================================
2+
#
3+
# This file is part of the YUP library.
4+
# Copyright (c) 2025 - [email protected]
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+
set (PLUGINVAL_VERSION "v1.0.4")
23+
24+
# ==============================================================================
25+
26+
function (yup_setup_pluginval)
27+
if (NOT YUP_ENABLE_PLUGINVAL)
28+
return()
29+
endif()
30+
31+
# Only supported on desktop platforms
32+
if (NOT YUP_PLATFORM_DESKTOP)
33+
_yup_message (WARNING "pluginval is only supported on desktop platforms")
34+
return()
35+
endif()
36+
37+
# Determine platform-specific download URL and executable name
38+
if (YUP_PLATFORM_WINDOWS)
39+
if (CMAKE_SIZEOF_VOID_P EQUAL 8)
40+
set (PLUGINVAL_PLATFORM "Windows")
41+
set (PLUGINVAL_ARCHIVE "pluginval_Windows.zip")
42+
else()
43+
_yup_message (WARNING "pluginval does not support 32-bit Windows")
44+
return()
45+
endif()
46+
set (PLUGINVAL_EXECUTABLE "pluginval.exe")
47+
elseif (YUP_PLATFORM_MAC)
48+
set (PLUGINVAL_PLATFORM "macOS")
49+
set (PLUGINVAL_ARCHIVE "pluginval_macOS.zip")
50+
set (PLUGINVAL_EXECUTABLE "pluginval.app/Contents/MacOS/pluginval")
51+
elseif (YUP_PLATFORM_LINUX)
52+
set (PLUGINVAL_PLATFORM "Linux")
53+
set (PLUGINVAL_ARCHIVE "pluginval_Linux.zip")
54+
set (PLUGINVAL_EXECUTABLE "pluginval")
55+
else()
56+
_yup_message (WARNING "Unsupported platform for pluginval")
57+
return()
58+
endif()
59+
60+
# Set up download URL
61+
set (PLUGINVAL_URL "https://github.com/Tracktion/pluginval/releases/download/${PLUGINVAL_VERSION}/${PLUGINVAL_ARCHIVE}")
62+
63+
# Set up local paths
64+
set (PLUGINVAL_DIR "${CMAKE_BINARY_DIR}/pluginval")
65+
set (PLUGINVAL_ARCHIVE_PATH "${PLUGINVAL_DIR}/${PLUGINVAL_ARCHIVE}")
66+
set (PLUGINVAL_EXECUTABLE_PATH "${PLUGINVAL_DIR}/${PLUGINVAL_EXECUTABLE}")
67+
68+
# Create pluginval directory
69+
file (MAKE_DIRECTORY "${PLUGINVAL_DIR}")
70+
71+
# Download pluginval if not already present
72+
if (NOT EXISTS "${PLUGINVAL_EXECUTABLE_PATH}")
73+
_yup_message (STATUS "Downloading pluginval ${PLUGINVAL_VERSION} for ${PLUGINVAL_PLATFORM}")
74+
75+
# Download the archive
76+
file (DOWNLOAD "${PLUGINVAL_URL}" "${PLUGINVAL_ARCHIVE_PATH}"
77+
SHOW_PROGRESS
78+
STATUS DOWNLOAD_STATUS)
79+
80+
# Check if download was successful
81+
list (GET DOWNLOAD_STATUS 0 DOWNLOAD_ERROR)
82+
if (NOT DOWNLOAD_ERROR EQUAL 0)
83+
list (GET DOWNLOAD_STATUS 1 DOWNLOAD_ERROR_MESSAGE)
84+
_yup_message (FATAL_ERROR "Failed to download pluginval: ${DOWNLOAD_ERROR_MESSAGE}")
85+
endif()
86+
87+
# Extract the archive
88+
_yup_message (STATUS "Extracting pluginval archive")
89+
execute_process(
90+
COMMAND ${CMAKE_COMMAND} -E tar xzf "${PLUGINVAL_ARCHIVE_PATH}"
91+
WORKING_DIRECTORY "${PLUGINVAL_DIR}"
92+
RESULT_VARIABLE EXTRACT_RESULT)
93+
94+
if (NOT EXTRACT_RESULT EQUAL 0)
95+
_yup_message (FATAL_ERROR "Failed to extract pluginval archive")
96+
endif()
97+
98+
# Make executable (Posix platforms)
99+
if (YUP_PLATFORM_POSIX)
100+
execute_process(
101+
COMMAND chmod +x "${PLUGINVAL_EXECUTABLE_PATH}"
102+
RESULT_VARIABLE CHMOD_RESULT)
103+
104+
if (NOT CHMOD_RESULT EQUAL 0)
105+
_yup_message (WARNING "Failed to make pluginval executable")
106+
endif()
107+
endif()
108+
109+
# Clean up archive
110+
file (REMOVE "${PLUGINVAL_ARCHIVE_PATH}")
111+
endif()
112+
113+
# Verify pluginval executable exists
114+
if (NOT EXISTS "${PLUGINVAL_EXECUTABLE_PATH}")
115+
_yup_message (FATAL_ERROR "pluginval executable not found at: ${PLUGINVAL_EXECUTABLE_PATH}")
116+
endif()
117+
118+
# Set global variable for use in other cmake files
119+
set (PLUGINVAL_EXECUTABLE "${PLUGINVAL_EXECUTABLE_PATH}" CACHE INTERNAL "Path to pluginval executable")
120+
121+
_yup_message (STATUS "pluginval is available at: ${PLUGINVAL_EXECUTABLE_PATH}")
122+
endfunction()
123+
124+
# ==============================================================================
125+
126+
function (yup_validate_plugin target_name plugin_path)
127+
if (NOT YUP_ENABLE_PLUGINVAL OR NOT PLUGINVAL_EXECUTABLE)
128+
return()
129+
endif()
130+
131+
set (validation_target_name "${target_name}_pluginval")
132+
133+
add_custom_command(
134+
TARGET ${target_name} POST_BUILD
135+
COMMAND ${CMAKE_COMMAND} -E echo "[PLUGINVAL] Starting validation of ${target_name}..."
136+
COMMAND "${PLUGINVAL_EXECUTABLE}" --strictness-level 5 --validate-in-process --output-dir "${CMAKE_BINARY_DIR}/pluginval_reports" "${plugin_path}"
137+
COMMAND ${CMAKE_COMMAND} -E echo "[PLUGINVAL] Validation of ${target_name} completed"
138+
COMMENT "Running pluginval validation on ${target_name}"
139+
VERBATIM)
140+
endfunction()

0 commit comments

Comments
 (0)