Unable to load plugin despite successful CMake build

I am not sure why this is happening exactly, but I’m trying to implement CMake so that I can use a basic CI workflow for the project. Let me just preface this with I am new CMake as of today, so I am slowly learning how this works.

The problem is that I am successfully building the plugin with the CMake commands, but when I try to load the plugin in a host it won’t load. Currently I have the project setup as follows (if there is any other way to do it where I do not have to include JUCE as a submodule for CI then please let me know):

- MyPlugin
    - ...
    - Source
        - PluginProcessor.cpp
        - PluginEditor.cpp
        - ...
    - CMakeList.txt
- JUCE
    - JUCE submodule for CMake
- CMakeList.txt

In the root directory’s CMakeList.txt:

cmake_minimum_required(VERSION 3.17)
project(MyPluginVERSION 0.0.1)
add_subdirectory(JUCE)
add_subdirectory(MyPlugin)

In MyPlugin’s directory, the CMakeLists.txt looks like:

juce_add_plugin(MyPlugin
        VERSION "0.0.1"
        COMPANY_NAME "Company Name"
        IS_SYNTH TRUE
        IS_MIDI_EFFECT FALSE
        NEEDS_MIDI_INPUT TRUE
        NEEDS_MIDI_OUTPUT FALSE
        PLUGIN_MANUFACTURER_CODE C0de
        PLUGIN_CODE C0de
        FORMATS AU VST3
        PRODUCT_NAME "My Plugin")

juce_generate_juce_header(MyPlugin)

target_sources(MyPlugin PRIVATE
        Source/PluginEditor.cpp
        Source/PluginProcessor.cpp)

target_compile_definitions(MyPlugin PUBLIC
        JUCE_WEB_BROWSER=0
        JUCE_USE_CURL=0
        JUCE_VST3_CAN_REPLACE_VST2=0)

target_link_libraries(MyPlugin PRIVATE
        juce::juce_audio_utils)

There is something wrong happening with my CMake configurations or something because building this new project with VS2019 and the Projucer works just fine. If I’m not mistaken, adding CI integration would mean that I have to use the JUCE as a git submodule (because how else would the VM get the code). I know CI changes according to the platform, but just in a more general sense.

Thanks!

When you say it wont load what do you mean? Do you see the plugin in the list of plugins? It looks like you currently dont have the copy step enabled that copies the plugin from the build directory to the normal place plugins live on your PC. Are you manually copying it currently? try adding

COPY_PLUGIN_AFTER_BUILD TRUE

to your juce add plugin call

juce_add_plugin(MyPlugin
        VERSION "0.0.1"
        COMPANY_NAME "Company Name"
        IS_SYNTH TRUE
        IS_MIDI_EFFECT FALSE
        COPY_PLUGIN_AFTER_BUILD TRUE
        NEEDS_MIDI_INPUT TRUE
        NEEDS_MIDI_OUTPUT FALSE
        PLUGIN_MANUFACTURER_CODE C0de
        PLUGIN_CODE C0de
        FORMATS AU VST3
        PRODUCT_NAME "My Plugin")

You also have a space missing in the project call

project(MyPluginVERSION 0.0.1)

Also there are other ways besides adding the submodule. I believe you can use CMake’s fetch content function to pull the git branch down without having it live in your repo. I have not ever used that though.

2 Likes

You’re right, there was a type. Fortunately the typo was only in the posting of this when I was replacing names and stuff. I’m sorry for the inconvenience…

SOLUTION: I was able to solve problem. I was running my two cmake build commands from a build.sh bash script in my repo and when you do that it doesn’t log any errors if they occur. The problem occurred because I had Ableton open at the same time with a custom copy step in that bash script to my VST3 plugins folder, which doesn’t allow an overwrite of a plugin if it’s using it. Therefore I didn’t know it wasn’t being overwritten.