Skip to content

Commit 94bab67

Browse files
committed
Add CLI option when dependency. Only compile docs when top-level.
1 parent dcd222a commit 94bab67

1 file changed

Lines changed: 23 additions & 18 deletions

File tree

CMakeLists.txt

Lines changed: 23 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ cmake_minimum_required(VERSION 3.15)
33
file(STRINGS VERSION CURRENT_VERSION LIMIT_COUNT 1)
44
project(pluginval VERSION ${CURRENT_VERSION})
55

6-
# Executes when not compiling as a "dependency" of another CMake project
6+
# Just compliing pluginval
77
if (pluginval_IS_TOP_LEVEL)
88
if (APPLE)
99
# Target OS versions down to 10.11
@@ -21,22 +21,6 @@ else()
2121
if (NOT COMMAND juce_add_module)
2222
message(FATAL_ERROR "JUCE must be added to your project before pluginval!")
2323
endif ()
24-
25-
option(PLUGINVAL_STRICTNESS_LEVEL "Pluginval --strictness argument" 10)
26-
27-
if(APPLE)
28-
set(PLUGIN_TARGET "${CMAKE_PROJECT_NAME}_AU")
29-
else()
30-
set(PLUGIN_TARGET "${CMAKE_PROJECT_NAME}_VST3")
31-
endif()
32-
33-
add_custom_target(${CMAKE_PROJECT_NAME}_Pluginval
34-
COMMAND
35-
pluginval
36-
--validate ${artefact}
37-
--strictness-level ${PLUGINVAL_STRICTNESS_LEVEL}
38-
DEPENDS ${PLUGIN_TARGET} pluginval
39-
VERBATIM)
4024
endif()
4125

4226
# sanitizer options, from https://github.com/sudara/cmake-includes/blob/main/Sanitizers.cmake
@@ -180,6 +164,27 @@ if (pluginval_IS_TOP_LEVEL)
180164
COMMAND pluginval --help > "${cmdline_docs_out}"
181165
COMMENT "Regenerating Command line options.md..."
182166
USES_TERMINAL)
183-
184167
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")
185190
endif()

0 commit comments

Comments
 (0)