I am newbie to CMake and I am trying to switch my project from Projucer to CMake.
I set up my CMakeLists.txt file and everything works fine with the standard cmake commands from my terminal. However, I would like to use my CLion IDE to build release and debug versions of my plugin, but every time I try to run my debug or release build, it fails because of missing executable. Could I build my (release) project without adding an ‘executable’?
Up to now the two debug and release builds differ for the -DCMAKE_BUILD_TYPE option. Is this difference the same between the Projucer Release and Debug builds? And how could I debug my plugin in CLion by adding breakpoints?
Up to now I tried to add an executable to my debug build (Ableton Live in my case) and a breakpoint to a line of code. However every time I click on the debug button, Ableton opens up but on my breakpoint I read this:
The breakpoint will not currently be hit. No executable code is associated with this line.
Based on how I interpret what you wrote, it sounds like you are not building your plugins. CMake ‘builds’ the projects. You need to use those projects to build your plugins.
You may want to give a more detailed set of steps you are taking so people can better understand what you are doing vs. what you want to do. Also, tell which os and any other information that will help the forum understand what you are doing.
When I load my project in CLion, I can build my project and then I can run it.
The build of the project works fine and I see two destination folders (cmake-build-release and cmake-build-debug)
However when I run or debug the project (in Release or Debug configuration), CLion generates an error, which is ‘Executable not specified’
Secondly, I would like to understand how to debug my plugin inside CLion. Because I tried to do it by selecting the Debug build and adding an executable (Ableton). However the breakpoints are not triggered in this way when I load my plugin in the DAW (Ableton)
Hope that this reply is more complete and still thanks
Debugging plugins in mac clion is pretty straight forward once you are set up but as you are seeing that first setup is tricky. The way I do it usually is to enable the standalone and run that most of the time which lets me test DSP UI and so on - but I’m primarily working on a synth not an effect. So if you are building a VST3 or an AU you need to configure CLion to launch a host which will then load your plugin.
as @anoesisaudio said, COPY_PLUGIN_AFTER_BUILD TRUE is super important. Without that the plugin won’t install locally. But it’s still not runnable as you saw.
So for your VST3, in CLion go to configurations dropdown and choose ‘edit configurations’ then choose a runtime. Here’s the Surge VST3 which is set - when I run it - to launch reaper.
That will just launch reaper with your last reaper session. But reaper takes a .rpp file as an argument so if you want you can create a reaper file which loads your plug, save it to desktop, then make program arguments “/Users/You/Desktop/ThatThing.rpp” or what not
So the only question then is which hosts are good to debug in. For VST3 I use reaper primarily for debugging. For AU you can debug in logic this way but logic is slow to start; I use the really useful Hosting AU (Hosting AU) if I want a tiny lightweight AU host and it also does the thing where the program arg is the startup patch.
There’s a load of other ways, but for Surge, I’ve found do most of my debugging in the standalone then iterate in HAU and Reaper until it works then go test with (everything else) is a workflow that works and works great in CLion.
Thank you very much for your replies! Everything was solved by that flag!
For @baconpaul : might I ask you if with Hosting AU it’s possible to debug also the plugin during the validation?
Up to now I have a released AU plugin which passes all the pluginval tests but fails on au validation. When I set my local copy of auvaltool as executable of my plugin, as soon as I run my debug AU build I get always the following issue:
process exited with status -1 (Error 1)
and I can’t debug my crashed validation. Could you please help me?
Oh I vaguely remember that from eons ago. There’s something odd about auval and debugging.
If I recall I had to copy /usr/bin/auval to somewhere in my home directory then use the copied executable. And now I recall it was another thread on this forum which let me do it. How to debug auval? - #4 by daniel seems to be what you need?