Jatin Chowdhury

May 4, 2021

4 min read

Building LV2 Plugins with JUCE and CMake

As a programmer who develops open source audio plugins, I suppose it was only a matter of time…

Let’s say that you’re an audio plugin developer, and one day you decide that you would like your plugins to support Linux. These days, that decision makes a lot of sense, given the growing number of music producers using Linux, and the high-quality DAWs that the Linux users of today can choose from, including Reaper, Bitwig, and Ardour.

What Can We Do

As a plugin developer, there are a lot of choices we make that determine how easy it is to support the LV2 format. If you’re using the DISTRHO Plugin Framework (DPF), you probably already support LV2, and don’t really need to be reading this! LV2 support is one of the great reasons to choose DPF as a plugin framework in the first place.

One of my plugins, ChowTapeModel, running as an LV2 in Carla.

Enter CMake

With the release of JUCE 6, JUCE now supports creating plugins with the CMake build system, which offers much more flexibility than the JUCE’s Projucer of old. Working with the GitHub users mentioned above, there is now a fork of JUCE that does support LV2 builds “out-of-the-box” via the CMake interface. So if you’re a plugin developer looking to add LV2 support to your plugin, here are some steps you can follow:

  1. Set up your plugin to build with the JUCE CMake API.
  2. Add JUCE as a submodule to your repository. This isn’t strictly necessary, but I like to do it so that I always know which version of JUCE my plugin requires. Be sure to checkout the lv2 branch on the JUCE fork.
mkdir modules && cd modules
git submodule add https://github.com/lv2-porting-project/JUCE
git checkout lv2
sudo apt-get install lv2-dev 
cmake -Bbuild
cmake --build build
# default plugin formats
set(JUCE_FORMATS AU VST3 Standalone)
# Build LV2 only on Linux
message(STATUS "Building LV2 plugin format")
ProductName "ChowMatrix"
ICON_BIG res/logo.png
LV2_URI https://github.com/Chowdhury-DSP/ChowMatrix

Wrapping Up

Anyway, I’m hoping that this post will encourage more folks who are making open-source plugins with JUCE to take a look at supporting the LV2 format. I’m happy to say that all of my last three plugin releases have included LV2 support! And finally, I’d like to thank @falkTX, @kottV, and @mxmilkiib on GitHub for encouraging me to add LV2 support for my plugins, and for giving me the necessary guidance and assistance to make it possible. If you’re looking to port your JUCE plugin to LV2 and are running into issues, feel free to reach out to me via email or GitHub issues!