Having issues adding a third party modules

Hello everyone, im new here and (fairly) new to coding. I apologize if this question is misinformed or redundant. I’ll include plenty of screenshots of my issue so im clear and to the point. First of all, I am trying to add these modules:chowdsp_utils: chowdsp_utils. The file structure it requires is shown there, and here is mind:

image

I have included the library path in the “Extra Library Search Paths” in the Debug and Release Exporters.

In the project settings, i’ve included the path to the same path for “Header Search Paths”

and finally, in the “User Modules” section of the Global Paths, I’ve included the path for the Modules.

I’ve tried to #include it, with no success. I can see them in the Visual Studio Solution Explorer under “JUCE Modules” but i know that it is filtered so I don’t know if that makes a difference.

I can include more screenshots, but the website will only let me do one at a time :slight_smile:

I have recently successfully included this code in a project I’m working on, and while our situations are not exactly the same, I hope showing you what worked for me will help you get where you need to go. First, my directory structure:

image

I opted to go with CMake to integrate the chowdsp tools because while it was a little upfront effort, the payoff is that it’s much easier to integrate other projects, and it feels more “in control” than the Projucer. Having said that, if I could have figured out how to just keep using the Projucer, I probably would have. You’ll also note that JUCE is now a submodule, as opposed to what I consider the “native” or “original” JUCE way of keeping the project in the projects folder. As it so happens, this project is in that folder, but it’s no longer important it be kept there.

Now for the submodule:

git submodule add https://github.com/juce-framework/JUCE Modules/JUCE 
git submodule add git@github.com:Chowdhury-DSP/chowdsp_utils.git Modules/chowdsp_utils
git submodule update --init --recursive

Results in:

[submodule "Modules/JUCE"]
	path = Modules/JUCE
	url = https://github.com/juce-framework/JUCE
[submodule "Modules/chowdsp_utils"]
	path = Modules/chowdsp_utils
	url = https://github.com/Chowdhury-DSP/chowdsp_utils

Now that we have that, if you choose to use CMake, you will need to configure it, which is not that hard ultimately. To get started, consider the documentation:

In the JUCE/examples/CMake directory, you’ll find example projects for a GUI app, a console app, and an audio plugin. You can simply copy one of these subdirectories out of the JUCE repo, add JUCE as a submodule, and uncomment the call to add_subdirectory where indicated in the CMakeLists.txt. Alternatively, if you’ve installed JUCE using a package manager or the CMake install target, you can uncomment the call to find_package.

In my root CMake, I have:

add_subdirectory(modules)

Which in turn has:

add_subdirectory(JUCE)
add_subdirectory(chowdsp_utils)
add_subdirectory(math_approx)
add_subdirectory(chowdsp_wdf)

This tells CMake to go look for the CMakeLists.txt in each of these respective folder, which when you run cmake --build ., should correctly create a Visual Studio or Xcode project for you to consume, where you will be able to:

#include <chowdsp_dsp_utils/chowdsp_dsp_utils.h>
#include <chowdsp_dsp_data_structures/chowdsp_dsp_data_structures.h>

The project I did this for is still in active development, but this particular portion is working. If you can stomach the CMake API for this, it may well be worth it. I hope this at least helps a little! Good luck!

Thank you so much for the amazing and detailed response, Its absolutely invaluable. Sorry it took me a day or so to respond, I had a lot to learn within Github and Cmake to get as far as I did. I do have one question that is holding me up though and I believe its related to the CMake.txt for Juce. I am getting this error:

project(AUDIO_PLUGIN_EXAMPLE VERSION 0.0.1)

# If you've installed JUCE somehow (via a package manager, or directly using the CMake install
# target), you'll need to tell this project that it depends on the installed copy of JUCE. If you've
# included JUCE directly in your source tree (perhaps as a submodule), you'll need to tell CMake to
# include that subdirectory as part of the build.

# find_package(JUCE CONFIG REQUIRED)        # If you've installed JUCE to your system
# or
add_subdirectory(Modules)                    # If you've put JUCE in a subdirectory called JUCE

and here is what the CMakeList.txt looks like in my Source folder (from how I interpreted the instructions, sorry if it is incorrect!

Thank you again so much for the amazing response, I really do appreciate it!

It seems that there is something wrong with the directory Modules (CMake says which is not an existing directory). As a result, CMake is not able to find JUCE.

By the way, it seems that you have folders JUCE and modules, not Modules. Am I correct?

I would suggest using the wonderful template pamplejuce as a start point.

@Soundwich Everything looks good to me in terms of the code you’ve shared, however two things that stand out to me are obviously that it’s not finding the directory and it’s not finding juce_add_plugin, which perhaps these 2 are related, or perhaps CMake and JUCE is not properly setup.

One thing that could be a quick fix is that for some reason, you must run two commands to get this to create your Visual Studio projects:

cmake -Bbuild 

The docs on this:

This will create a build tree in a directory named ‘build’, using the CMakeLists in the current working directory, using the default generator (makefiles on mac/linux, and the most recent Visual Studio on Windows).

And then:

cmake --build build # when you're ready to release, append: --config Release

Other than that,

  • Check the directory structure to ensure that the “Modules” directory is present at the correct location in your project.
  • Verify that JUCE has been correctly checked out as a submodule if that’s how it’s being included.
  • You might need to run git submodule update --init --recursive to ensure that JUCE and all its submodules are correctly checked out.

The reason I think this is an option is that it appears JUCE’s CMake API is not available. You should also consider what the other poster said, which I’m not sure how my project is working considering.

@zsliu98 You correctly point out that in my project, I tell CMake to look at modules despite the fact I have the directory Modules. To be honest, I’m not sure why it works, perhaps it’s case-insensitive. I will experiment and report back my findings.

On Pamplejuce, it is in fact pretty superb. My own experience with it was very good. My one word of caution is somewhat similar to my thoughts on Projucer vs. CMake, where audio programming and C++ are so complicated that I’m not sure these projects are good for early in the learning process. Pamplejuce covers so much that you do not need if you’re goal is to create your first functioning audio plugin, and if you’re goal is to create something bigger, you need to make sure all of its features align with your requirements, which you’re not equipped to do early in learning. For instance, continuous integration and code signing are just getting in the way early in learning. Basically, I think you should be comfortable with JUCE before jumping into Pamplejuce or CMake, and I’m still working on that to be honest.

Thank you for this! I appreciate this, I will definately be using this in the future! I’ve already downloaded it and took a look. Seems very well put together!

I really appreciate the help and patience. I’ve finally got it working after chipping away at it for four days. I had some discrepancies with the CMakeLists.txt and how I set it in terms of the file structure. I was mostly just using the example CMakeLists.txt which wasn’t correct, so thank you so much for pointing me in the correct direction. For anyone that reads this in the future, make sure that your root subdirectory and target_link_libraries are all double checked, because that’s where I went wrong.

Thank you so much for the informative information, its helped tremendously. Feel free to reach out anytime!