From 436150b221ff5b3903080dbd872c95a381eaddb2 Mon Sep 17 00:00:00 2001 From: reuk Date: Tue, 6 Sep 2022 16:23:12 +0100 Subject: [PATCH] CMake: Avoid adding target for LV2 manifest helper unless specifically required --- CMakeLists.txt | 3 +- extras/Build/CMake/JUCEUtils.cmake | 17 +++++++++++ modules/CMakeLists.txt | 2 -- .../juce_audio_plugin_client/CMakeLists.txt | 28 ------------------- 4 files changed, 18 insertions(+), 32 deletions(-) delete mode 100644 modules/juce_audio_plugin_client/CMakeLists.txt diff --git a/CMakeLists.txt b/CMakeLists.txt index c4fdd3f598..e4e8c48be1 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -163,9 +163,8 @@ install(FILES "${JUCE_BINARY_DIR}/JUCEConfigVersion.cmake" DESTINATION "${JUCE_INSTALL_DESTINATION}") if("${CMAKE_SOURCE_DIR}" STREQUAL "${JUCE_SOURCE_DIR}") + _juce_add_lv2_manifest_helper_target() install(TARGETS juce_lv2_helper EXPORT LV2_HELPER DESTINATION "bin/JUCE-${JUCE_VERSION}") install(EXPORT LV2_HELPER NAMESPACE juce:: DESTINATION "${JUCE_INSTALL_DESTINATION}") -else() - set_target_properties(juce_lv2_helper PROPERTIES EXCLUDE_FROM_ALL ON) endif() diff --git a/extras/Build/CMake/JUCEUtils.cmake b/extras/Build/CMake/JUCEUtils.cmake index 1fa610447b..9bad0c230c 100644 --- a/extras/Build/CMake/JUCEUtils.cmake +++ b/extras/Build/CMake/JUCEUtils.cmake @@ -971,6 +971,8 @@ function(_juce_set_plugin_target_properties shared_code_target kind) set(output_path "${products_folder}/${product_name}.lv2") set_target_properties(${target_name} PROPERTIES LIBRARY_OUTPUT_DIRECTORY "${output_path}") + _juce_add_lv2_manifest_helper_target() + add_custom_command(TARGET ${target_name} POST_BUILD COMMAND juce::juce_lv2_helper "$" VERBATIM) @@ -1716,6 +1718,21 @@ endfunction() # ================================================================================================== +function(_juce_add_lv2_manifest_helper_target) + if(TARGET juce_lv2_helper) + return() + endif() + + get_target_property(module_path juce::juce_audio_plugin_client INTERFACE_JUCE_MODULE_PATH) + add_executable(juce_lv2_helper "${module_path}/juce_audio_plugin_client/LV2/juce_LV2TurtleDumpProgram.cpp") + add_executable(juce::juce_lv2_helper ALIAS juce_lv2_helper) + target_compile_features(juce_lv2_helper PRIVATE cxx_std_17) + set_target_properties(juce_lv2_helper PROPERTIES BUILD_WITH_INSTALL_RPATH ON) + target_link_libraries(juce_lv2_helper PRIVATE ${CMAKE_DL_LIBS}) +endfunction() + +# ================================================================================================== + function(juce_add_console_app target) add_executable(${target}) target_compile_definitions(${target} PRIVATE JUCE_STANDALONE_APPLICATION=1) diff --git a/modules/CMakeLists.txt b/modules/CMakeLists.txt index a51590ccfa..68330694c3 100644 --- a/modules/CMakeLists.txt +++ b/modules/CMakeLists.txt @@ -44,5 +44,3 @@ juce_add_modules( juce_osc juce_product_unlocking juce_video) - -add_subdirectory(juce_audio_plugin_client) diff --git a/modules/juce_audio_plugin_client/CMakeLists.txt b/modules/juce_audio_plugin_client/CMakeLists.txt deleted file mode 100644 index 8b29919a8f..0000000000 --- a/modules/juce_audio_plugin_client/CMakeLists.txt +++ /dev/null @@ -1,28 +0,0 @@ -# ============================================================================== -# -# This file is part of the JUCE library. -# Copyright (c) 2022 - Raw Material Software Limited -# -# JUCE is an open source library subject to commercial or open-source -# licensing. -# -# By using JUCE, you agree to the terms of both the JUCE 7 End-User License -# Agreement and JUCE Privacy Policy. -# -# End User License Agreement: www.juce.com/juce-7-licence -# Privacy Policy: www.juce.com/juce-privacy-policy -# -# Or: You may also use this code under the terms of the GPL v3 (see -# www.gnu.org/licenses). -# -# JUCE IS PROVIDED "AS IS" WITHOUT ANY WARRANTY, AND ALL WARRANTIES, WHETHER -# EXPRESSED OR IMPLIED, INCLUDING MERCHANTABILITY AND FITNESS FOR PURPOSE, ARE -# DISCLAIMED. -# -# ============================================================================== - -add_executable(juce_lv2_helper LV2/juce_LV2TurtleDumpProgram.cpp) -add_executable(juce::juce_lv2_helper ALIAS juce_lv2_helper) -target_compile_features(juce_lv2_helper PRIVATE cxx_std_17) -set_target_properties(juce_lv2_helper PROPERTIES BUILD_WITH_INSTALL_RPATH ON) -target_link_libraries(juce_lv2_helper PRIVATE ${CMAKE_DL_LIBS})