How to add compile sources to juce modules in 4.2?


we have core code inside a juce module which is difficult to group in cpp files because it depends on libraries like Boost and CGAL which cause a lot a redefinitions and other issues. In the old module system we would put in the juce_module_info all our compile sources like

 "compile":         [{"file":"juce_icarus.cpp"},

Is there any way to do something like this in the new module system? Right now it seems I can only add cpps that start with the module name, and are in the root folder.


Yeah, the point of that is to make it obvious from the folder structure which files need to be compiled, rather than this being knowledge that’s hidden away inside the config.

At a guess from what you’ve got there, I’d expect that you could probably include all those cpp files from a single master cpp file in the root folder, which will simplify things and also speed up your compilation a lot.


But thats thing, putting them in one cpp file causes compile errors. and the errors have to do with Boost code, which we dont want to change. Also for compile speed I think only clean builds are faster. Making a small one line change, would now have to recompile a bigger file.


Bigger files make very little difference to compile speed. The thing that slows you down is having many compile units which all include the same headers (in particular the boost headers).

If you’re using boost, then definitely the best plan would be to have a single cpp which includes boost once, and then includes all your own code. And obviously keep boost out of your module’s public header files so that other code doesn’t have to indirectly include it.


Ok thanks, I think I have this figured out