Including library as source - finding headers

Hi!

I am on Debian running QT Creator.

I have the following folder structure for my project OscA:

of/apps/myApps/OscA/src

I want to use a library (as source, not pre-compiled) so I add the files I want to use to my project. The library, DaisySP, is on the same level as OF, so for example oscillator.h

DaisySP/Source/Synthesis/oscillator.h

Problem is, that oscillator.h includes “Utility/dsp.h”

DaisySP/Source/Utility/dsp.h

and this is not found when building the project.

It seems the library has a “home” level of

DaisySP/Source

I first solved this by just copying the used files into my project but this doesn’t work anymore due to some more complicated dependencies.

So I guess what I would like to know is how to add

DaisySP/Source/Utility etc

to folders to search when compiling.

Thanks!

Hey @StaffanMelin , an add-on might work well for this. The super nice thing about the addons is that they can easily be included in new projects. So, you’d create a folder called something like ofxDaisySP in the oF addons folder. It would hold various sub-folders with all of the header files. And it would have an addon_config.mk file which describes where a compiler should search for these files and folders.

An oF project in Qt Creator has a .qbs file, with oF specific stuff in it, including a section for which addons to use in the project. If you generate a project with the ofxGui addon for example, and look in the .qbs file, you’ll see ‘ofxGui’ listed as one of the addons. Once an addon has been added (and saved) to the .qbs file, the header files can be included in ofApp.h as needed.

If you look thru the addons that come with oF, you should find some that only have header files; ofxOsc might be a good example.

2 Likes

Thank you @TimChi, that sounds like an excellent solution! The DSP library is meant to be reusable in different projects.

I will look into it. Thanks for providing examples and pointers!

Staffan

Hey @TimChi, that did the trick!

I created an addon for the Daisy SP library, looked at the examples you gave, and now everything is working!

I will put some more work into this, and then contribute the addon as well as some hopefully useful code examples to the community. DaisySP is a powerful DSP library that easily integrates into OF. It is distributed under a MIT-license, just like OF.

Thank you! :slight_smile:

2 Likes

Hey fantastic! Yeah the addons aspect in oF is pretty amazing, especially for use in multiple projects. There is a page for addons too: ofxaddons.com. The oF community has created lots of addons over the years. And definitely simple examples that compile and demonstrate how to use the addon can be super helpful.

1 Like

Great, thanks for the link! I will contribute when I have some working (and interesting) demos! Give me 1-2 weeks! :slight_smile:

So far: A digital multichannel mixer and a subtractive synth that I think will be of use to others.

2 Likes