@@ -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,11 +60,9 @@ if(PLUGINVAL_ENABLE_RTCHECK)
5260 CPMAddPackage("gh:Tracktion/rtcheck#main" )
5361endif ()
5462
55-
56- option (PLUGINVAL_FETCH_JUCE "Fetch JUCE along with pluginval" ON )
57-
58- if (PLUGINVAL_FETCH_JUCE)
59- add_subdirectory (modules/juce)
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" )
6066endif ()
6167
6268if (DEFINED ENV{VST2_SDK_DIR})
@@ -151,11 +157,34 @@ if (PLUGINVAL_ENABLE_RTCHECK)
151157 endif ()
152158endif ()
153159
154- set (cmdline_docs_out "${CMAKE_CURRENT_LIST_DIR} /docs/Command line options.md" )
155-
156- add_custom_command (OUTPUT "${cmdline_docs_out} "
157- COMMAND pluginval --help > "${cmdline_docs_out} "
158- COMMENT "Regenerating Command line options.md..."
159- USES_TERMINAL )
160+ if (pluginval_IS_TOP_LEVEL)
161+ set (cmdline_docs_out "${CMAKE_CURRENT_LIST_DIR} /docs/Command line options.md" )
160162
161- add_custom_target (PluginvalDocs DEPENDS "${cmdline_docs_out} " )
163+ add_custom_command (OUTPUT "${cmdline_docs_out} "
164+ COMMAND pluginval --help > "${cmdline_docs_out} "
165+ COMMENT "Regenerating Command line options.md..."
166+ USES_TERMINAL )
167+ add_custom_target (PluginvalDocs DEPENDS "${cmdline_docs_out} " )
168+ else ()
169+ # Custom pluginval CLI target
170+ set (PLUGINVAL_STRICTNESS_LEVEL 10 CACHE STRING "Pluginval --strictness argument (1-10)" )
171+ set_property (CACHE PLUGINVAL_STRICTNESS_LEVEL PROPERTY STRINGS 1 2 3 4 5 6 7 8 9 10)
172+
173+ # Set the target based on the platform
174+ # Makes the assumption both are being built
175+ if (APPLE )
176+ set (PLUGINVAL_TARGET "${CMAKE_PROJECT_NAME} _AU" )
177+ else ()
178+ set (PLUGINVAL_TARGET "${CMAKE_PROJECT_NAME} _VST3" )
179+ endif ()
180+
181+ get_target_property (artefact ${PLUGINVAL_TARGET} JUCE_PLUGIN_ARTEFACT_FILE)
182+
183+ # TODO: This doesn't populate the executable in clion
184+ add_custom_target (${CMAKE_PROJECT_NAME} _pluginval_cli
185+ COMMAND $<TARGET_FILE:pluginval>
186+ --validate ${artefact}
187+ --strictness-level 10
188+ DEPENDS pluginval ${PLUGINVAL_TARGET}
189+ COMMENT "Run pluginval CLI with strict validation" )
190+ endif ()
0 commit comments