Closed 7sharp9 closed 8 months ago
Hi there!
Thanks for writing!
Using JuceHeader.h has been deprecated for some time, so if it's a new project, I would definitely avoid it! To do that, just include the .h
files you need from the juce modules you are using, like #include "juce_gui_basics/juce_gui_basics.h"
.
In terms of CMake, you'll just need to explicitly list the juce modules you want SharedCode to link to. Pamplejuce already does a handful of them:
target_link_libraries(SharedCode
INTERFACE
Assets
melatonin_inspector
juce_audio_utils
juce_audio_processors
juce_dsp
juce_gui_basics
juce_gui_extra
juce::juce_recommended_config_flags
juce::juce_recommended_lto_flags
juce::juce_recommended_warning_flags)
If you are converting an older project, IMO it's very worth the conversion away from JuceHeader (to using the actual juce modules you need) — you'll get faster compilation, autocomplete, etc. You can see an example of the conversion I did for the pluginval project: https://github.com/Tracktion/pluginval/pull/90/files — it's just making sure the juce::
prefix is added everywhere and your IDE should yell at you when you need to include one of the modules :)
I guess its just laziness and unfamiluarity where the juce bits and pieces are located, having them collated in the JuceHeader.h
was just handy thats all :-)
I've never used JuceHeader with CMake, but reading the docs, you would specify juce_generate_juce_header(SharedCode)
after the target_link_libraries
line.
That command looks at the added modules to generate the header, so you'll still need to manually figure out what modules you depend on...
Hope that helps!
Im wondering how I would go abaout adding 'juce_generate_juce_header' in the 'CMakeList.txt' so i can add a simple '#include' in my source files?
Do I add this to the 'SharedCode' or the
"${PROJECT_NAME}"
this pert of the template I do noy fully inderstand yet...Thanks for any insight!
Dave.