@@ -3,16 +3,24 @@ cmake_minimum_required(VERSION 3.15)
33file (STRINGS VERSION CURRENT_VERSION LIMIT_COUNT 1 )
44project (pluginval VERSION ${CURRENT_VERSION} )
55
6- if (APPLE )
7- # Target OS versions down to 10.11
8- set (CMAKE_OSX_DEPLOYMENT_TARGET "10.11" CACHE INTERNAL "" )
9-
10- # Uncomment to produce a universal binary
11- # set(CMAKE_OSX_ARCHITECTURES arm64 x86_64)
12- set (PLUGINVAL_ENABLE_RTCHECK ON )
13- elseif (CMAKE_SYSTEM_NAME STREQUAL "Linux" )
14- # Disable rtcheck on Linux for now until further testing on real Linux systems has been done
15- # set(PLUGINVAL_ENABLE_RTCHECK ON)
6+ # Just compliing pluginval
7+ if (pluginval_IS_TOP_LEVEL)
8+ if (APPLE )
9+ # Target OS versions down to 10.11
10+ set (CMAKE_OSX_DEPLOYMENT_TARGET "10.11" CACHE INTERNAL "" )
11+
12+ # Uncomment to produce a universal binary
13+ # set(CMAKE_OSX_ARCHITECTURES arm64 x86_64)
14+ set (PLUGINVAL_ENABLE_RTCHECK ON )
15+ elseif (CMAKE_SYSTEM_NAME STREQUAL "Linux" )
16+ # Disable rtcheck on Linux for now until further testing on real Linux systems has been done
17+ # set(PLUGINVAL_ENABLE_RTCHECK ON)
18+ endif ()
19+ else ()
20+ # compiling as a "dependency" of another JUCE CMake project
21+ if (NOT COMMAND juce_add_module)
22+ message (FATAL_ERROR "JUCE must be added to your project before pluginval!" )
23+ endif ()
1624endif ()
1725
1826# sanitizer options, from https://github.com/sudara/cmake-includes/blob/main/Sanitizers.cmake
@@ -52,6 +60,12 @@ if(PLUGINVAL_ENABLE_RTCHECK)
5260 CPMAddPackage ("gh:Tracktion/rtcheck#main" )
5361endif ()
5462
63+ # Only fetch JUCE when top-level (when used as dependency, JUCE is already available)
64+ if (pluginval_IS_TOP_LEVEL)
65+ CPMAddPackage ("gh:juce-framework/juce#8.0.3" )
66+ endif ()
67+
68+
5569# VST3 Validator integration - embeds Steinberg's vstvalidator directly into pluginval
5670option (PLUGINVAL_VST3_VALIDATOR "Build with embedded VST3 validator" ON )
5771
@@ -245,11 +259,34 @@ if (PLUGINVAL_ENABLE_RTCHECK)
245259 endif ()
246260endif ()
247261
248- set (cmdline_docs_out "${CMAKE_CURRENT_LIST_DIR} /docs/Command line options.md" )
262+ if (pluginval_IS_TOP_LEVEL)
263+ set (cmdline_docs_out "${CMAKE_CURRENT_LIST_DIR} /docs/Command line options.md" )
249264
250- add_custom_command (OUTPUT "${cmdline_docs_out} "
251- COMMAND pluginval --help > "${cmdline_docs_out} "
252- COMMENT "Regenerating Command line options.md..."
253- USES_TERMINAL )
265+ add_custom_command (OUTPUT "${cmdline_docs_out} "
266+ COMMAND pluginval --help > "${cmdline_docs_out} "
267+ COMMENT "Regenerating Command line options.md..."
268+ USES_TERMINAL )
269+ add_custom_target (PluginvalDocs DEPENDS "${cmdline_docs_out} " )
270+ else ()
271+ # Custom pluginval CLI target
272+ set (PLUGINVAL_STRICTNESS_LEVEL 10 CACHE STRING "Pluginval --strictness argument (1-10)" )
273+ set_property (CACHE PLUGINVAL_STRICTNESS_LEVEL PROPERTY STRINGS 1 2 3 4 5 6 7 8 9 10 )
274+
275+ # Set the target based on the platform
276+ # Makes the assumption both are being built
277+ if (APPLE )
278+ set (PLUGINVAL_TARGET "${CMAKE_PROJECT_NAME} _AU" )
279+ else ()
280+ set (PLUGINVAL_TARGET "${CMAKE_PROJECT_NAME} _VST3" )
281+ endif ()
282+
283+ get_target_property (artefact ${PLUGINVAL_TARGET} JUCE_PLUGIN_ARTEFACT_FILE )
254284
255- add_custom_target (PluginvalDocs DEPENDS "${cmdline_docs_out} " )
285+ # TODO: This doesn't populate the executable in clion
286+ add_custom_target (${CMAKE_PROJECT_NAME} _pluginval_cli
287+ COMMAND $<TARGET_FILE :pluginval >
288+ --validate ${artefact}
289+ --strictness-level 10
290+ DEPENDS pluginval ${PLUGINVAL_TARGET}
291+ COMMENT "Run pluginval CLI with strict validation" )
292+ endif ()
0 commit comments