File JUCE-LV2.patch of Package juce6
commit b14e5f1ed813999ca90ddb9c44ac8fd00a60a495
Author: KottV <kv@kott.no-ip.biz>
Date: Thu Aug 26 10:31:32 2021 +1000
add LV2 defines
diff --git a/extras/Build/CMake/JUCEModuleSupport.cmake b/extras/Build/CMake/JUCEModuleSupport.cmake
index 17abb65b2..ee70cdb49 100644
--- a/extras/Build/CMake/JUCEModuleSupport.cmake
+++ b/extras/Build/CMake/JUCEModuleSupport.cmake
@@ -234,7 +234,7 @@ endfunction()
# ==================================================================================================
function(_juce_get_all_plugin_kinds out)
- set(${out} AU AUv3 AAX Standalone Unity VST VST3 PARENT_SCOPE)
+ set(${out} AU AUv3 AAX Standalone Unity VST VST3 LV2 PARENT_SCOPE)
endfunction()
function(_juce_get_platform_plugin_kinds out)
@@ -249,7 +249,7 @@ function(_juce_get_platform_plugin_kinds out)
endif()
if(NOT CMAKE_SYSTEM_NAME STREQUAL "iOS" AND NOT CMAKE_SYSTEM_NAME STREQUAL "Android")
- list(APPEND result AAX Unity VST VST3)
+ list(APPEND result AAX Unity VST VST3 LV2)
endif()
set(${out} ${result} PARENT_SCOPE)
diff --git a/extras/Build/CMake/JUCEUtils.cmake b/extras/Build/CMake/JUCEUtils.cmake
index d8ac3bc8d..7276d6f10 100644
--- a/extras/Build/CMake/JUCEUtils.cmake
+++ b/extras/Build/CMake/JUCEUtils.cmake
@@ -63,6 +63,10 @@ define_property(TARGET PROPERTY JUCE_VST3_COPY_DIR INHERITED
BRIEF_DOCS "Install location for VST3 plugins"
FULL_DOCS "This is where the plugin will be copied if plugin copying is enabled")
+define_property(TARGET PROPERTY JUCE_LV2_COPY_DIR INHERITED
+ BRIEF_DOCS "Install location for LV2 plugins"
+ FULL_DOCS "This is where the plugin will be copied if plugin copying is enabled")
+
define_property(TARGET PROPERTY JUCE_AU_COPY_DIR INHERITED
BRIEF_DOCS "Install location for AU plugins"
FULL_DOCS "This is where the plugin will be copied if plugin copying is enabled")
@@ -115,6 +119,7 @@ function(_juce_set_default_properties)
elseif((CMAKE_SYSTEM_NAME STREQUAL "Linux") OR (CMAKE_SYSTEM_NAME MATCHES ".*BSD"))
set_property(GLOBAL PROPERTY JUCE_VST_COPY_DIR "$ENV{HOME}/.vst")
set_property(GLOBAL PROPERTY JUCE_VST3_COPY_DIR "$ENV{HOME}/.vst3")
+ set_property(GLOBAL PROPERTY JUCE_LV2_COPY_DIR "$ENV{HOME}/.lv2")
endif()
endfunction()
@@ -910,6 +915,55 @@ function(_juce_set_plugin_target_properties shared_code_target kind)
endif()
_juce_set_copy_properties(${shared_code_target} ${target_name} "${output_path}" JUCE_VST_COPY_DIR)
+ elseif(kind STREQUAL "LV2")
+ set_target_properties(${target_name} PROPERTIES
+ BUNDLE_EXTENSION lv2
+ PREFIX ""
+ SUFFIX .lv2
+ BUNDLE TRUE
+ XCODE_ATTRIBUTE_WRAPPER_EXTENSION lv2
+ XCODE_ATTRIBUTE_LIBRARY_STYLE Bundle
+ XCODE_ATTRIBUTE_GENERATE_PKGINFO_FILE YES)
+
+ _juce_create_windows_package(${shared_code_target} ${target_name} lv2 "" x86-win x86_64-win)
+
+ set(output_path "${products_folder}/${product_name}.lv2")
+
+ if(CMAKE_SYSTEM_NAME STREQUAL "Linux")
+ # On linux we assume that the output arch is the same as the that of the host platform
+ set(is_platform_x64 $<EQUAL:${CMAKE_SIZEOF_VOID_P},8>)
+ set(arch_string $<IF:${is_platform_x64},x86_64,i386>)
+
+ set_target_properties(${target_name} PROPERTIES
+ SUFFIX .so
+ LIBRARY_OUTPUT_DIRECTORY "${output_path}")
+ endif()
+
+ # LV2 tools dont work with a space in the .so file
+ set(lv2_shared_lib_property "$<TARGET_PROPERTY:${shared_code_target},JUCE_LV2_SHARED_LIBRARY_NAME>")
+ set(lv2_shared_lib $<IF:$<BOOL:${lv2_shared_lib_property}>,${lv2_shared_lib_property},${product_name}> )
+ add_custom_command(TARGET ${target_name} POST_BUILD
+ COMMAND cmake -E rename ${product_name}.so ${lv2_shared_lib}.so
+ WORKING_DIRECTORY "${products_folder}/${product_name}.lv2/"
+ VERBATIM)
+
+ # generate .ttl files
+ if(LV2_TTL_GENERATOR)
+ add_custom_command(TARGET ${target_name} POST_BUILD
+ COMMAND ${LV2_TTL_GENERATOR} "./${lv2_shared_lib}.so"
+ WORKING_DIRECTORY "${products_folder}/${product_name}.lv2/"
+ VERBATIM)
+ else()
+ add_executable(${target_name}_lv2_ttl_generator ${JUCE_SOURCE_DIR}/extras/Build/lv2_ttl_generator/lv2_ttl_generator.c)
+ target_link_libraries(${target_name}_lv2_ttl_generator dl pthread)
+ add_custom_command(TARGET ${target_name} POST_BUILD
+ COMMAND ${target_name}_lv2_ttl_generator "./${lv2_shared_lib}.so"
+ DEPENDS ${target_name} lv2_ttl_generator
+ WORKING_DIRECTORY "${products_folder}/${product_name}.lv2/"
+ VERBATIM)
+ endif()
+
+ _juce_copy_after_build(${shared_code_target} ${target_name} "${output_path}" JUCE_LV2_COPY_DIR)
elseif(kind STREQUAL "AU")
set_target_properties(${target_name} PROPERTIES
BUNDLE_EXTENSION component
@@ -1007,6 +1061,8 @@ function(_juce_get_plugin_kind_name kind out_var)
set(${out_var} "VST" PARENT_SCOPE)
elseif(kind STREQUAL "VST3")
set(${out_var} "VST3" PARENT_SCOPE)
+ elseif(kind STREQUAL "LV2")
+ set(${out_var} "LV2" PARENT_SCOPE)
endif()
endfunction()
@@ -1156,6 +1212,7 @@ function(_juce_configure_plugin_targets target)
JucePlugin_VSTUniqueID=JucePlugin_PluginCode
JucePlugin_VSTCategory=$<TARGET_PROPERTY:${target},JUCE_VST2_CATEGORY>
JucePlugin_Vst3Category="${vst3_category_string}"
+ JucePlugin_LV2URI="$<TARGET_PROPERTY:${target},JUCE_LV2_URI>"
JucePlugin_AUMainType=$<TARGET_PROPERTY:${target},JUCE_AU_MAIN_TYPE_CODE>
JucePlugin_AUSubType=JucePlugin_PluginCode
JucePlugin_AUExportPrefix=$<TARGET_PROPERTY:${target},JUCE_AU_EXPORT_PREFIX>
@@ -1328,6 +1385,13 @@ function(_juce_set_fallback_properties target)
_juce_set_property_if_not_set(${target} VST3_CATEGORIES Fx)
endif()
+ # LV2_CATEGORIES
+ if(is_synth)
+ _juce_set_property_if_not_set(${target} LV2_CATEGORIES InstrumentPlugin)
+ else()
+ _juce_set_property_if_not_set(${target} LV2_CATEGORIES Plugin)
+ endif()
+
# VST2_CATEGORY
if(is_synth)
_juce_set_property_if_not_set(${target} VST2_CATEGORY kPlugCategSynth)
@@ -1503,6 +1567,8 @@ function(_juce_initialise_target target)
VST_NUM_MIDI_INS
VST_NUM_MIDI_OUTS
VST2_CATEGORY
+ LV2_URI
+ LV2_SHARED_LIBRARY_NAME
AU_MAIN_TYPE
AU_EXPORT_PREFIX
AU_SANDBOX_SAFE
@@ -1512,6 +1578,7 @@ function(_juce_initialise_target target)
VST_COPY_DIR
VST3_COPY_DIR
+ LV2_COPY_DIR
AAX_COPY_DIR
AU_COPY_DIR
UNITY_COPY_DIR
@@ -1556,6 +1623,7 @@ function(_juce_initialise_target target)
COMPANY_COPYRIGHT
VST_COPY_DIR
VST3_COPY_DIR
+ LV2_COPY_DIR
AU_COPY_DIR
AAX_COPY_DIR
UNITY_COPY_DIR
diff --git a/modules/juce_audio_processors/processors/juce_AudioProcessor.cpp b/modules/juce_audio_processors/processors/juce_AudioProcessor.cpp
index ac3c40bf0..570620173 100644
--- a/modules/juce_audio_processors/processors/juce_AudioProcessor.cpp
+++ b/modules/juce_audio_processors/processors/juce_AudioProcessor.cpp
@@ -1239,6 +1239,7 @@ const char* AudioProcessor::getWrapperTypeDescription (AudioProcessor::WrapperTy
case AudioProcessor::wrapperType_AAX: return "AAX";
case AudioProcessor::wrapperType_Standalone: return "Standalone";
case AudioProcessor::wrapperType_Unity: return "Unity";
+ case AudioProcessor::wrapperType_LV2: return "LV2";
default: jassertfalse; return {};
}
}
diff --git a/modules/juce_audio_processors/processors/juce_AudioProcessor.h b/modules/juce_audio_processors/processors/juce_AudioProcessor.h
index 07f68c840..8f652c30b 100644
--- a/modules/juce_audio_processors/processors/juce_AudioProcessor.h
+++ b/modules/juce_audio_processors/processors/juce_AudioProcessor.h
@@ -1118,6 +1118,11 @@ public:
/** This method is called when the layout of the audio processor changes. */
virtual void processorLayoutsChanged();
+ //==============================================================================
+ /** LV2 specific calls, saving/restore as string. */
+ virtual String getStateInformationString () { return String(); }
+ virtual void setStateInformationString (const String&) {}
+
//==============================================================================
/** Adds a listener that will be called when an aspect of this processor changes. */
virtual void addListener (AudioProcessorListener* newListener);
@@ -1202,6 +1207,7 @@ public:
wrapperType_AudioUnitv3,
wrapperType_RTAS,
wrapperType_AAX,
+ wrapperType_LV2,
wrapperType_Standalone,
wrapperType_Unity
};
commit d023529eb2327c6dcf436e2edcf38bce800e7cd4
Author: KottV <kv@kott.no-ip.biz>
Date: Thu Aug 26 10:44:02 2021 +1000
cmake fix
diff --git a/extras/Build/CMake/JUCEUtils.cmake b/extras/Build/CMake/JUCEUtils.cmake
index 7276d6f10..415eb61e4 100644
--- a/extras/Build/CMake/JUCEUtils.cmake
+++ b/extras/Build/CMake/JUCEUtils.cmake
@@ -963,7 +963,7 @@ function(_juce_set_plugin_target_properties shared_code_target kind)
VERBATIM)
endif()
- _juce_copy_after_build(${shared_code_target} ${target_name} "${output_path}" JUCE_LV2_COPY_DIR)
+ _juce_set_copy_properties(${shared_code_target} ${target_name} "${output_path}" JUCE_LV2_COPY_DIR)
elseif(kind STREQUAL "AU")
set_target_properties(${target_name} PROPERTIES
BUNDLE_EXTENSION component