Disabling LV2 on MacOS (Darwin)

Try as I might, I cannot get my CMakeLists.txt fu up to par to prevent cmake from trying to build LV2 versions of my project, which is only on Darwin/MacOS at the moment … and I’d kind of like to avoid doing this if possible, while I’m in the beginning stages of things, since the LV2 path slows down cmake re-generation.

Can anyone see the obvious flaw in my CMakeLists.txt that leads this to happen?

Repo: GitHub - seclorum/dfmJulioos

cmake_minimum_required(VERSION 3.15)
project(dfmJulioos VERSION 1.0.0)

set(CMAKE_CXX_STANDARD 17)

# Disable unnecessary targets from tracktion_engine
set(BUILD_EXAMPLES OFF CACHE BOOL "Disable building examples")
set(BUILD_DEMOS OFF CACHE BOOL "Disable building demos")
set(BUILD_TESTS OFF CACHE BOOL "Disable building tests")

# Add tracktion_engine as a module
add_subdirectory(tracktion_engine)

# JUCE setup
set(JUCE_DIR "${CMAKE_SOURCE_DIR}/tracktion_engine/modules/JUCE")

# Define the JUCE plugin
juce_add_plugin(dfmJulioos
        COMPANY_NAME "seclorum.wien"
        IS_SYNTH TRUE
        NEEDS_MIDI_INPUT TRUE
        NEEDS_MIDI_OUTPUT TRUE
        IS_MIDI_EFFECT FALSE
        EDITOR_WANTS_KEYBOARD_FOCUS TRUE
        COPY_PLUGIN_AFTER_BUILD TRUE
        PLUGIN_MANUFACTURER_CODE JWVS
        PLUGIN_CODE DFM1
        FORMATS AU VST3 Standalone # Removed LV2 to avoid LV2URI warnings
)

# Julia setup
set(JULIA_EXECUTABLE /usr/local/bin/julia)
set(JULIA_SOURCE ${CMAKE_SOURCE_DIR}/Source/dfm1)
set(JULIA_LIB_DIR ${CMAKE_BINARY_DIR}/libs)
set(JULIA_LIB_NAME libdfm1.${CMAKE_SHARED_LIBRARY_SUFFIX})
set(JULIA_OUTPUT_PATH ${JULIA_LIB_DIR}/${JULIA_LIB_NAME})
set(JULIA_INCLUDE_DIR /usr/local/Cellar/julia/1.11.1/include/julia)

# Ensure the output directory for the Julia library exists
file(MAKE_DIRECTORY ${JULIA_LIB_DIR})

# Custom command to build the Julia shared library
#create_library("MyLib", "MyLibCompiled";
#        lib_name="libinc",
#        precompile_execution_file="MyLib/build/generate_precompile.jl",
#        precompile_statements_file="MyLib/build/additional_precompile.jl",
#        header_files = ["MyLib/build/mylib.h"])

add_custom_command(
        OUTPUT ${JULIA_OUTPUT_PATH}
        COMMAND ${JULIA_EXECUTABLE} --project ${JULIA_SOURCE} -e "
        using PackageCompiler;
        create_library(
            \"${JULIA_SOURCE}/dfm1.jl\",
            \"dfm1Compiled\",
            lib_name=\"dfm1\"
        )"
        DEPENDS ${JULIA_SOURCE}
        COMMENT "Compiling Julia code to a shared library"
        VERBATIM
)

# Custom target to build Julia code
add_custom_target(BuildJuliaCode ALL DEPENDS ${JULIA_OUTPUT_PATH})

# Ensure the plugin depends on the Julia library
add_dependencies(dfmJulioos BuildJuliaCode)

# Link the Julia library to the plugin
target_link_libraries(dfmJulioos PRIVATE ${JULIA_LIB_DIR}/${JULIA_LIB_NAME})

# Include Julia headers
target_include_directories(dfmJulioos PRIVATE ${JULIA_INCLUDE_DIR})

# Add source files
target_sources(dfmJulioos PRIVATE
        Source/PluginProcessor.cpp
        Source/PluginEditor.cpp
)

# Add JUCE modules and tracktion_engine
target_link_libraries(dfmJulioos PRIVATE
        tracktion_engine
        juce::juce_audio_processors
        juce::juce_audio_utils
        juce::juce_gui_basics
        juce::juce_core
)

… gives me this on MacOS/Darwin, which I don’t fully understand - I haven’t enabled LV2!!

/usr/local/bin/cmake -DCMAKE_BUILD_TYPE=Release -DCMAKE_MAKE_PROGRAM=/Applications/CLion.app/Contents/bin/ninja/mac/ninja -G Ninja -S /Users/ibisum/audioLaboratory/dfmJulioos -B /Users/ibisum/audioLaboratory/dfmJulioos/cmake-build-release
-- The C compiler identification is AppleClang 15.0.0.15000100
-- The CXX compiler identification is AppleClang 15.0.0.15000100
-- Detecting C compiler ABI info
-- Detecting C compiler ABI info - done
-- Check for working C compiler: /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/cc - skipped
-- Detecting C compile features
-- Detecting C compile features - done
-- Detecting CXX compiler ABI info
-- Detecting CXX compiler ABI info - done
-- Check for working CXX compiler: /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/c++ - skipped
-- Detecting CXX compile features
-- Detecting CXX compile features - done
-- Configuring juceaide
-- Building juceaide
-- Exporting juceaide
-- Testing juceaide
-- Finished setting up juceaide
Adding Benchmarks to the tracktion project
-- Not building with VST2
Adding TestRunner to the tracktion project
-- Not building with VST2
Adding DemoRunner to the tracktion project
-- Not building with VST2
Adding EngineInPluginDemo to the tracktion project
-- Not building with VST2
CMake Warning at tracktion_engine/modules/juce/extras/Build/CMake/JUCEUtils.cmake:1337 (message):
  LV2URI should be well-formed with an 'http' or 'urn' prefix.  Check the
  LV2URI argument to juce_add_plugin.
Call Stack (most recent call first):
  tracktion_engine/modules/juce/extras/Build/CMake/JUCEUtils.cmake:1451 (_juce_set_plugin_target_properties)
  tracktion_engine/modules/juce/extras/Build/CMake/JUCEUtils.cmake:1588 (_juce_link_plugin_wrapper)
  tracktion_engine/modules/juce/extras/Build/CMake/JUCEUtils.cmake:2181 (_juce_configure_plugin_targets)
  tracktion_engine/modules/juce/extras/Build/CMake/JUCEUtils.cmake:2312 (juce_add_plugin)
  tracktion_engine/examples/EngineInPluginDemo/CMakeLists.txt:34 (juce_add_pip)


-- Performing Test CMAKE_HAVE_LIBC_PTHREAD
-- Performing Test CMAKE_HAVE_LIBC_PTHREAD - Success
-- Found Threads: TRUE
-- Configuring done (130.9s)
-- Generating done (0.9s)
-- Build files have been written to: /Users/ibisum/audioLaboratory/dfmJulioos/cmake-build-release

[Finished]

Looks like the warning refers to the EngineInPluginDemo from tracktion_engine. Maybe you need to supply some other configuration flag in order to disable the tracktion_engine examples.

It is coming from tracktion_engine but there are two things to consider:

  1. If you’re just using the library, we should add a way to avoid adding the example targets as they aren’t needed
  2. The LV2 warning comes from the examples being juce pips. I’ve tried long and hard to get a proper URI generated but it’s all inside juce cmake. Perhaps @reuk you could either add a way to set the LV2 URI to pips or generate a valid one by default?

I’ll put 1. on my to do list.

1 Like

Thanks fellas, that clears it up for me. For now I’ve just removed the EngineInPluginDemo from the target list, but I’ll catch up with whatever ‘official’ solution gets pushed as it happens.

I have a few projects where my ‘front door’ to JUCE is through its inclusion as a submodule in tracktion_engine, so it’d be good to see this solved in a smooth manner … I tend to suggest folks clone tracktion_engine for their new projects (locally, within our R&D group that is), also, just in case thats of interest …

Going back through some open tabs and spotted this. PIPs will use the content of the JUCE_COMPANY_WEBSITE property set on the PIP target to generate a LV2 URI. This property may be inherited from directory properties.

I think the warning doesn’t affect the built-in JUCE examples because we set this property at the top level of the project:

set_directory_properties(PROPERTIES
    JUCE_COMPANY_WEBSITE    "https://juce.com"
    ...

Perhaps one solution would be to add a COMPANY_WEBSITE property to the directory containing the tracktion examples.

Thanks for remembering.
That worked, but I had to add it as JUCE_COMPANY_WEBSITE:

Just COMPANY_WEBSITE didn’t help.

Thanks!

1 Like