@@ -3,7 +3,7 @@ cmake_minimum_required(VERSION 3.15)
33file (STRINGS VERSION CURRENT_VERSION LIMIT_COUNT 1)
44project (pluginval VERSION ${CURRENT_VERSION} )
55
6- # Executes when not compiling as a "dependency" of another CMake project
6+ # Just compliing pluginval
77if (pluginval_IS_TOP_LEVEL)
88 add_subdirectory (modules/juce)
99
@@ -16,22 +16,10 @@ if (pluginval_IS_TOP_LEVEL)
1616 endif ()
1717
1818else ()
19- option (PLUGINVAL_STRICTNESS_LEVEL "Pluginval --strictness argument" 10)
20-
21- if (APPLE )
22- set (PLUGIN_TARGET "${CMAKE_PROJECT_NAME} _AU" )
23- else ()
24- set (PLUGIN_TARGET "${CMAKE_PROJECT_NAME} _VST3" )
25- endif ()
26-
27- add_custom_target (${CMAKE_PROJECT_NAME} _Pluginval
28- COMMAND
29- pluginval
30- --validate ${artefact}
31- --strictness-level ${PLUGINVAL_STRICTNESS_LEVEL}
32- DEPENDS ${PLUGIN_TARGET} pluginval
33- VERBATIM )
34-
19+ # compiling as a "dependency" of another JUCE CMake project
20+ if (NOT COMMAND juce_add_module)
21+ message (FATAL_ERROR "JUCE must be added to your project before pluginval!" )
22+ endif ()
3523endif ()
3624
3725# sanitizer options, from https://github.com/sudara/cmake-includes/blob/main/Sanitizers.cmake
@@ -139,11 +127,35 @@ if (${CMAKE_SYSTEM_NAME} MATCHES "Linux")
139127 -static -libstdc++)
140128endif ()
141129
142- set (cmdline_docs_out "${CMAKE_CURRENT_LIST_DIR} /docs/Command line options.md" )
130+ if (pluginval_IS_TOP_LEVEL)
131+ set (cmdline_docs_out "${CMAKE_CURRENT_LIST_DIR} /docs/Command line options.md" )
132+
133+ add_custom_command (OUTPUT "${cmdline_docs_out} "
134+ COMMAND pluginval --help > "${cmdline_docs_out} "
135+ COMMENT "Regenerating Command line options.md..."
136+ USES_TERMINAL )
137+ add_custom_target (PluginvalDocs DEPENDS "${cmdline_docs_out} " )
138+ else ()
139+
140+ # Custom pluginval CLI target
141+ set (PLUGINVAL_STRICTNESS_LEVEL 10 CACHE STRING "Pluginval --strictness argument (1-10)" )
142+ set_property (CACHE PLUGINVAL_STRICTNESS_LEVEL PROPERTY STRINGS 1 2 3 4 5 6 7 8 9 10)
143+
144+ # Set the target based on the platform
145+ # Makes the assumption both are being built
146+ if (APPLE )
147+ set (PLUGINVAL_TARGET "${CMAKE_PROJECT_NAME} _AU" )
148+ else ()
149+ set (PLUGINVAL_TARGET "${CMAKE_PROJECT_NAME} _VST3" )
150+ endif ()
143151
144- add_custom_command (OUTPUT "${cmdline_docs_out} "
145- COMMAND pluginval --help > "${cmdline_docs_out} "
146- COMMENT "Regenerating Command line options.md..."
147- USES_TERMINAL )
152+ get_target_property (artefact ${PLUGINVAL_TARGET} JUCE_PLUGIN_ARTEFACT_FILE)
148153
149- add_custom_target (PluginvalDocs DEPENDS "${cmdline_docs_out} " )
154+ # TODO: This doesn't populate the executable in clion
155+ add_custom_target (${CMAKE_PROJECT_NAME} _pluginval_cli
156+ COMMAND $<TARGET_FILE:pluginval>
157+ --validate ${artefact}
158+ --strictness-level 10
159+ DEPENDS pluginval ${PLUGINVAL_TARGET}
160+ COMMENT "Run pluginval CLI with strict validation" )
161+ endif ()
0 commit comments