Skip to content

Commit

Permalink
dd CLI option when dependency. Only compile docs when top-level.
Browse files Browse the repository at this point in the history
  • Loading branch information
sudara committed Dec 4, 2024
1 parent 720945a commit b708f38
Showing 1 changed file with 35 additions and 23 deletions.
58 changes: 35 additions & 23 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -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)
add_subdirectory(modules/juce)

Expand All @@ -16,22 +16,10 @@ if (pluginval_IS_TOP_LEVEL)
endif()

else()
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)

# 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()

# Uncomment to enable tsan
Expand Down Expand Up @@ -111,11 +99,35 @@ if (${CMAKE_SYSTEM_NAME} MATCHES "Linux")
-static-libstdc++)
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}")
else()

add_custom_target (PluginvalDocs DEPENDS "${cmdline_docs_out}")
# 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 $<TARGET_FILE:pluginval>
--validate ${artefact}
--strictness-level 10
DEPENDS pluginval ${PLUGINVAL_TARGET}
COMMENT "Run pluginval CLI with strict validation")
endif()

0 comments on commit b708f38

Please sign in to comment.