From 2506d4c6b72692eff5e5a98235a01dd03f870765 Mon Sep 17 00:00:00 2001 From: Sudara Date: Wed, 4 Dec 2024 12:41:13 +0100 Subject: [PATCH 01/12] Guard standalone logic with pluginval_IS_TOP_LEVEL --- CMakeLists.txt | 50 +++++++++++++++++++++++++++++--------------------- 1 file changed, 29 insertions(+), 21 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index a2073e3..fe1f2e7 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -3,16 +3,24 @@ cmake_minimum_required(VERSION 3.15) file(STRINGS VERSION CURRENT_VERSION LIMIT_COUNT 1) project(pluginval VERSION ${CURRENT_VERSION}) -if (APPLE) - # Target OS versions down to 10.11 - set (CMAKE_OSX_DEPLOYMENT_TARGET "10.11" CACHE INTERNAL "") - - # Uncomment to produce a universal binary - # set(CMAKE_OSX_ARCHITECTURES arm64 x86_64) - set(PLUGINVAL_ENABLE_RTCHECK ON) -elseif (CMAKE_SYSTEM_NAME STREQUAL "Linux") - # Disable rtcheck on Linux for now until further testing on real Linux systems has been done - # set(PLUGINVAL_ENABLE_RTCHECK ON) +# Executes when not compiling as a "dependency" of another CMake project +if (pluginval_IS_TOP_LEVEL) + if (APPLE) + # Target OS versions down to 10.11 + set (CMAKE_OSX_DEPLOYMENT_TARGET "10.11" CACHE INTERNAL "") + + # Uncomment to produce a universal binary + # set(CMAKE_OSX_ARCHITECTURES arm64 x86_64) + set(PLUGINVAL_ENABLE_RTCHECK ON) + elseif (CMAKE_SYSTEM_NAME STREQUAL "Linux") + # Disable rtcheck on Linux for now until further testing on real Linux systems has been done + # set(PLUGINVAL_ENABLE_RTCHECK ON) + endif() +else() + # compiling as a "dependency" of another JUCE CMake project + if (NOT COMMAND juce_add_module) + message(FATAL_ERROR "JUCE must be added to your project before pluginval!") + endif () endif() # sanitizer options, from https://github.com/sudara/cmake-includes/blob/main/Sanitizers.cmake @@ -52,11 +60,9 @@ if(PLUGINVAL_ENABLE_RTCHECK) CPMAddPackage("gh:Tracktion/rtcheck#main") endif() - -option(PLUGINVAL_FETCH_JUCE "Fetch JUCE along with pluginval" ON) - -if(PLUGINVAL_FETCH_JUCE) - add_subdirectory(modules/juce) +# Only fetch JUCE when top-level (when used as dependency, JUCE is already available) +if (pluginval_IS_TOP_LEVEL) + CPMAddPackage("gh:juce-framework/juce#8.0.3") endif() if (DEFINED ENV{VST2_SDK_DIR}) @@ -151,11 +157,13 @@ if (PLUGINVAL_ENABLE_RTCHECK) endif () endif() -set (cmdline_docs_out "${CMAKE_CURRENT_LIST_DIR}/docs/Command line options.md") +if (pluginval_IS_TOP_LEVEL) + set (cmdline_docs_out "${CMAKE_CURRENT_LIST_DIR}/docs/Command line options.md") -add_custom_command (OUTPUT "${cmdline_docs_out}" - COMMAND pluginval --help > "${cmdline_docs_out}" - COMMENT "Regenerating Command line options.md..." - USES_TERMINAL) + add_custom_command (OUTPUT "${cmdline_docs_out}" + COMMAND pluginval --help > "${cmdline_docs_out}" + COMMENT "Regenerating Command line options.md..." + USES_TERMINAL) -add_custom_target (PluginvalDocs DEPENDS "${cmdline_docs_out}") + add_custom_target (PluginvalDocs DEPENDS "${cmdline_docs_out}") +endif() From dcd222a68e3d5b0dd71cc0ffa04a2bcea532ab1d Mon Sep 17 00:00:00 2001 From: Sudara Date: Wed, 4 Dec 2024 16:47:50 +0100 Subject: [PATCH 02/12] Add a custom target when not top level --- CMakeLists.txt | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/CMakeLists.txt b/CMakeLists.txt index fe1f2e7..1abe97f 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -21,6 +21,22 @@ else() if (NOT COMMAND juce_add_module) message(FATAL_ERROR "JUCE must be added to your project before pluginval!") endif () + + option(PLUGINVAL_STRICTNESS_LEVEL "Pluginval --strictness argument" 10) + + if(APPLE) + set(PLUGIN_TARGET "${CMAKE_PROJECT_NAME}_AU") + else() + set(PLUGIN_TARGET "${CMAKE_PROJECT_NAME}_VST3") + endif() + + add_custom_target(${CMAKE_PROJECT_NAME}_Pluginval + COMMAND + pluginval + --validate ${artefact} + --strictness-level ${PLUGINVAL_STRICTNESS_LEVEL} + DEPENDS ${PLUGIN_TARGET} pluginval + VERBATIM) endif() # sanitizer options, from https://github.com/sudara/cmake-includes/blob/main/Sanitizers.cmake From 94bab6710eab56790c9958847bb10a68d26fff71 Mon Sep 17 00:00:00 2001 From: Sudara Date: Wed, 4 Dec 2024 18:08:05 +0100 Subject: [PATCH 03/12] Add CLI option when dependency. Only compile docs when top-level. --- CMakeLists.txt | 41 +++++++++++++++++++++++------------------ 1 file changed, 23 insertions(+), 18 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 1abe97f..323a98b 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -3,7 +3,7 @@ cmake_minimum_required(VERSION 3.15) file(STRINGS VERSION CURRENT_VERSION LIMIT_COUNT 1) project(pluginval VERSION ${CURRENT_VERSION}) -# Executes when not compiling as a "dependency" of another CMake project +# Just compliing pluginval if (pluginval_IS_TOP_LEVEL) if (APPLE) # Target OS versions down to 10.11 @@ -21,22 +21,6 @@ else() if (NOT COMMAND juce_add_module) message(FATAL_ERROR "JUCE must be added to your project before pluginval!") endif () - - option(PLUGINVAL_STRICTNESS_LEVEL "Pluginval --strictness argument" 10) - - if(APPLE) - set(PLUGIN_TARGET "${CMAKE_PROJECT_NAME}_AU") - else() - set(PLUGIN_TARGET "${CMAKE_PROJECT_NAME}_VST3") - endif() - - add_custom_target(${CMAKE_PROJECT_NAME}_Pluginval - COMMAND - pluginval - --validate ${artefact} - --strictness-level ${PLUGINVAL_STRICTNESS_LEVEL} - DEPENDS ${PLUGIN_TARGET} pluginval - VERBATIM) endif() # sanitizer options, from https://github.com/sudara/cmake-includes/blob/main/Sanitizers.cmake @@ -180,6 +164,27 @@ if (pluginval_IS_TOP_LEVEL) COMMAND pluginval --help > "${cmdline_docs_out}" COMMENT "Regenerating Command line options.md..." USES_TERMINAL) - add_custom_target (PluginvalDocs DEPENDS "${cmdline_docs_out}") +else() + # Custom pluginval CLI target + set(PLUGINVAL_STRICTNESS_LEVEL 10 CACHE STRING "Pluginval --strictness argument (1-10)") + set_property(CACHE PLUGINVAL_STRICTNESS_LEVEL PROPERTY STRINGS 1 2 3 4 5 6 7 8 9 10) + + # Set the target based on the platform + # Makes the assumption both are being built + if(APPLE) + set(PLUGINVAL_TARGET "${CMAKE_PROJECT_NAME}_AU") + else() + set(PLUGINVAL_TARGET "${CMAKE_PROJECT_NAME}_VST3") + endif() + + get_target_property(artefact ${PLUGINVAL_TARGET} JUCE_PLUGIN_ARTEFACT_FILE) + + # TODO: This doesn't populate the executable in clion + add_custom_target(${CMAKE_PROJECT_NAME}_pluginval_cli + COMMAND $ + --validate ${artefact} + --strictness-level 10 + DEPENDS pluginval ${PLUGINVAL_TARGET} + COMMENT "Run pluginval CLI with strict validation") endif() From 4d3a427dc97a38ab1f740e2bbbe1084a4841aa30 Mon Sep 17 00:00:00 2001 From: Sudara Date: Fri, 6 Dec 2024 23:36:19 +0100 Subject: [PATCH 04/12] Move JUCE depedency from git submodule to CPM --- .gitmodules | 4 ---- 1 file changed, 4 deletions(-) delete mode 100644 .gitmodules diff --git a/.gitmodules b/.gitmodules deleted file mode 100644 index b03a59d..0000000 --- a/.gitmodules +++ /dev/null @@ -1,4 +0,0 @@ -[submodule "modules/juce"] - path = modules/juce - url = https://github.com/juce-framework/JUCE - branch = develop From 7ee680406b6d916b71eb84143a189ebe4f221d2c Mon Sep 17 00:00:00 2001 From: Sudara Date: Fri, 6 Dec 2024 23:45:07 +0100 Subject: [PATCH 05/12] Actions have cached the module, lets not checkout the submodule --- .github/workflows/build.yaml | 2 -- 1 file changed, 2 deletions(-) diff --git a/.github/workflows/build.yaml b/.github/workflows/build.yaml index 9369e6c..45e91b1 100644 --- a/.github/workflows/build.yaml +++ b/.github/workflows/build.yaml @@ -48,8 +48,6 @@ jobs: apt install -y sudo cmake curl tree - uses: actions/checkout@v4 - with: - submodules: true - name: Setup Environment Variables shell: bash From d507a4f6bf56b26f003ec18e04a681e567c86202 Mon Sep 17 00:00:00 2001 From: Sudara Date: Fri, 6 Dec 2024 23:45:32 +0100 Subject: [PATCH 06/12] Remove modules/juce --- modules/juce | 1 - 1 file changed, 1 deletion(-) delete mode 160000 modules/juce diff --git a/modules/juce b/modules/juce deleted file mode 160000 index a2a9c54..0000000 --- a/modules/juce +++ /dev/null @@ -1 +0,0 @@ -Subproject commit a2a9c54e31d090e5d1f9c2e23f160fff2556f9ec From 28a71d02ddcdfd65495a3b5784f01f9ca67b2336 Mon Sep 17 00:00:00 2001 From: Sudara Date: Fri, 6 Dec 2024 23:06:29 +0100 Subject: [PATCH 07/12] Add docs for installing as a dep --- README.md | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) diff --git a/README.md b/README.md index ae280f5..d130e26 100644 --- a/README.md +++ b/README.md @@ -32,6 +32,24 @@ cmake -B Builds/Debug -DCMAKE_BUILD_TYPE=Debug . # configure cmake --build Builds/Debug --config Debug # build ``` +### Including within an existing JUCE project + +Instead of running as a separate app, you can add pluginval as a CMake target to your existing plugin project. This not only makes for a convenient debugging workflow, it gives you better stack traces. + +For example, if you add pluginval as a git submodule like so: +``` +git submodule add -b develop git@github.com:Tracktion/pluginval.git modules/pluginval +``` + +or added with CPM like so: + +``` +CPMAddPackage("gh:tracktion/pluginval#develop") +``` + +Then all you need to do is call `add_subdirectory ("modules/pluginval")` in your `CMakeLists.txt`. This should be done **after** your call to `juce_add_plugin`. + + ### Third-party Installation ###### _Chocolatey (Windows):_ ```shell From c7926d1c934bfe12872bd95e655ff30904ad3b9b Mon Sep 17 00:00:00 2001 From: Sudara Date: Sat, 7 Dec 2024 00:07:17 +0100 Subject: [PATCH 08/12] Revert to 8.0.3 and clear ccache --- .github/workflows/build.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/build.yaml b/.github/workflows/build.yaml index 45e91b1..0f8d47b 100644 --- a/.github/workflows/build.yaml +++ b/.github/workflows/build.yaml @@ -88,7 +88,7 @@ jobs: - name: ccache uses: hendrikmuhs/ccache-action@v1.2 with: - key: v2-${{ matrix.name }}-${{ env.BUILD_TYPE }} + key: v3-${{ matrix.name }}-${{ env.BUILD_TYPE }} - name: Configure shell: bash From 0cd2c3beb63b4e2fe6f5660399023b10c322d820 Mon Sep 17 00:00:00 2001 From: Sudara Date: Sat, 7 Dec 2024 14:46:17 +0100 Subject: [PATCH 09/12] CI: JUCE is now built in _deps, break plugin cache --- .github/workflows/build.yaml | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/.github/workflows/build.yaml b/.github/workflows/build.yaml index 0f8d47b..5b2f2e3 100644 --- a/.github/workflows/build.yaml +++ b/.github/workflows/build.yaml @@ -61,7 +61,7 @@ jobs: # This needs to be absolute to make action/cache happy WORKING_DIR=$(pwd) - echo "PLUGIN_CACHE_PATH=$WORKING_DIR/modules/juce/Builds/examples/Plugins" >> $GITHUB_ENV + echo "PLUGIN_CACHE_PATH=$WORKING_DIR/_deps/juce-build/examples/Plugins" >> $GITHUB_ENV - name: Install dependencies (Linux) if: ${{ matrix.name == 'Linux' }} @@ -112,11 +112,10 @@ jobs: with: path: ${{ env.PLUGIN_CACHE_PATH }} # Increment the version in the key below to manually break plugin cache - key: v7-${{ runner.os }}-${{ env.JUCE_SHA1 }} + key: v8-${{ runner.os }}-${{ env.JUCE_SHA1 }} - name: Build JUCE example plugins if: steps.cache-plugins.outputs.cache-hit != 'true' - working-directory: modules/juce shell: bash run: | cmake -B Builds -DJUCE_BUILD_EXAMPLES=ON -DCMAKE_BUILD_TYPE=Release -DCMAKE_C_COMPILER_LAUNCHER=ccache -DCMAKE_CXX_COMPILER_LAUNCHER=ccache . From bd4e55895b0583d0575c159aa562b88ffe8ef36b Mon Sep 17 00:00:00 2001 From: Sudara Date: Mon, 1 Dec 2025 18:25:28 +0100 Subject: [PATCH 10/12] Support JUCE 8.0.11 (addDefaultFormats is removed) --- Source/CommandLine.cpp | 4 ++++ Source/MainComponent.cpp | 4 ++++ Source/PluginTests.cpp | 4 ++++ 3 files changed, 12 insertions(+) diff --git a/Source/CommandLine.cpp b/Source/CommandLine.cpp index 1082c47..426c45c 100644 --- a/Source/CommandLine.cpp +++ b/Source/CommandLine.cpp @@ -241,7 +241,11 @@ namespace bool isPluginArgument (juce::String arg) { juce::AudioPluginFormatManager formatManager; + #if JUCE_VERSION >= 0x08000B juce::addDefaultFormatsToManager (formatManager); + #else + formatManager.addDefaultFormats(); + #endif for (auto format : formatManager.getFormats()) if (format->fileMightContainThisPluginType (arg)) diff --git a/Source/MainComponent.cpp b/Source/MainComponent.cpp index 28658ff..1547ac8 100644 --- a/Source/MainComponent.cpp +++ b/Source/MainComponent.cpp @@ -331,7 +331,11 @@ namespace MainComponent::MainComponent (Validator& v) : validator (v) { + #if JUCE_VERSION >= 0x08000B juce::addDefaultFormatsToManager (formatManager); + #else + formatManager.addDefaultFormats(); + #endif menuBar.setModel (this); addAndMakeVisible (menuBar); diff --git a/Source/PluginTests.cpp b/Source/PluginTests.cpp index a434d54..e685dad 100644 --- a/Source/PluginTests.cpp +++ b/Source/PluginTests.cpp @@ -69,7 +69,11 @@ PluginTests::PluginTests (const juce::String& fileOrIdentifier, Options opts) { jassert (fileOrIdentifier.isNotEmpty()); jassert (juce::isPositiveAndNotGreaterThan (options.strictnessLevel, 10)); + #if JUCE_VERSION >= 0x08000B juce::addDefaultFormatsToManager (formatManager); + #else + formatManager.addDefaultFormats(); + #endif } PluginTests::PluginTests (const juce::PluginDescription& desc, Options opts) From b596c7829bd159b1f7d0956e8ce91be963e68790 Mon Sep 17 00:00:00 2001 From: Sudara Date: Fri, 16 Jan 2026 21:55:31 +0100 Subject: [PATCH 11/12] Simplify the cache key (remove JUCE version) --- .github/workflows/build.yaml | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/.github/workflows/build.yaml b/.github/workflows/build.yaml index 5b2f2e3..615dc68 100644 --- a/.github/workflows/build.yaml +++ b/.github/workflows/build.yaml @@ -56,12 +56,11 @@ jobs: echo "VERSION=$VERSION" >> $GITHUB_ENV echo "APP_DIR=${{ env.BUILD_DIR }}/${{ env.BINARY_NAME }}_artefacts/${{ env.BUILD_TYPE }}" >> $GITHUB_ENV echo "ZIP_FILE_NAME=${{ env.BINARY_NAME }}_${{ matrix.name }}.zip" >> $GITHUB_ENV - echo "JUCE_SHA1=$(git rev-parse HEAD:modules/juce)" >> $GITHUB_ENV - echo "PLUGIN_BUILD_DIR=modules/juce/Builds" >> $GITHUB_ENV - + # This needs to be absolute to make action/cache happy + # CPM fetches JUCE into the build directory's _deps folder WORKING_DIR=$(pwd) - echo "PLUGIN_CACHE_PATH=$WORKING_DIR/_deps/juce-build/examples/Plugins" >> $GITHUB_ENV + echo "PLUGIN_CACHE_PATH=$WORKING_DIR/${{ env.BUILD_DIR }}/_deps/juce-build/examples/Plugins" >> $GITHUB_ENV - name: Install dependencies (Linux) if: ${{ matrix.name == 'Linux' }} @@ -112,7 +111,7 @@ jobs: with: path: ${{ env.PLUGIN_CACHE_PATH }} # Increment the version in the key below to manually break plugin cache - key: v8-${{ runner.os }}-${{ env.JUCE_SHA1 }} + key: v9-${{ runner.os }} - name: Build JUCE example plugins if: steps.cache-plugins.outputs.cache-hit != 'true' From 6b26e84a1b069c801d4463bd0dda0764c945ebaf Mon Sep 17 00:00:00 2001 From: Sudara Date: Fri, 16 Jan 2026 22:19:39 +0100 Subject: [PATCH 12/12] Specify the correct CPM source directory as the build dir --- .github/workflows/build.yaml | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/.github/workflows/build.yaml b/.github/workflows/build.yaml index 615dc68..c1e6e13 100644 --- a/.github/workflows/build.yaml +++ b/.github/workflows/build.yaml @@ -58,9 +58,9 @@ jobs: echo "ZIP_FILE_NAME=${{ env.BINARY_NAME }}_${{ matrix.name }}.zip" >> $GITHUB_ENV # This needs to be absolute to make action/cache happy - # CPM fetches JUCE into the build directory's _deps folder + # JUCE examples are built from within the CPM-fetched JUCE source directory WORKING_DIR=$(pwd) - echo "PLUGIN_CACHE_PATH=$WORKING_DIR/${{ env.BUILD_DIR }}/_deps/juce-build/examples/Plugins" >> $GITHUB_ENV + echo "PLUGIN_CACHE_PATH=$WORKING_DIR/${{ env.BUILD_DIR }}/_deps/juce-src/Builds/examples/Plugins" >> $GITHUB_ENV - name: Install dependencies (Linux) if: ${{ matrix.name == 'Linux' }} @@ -115,6 +115,7 @@ jobs: - name: Build JUCE example plugins if: steps.cache-plugins.outputs.cache-hit != 'true' + working-directory: ${{ env.BUILD_DIR }}/_deps/juce-src shell: bash run: | cmake -B Builds -DJUCE_BUILD_EXAMPLES=ON -DCMAKE_BUILD_TYPE=Release -DCMAKE_C_COMPILER_LAUNCHER=ccache -DCMAKE_CXX_COMPILER_LAUNCHER=ccache .