Projucer and platform specific files


#1

I am looking for a way to selectively include files depending on the exporter that is used. Is there something like that ?


#2

Depending on the exporter, or depending on the platform?

The latter can be achieved by creating your own JUCE module: https://github.com/WeAreROLI/JUCE/blob/master/modules/JUCE%20Module%20Format.txt


#3

That is a nice solution. But it would also be a great addition to the project creation, if that naming pattern, that is applied to selectively choose files for inclusion, is extended to the project files. I would go step further and extend the naming pattern to exporters as well. So, we would have

*_MacOSX.cpp
*_Windows.cpp
*_VisualStudio2015.cpp
*_iOS.cpp

This would add a great deal of flexibility to project creation.

PS: The project creation solution is really powerful. That’s why I go thru the pain of recreating our project in Projucer.


#4

Why don’t you just include all the files wrap the contents in platform macros e.g.
JUCE_MAC, JUCE_WINDOWS, JUCE_LINUX etc.? That way the contents will get selectively compiled.

If you really need to know the compiler version there’s macros for that. I think there something like _MSC_VER etc. on Windows.


#5

I will revert to something like that. It was meant as a suggestion, as this pattern exists for module files, so there is little reason not to extend it to project files.