I have a project setup using Modern CMake like module system. It can be compiled for both an ESP32 and VST plugins.
To allow for DSP code to be efficient on the ESP32, I’m using an abstraction module called abstract_dsp
. This is implemented with juce_dsp
for the plugins.
I’ve linked the abstract_dsp
module to juce_dsp
like this:
add_library(abstract_dsp
abstract_dsp_juce.cpp)
target_include_directories(abstract_dsp PUBLIC include)
target_link_libraries(abstract_dsp PRIVATE juce::juce_dsp)
set_target_properties(abstract_dsp PROPERTIES
POSITION_INDEPENDENT_CODE TRUE)
This looks like it works, but I’ve been reading this thread. It seems linking directly to the juce target from my modules is not recommended, due to how JUCE modules work. However, if I try to use the workaround (link to juce_dsp
using INTERFACE
), I run into linking issues because of class templates.
juce::dsp::IIR::Coefficients<float>
is used inside abstract_dsp
, and causes linking errors. The errors go away if I add a new dummy member to my PluginProcessor with this declaration: juce::dsp::IIR::Coefficients<float> dummy;
. Seems like using INTERFACE
linking prevents the specialised class being created?
/usr/bin/ld: abstract_dsp/libabstract_dsp.a(abstract_dsp_juce.cpp.o): in function `dspal_biquad_design_lowpass':
abstract_dsp_juce.cpp:(.text+0x4a): undefined reference to `juce::dsp::IIR::Coefficients<float>::makeLowPass(double, float, float)'
/usr/bin/ld: abstract_dsp/libabstract_dsp.a(abstract_dsp_juce.cpp.o): in function `dspal_iir_set_coeffs':
abstract_dsp_juce.cpp:(.text+0x19a): undefined reference to `juce::dsp::IIR::Coefficients<float>::Coefficients(float, float, float, float, float, float)'
...
I’m not sure what’s going on, I’m also using juce::dsp::IIR::Filter<float>
and juce::dsp::DelayLine<float>
inside abstract_dsp
and there are no linking errors related to these.
source code is here. Note that I’ve only updated plugins/chorus
to use the workaround.
Any pointers on how to set this up correctly?