Skip to content

Commit

Permalink
add LV2 target to JUCEUtils.cmake, it can build lv2 plugins now
Browse files Browse the repository at this point in the history
  • Loading branch information
KottV committed Sep 9, 2020
1 parent c51d03f commit d316184
Showing 1 changed file with 52 additions and 2 deletions.
54 changes: 52 additions & 2 deletions extras/Build/CMake/JUCEUtils.cmake
Expand Up @@ -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")
Expand Down Expand Up @@ -159,6 +163,7 @@ function(_juce_set_default_properties)
elseif(CMAKE_SYSTEM_NAME STREQUAL "Linux")
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()

Expand Down Expand Up @@ -301,7 +306,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)
Expand All @@ -316,7 +321,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)
list(APPEND result AAX Unity VST LV2)

if(NOT MINGW AND NOT MSYS)
list(APPEND result VST3)
Expand Down Expand Up @@ -1246,6 +1251,40 @@ function(_juce_set_plugin_target_properties shared_code_target kind)
endif()

_juce_copy_after_build(${shared_code_target} ${target_name} "${output_path}" JUCE_VST3_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)

add_custom_command(TARGET ${target_name} POST_BUILD
COMMAND ${LV2_TTL_GENERATOR} "./${product_name}.so"
#COMMAND echo ${LV2_TTL_GENERATOR}
WORKING_DIRECTORY "${products_folder}/${product_name}.lv2/"
VERBATIM)


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

_juce_copy_after_build(${shared_code_target} ${target_name} "${output_path}" JUCE_LV2_COPY_DIR)

elseif(kind STREQUAL "VST")
set_target_properties(${target_name} PROPERTIES
BUNDLE_EXTENSION vst
Expand Down Expand Up @@ -1357,6 +1396,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()

Expand Down Expand Up @@ -1689,6 +1730,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)
Expand Down Expand Up @@ -1862,6 +1910,7 @@ function(_juce_initialise_target target)

VST_COPY_DIR
VST3_COPY_DIR
LV2_COPY_DIR
AAX_COPY_DIR
AU_COPY_DIR
UNITY_COPY_DIR
Expand Down Expand Up @@ -1905,6 +1954,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
Expand Down

0 comments on commit d316184

Please sign in to comment.