Introjucer/Projucer different files for different platforms


Is is possible to have some files included in OS X build and others in WIN build?
We are in a situation where external libraries require inclusion of different files for different platforms.
#ifdefs can take care of which file to really include at compile time, but how do we include OS X file only for Xcode and VS files for Windows ?

What sort of files are you referring too? In the Projucer under files if you click a directory you will get to choose for any files in that directory if they are compiled as source, included as a binary resource, or included as an xcode resource.

Compiled source as you have pointed out can be guarded using #ifdef. I don’t think from the Introjucer you can select if binary resources will be added for only particular formats (you could do this else where manually if you prefer) but it’s not a huge issue because you can decide which ones are referenced from the compiled code. Xcode resources will of course only be added for Xcode projects and I believe this will appear in the bundle, what sort of other files can you add in VS? the output is normally a single executable or dll so really any resources are better kept in the binary if at all possible, files could also exists on disk but it would be up to your pre/post build scripts or installers to sort that out.

Hi Anthony and thanks for replying …

Basically - it seems to be very challenging to include a third party library with Introjucer . Obviously these are pre-compiled and will have different binary files, but also the headers can be different since on OS X some will have ObjC interface, on Windows it will be C++ interface an so on. Creating a common bridge to these interfaces with one header file is a common practice and then included files will just work. The problem is - how to properly include these files just for one platform.
Once can be creative with the Header/Library files locations for example, but in the project I’m working on now - there is a OS X framework on the OS X side of things that also needs to be added to Embedded Binaries in Xcode.
Would be much easier if one could right click on a file/folder and select the target to be either “ALL”, OS X" or one of the “VS” options.

For an OS X Framework you should be able to use the “Extra Frameworks” entry in the Xcode exporter, if you need to add a framework search path either use the custom Xcode flags in each configuration by setting FRAMEWORK_SEARCH_PATHS=/path/to/my/framework or in the exporter I think you can do -F/path/to/my/framework in the extra linker flags, that’s basically all the FRAMEWORK_SEARCH_PATHS setting does anyway. I also suspect for the framework you can do -framework MyFramework in the extra linker flags but that should be what “Extra Frameworks” does for you anyway.

For including the headers I would indeed make a common bridge, if possible I would try to include <juce_core/juce_core.h> and use the JUCE_WINDOWS and JUCE_MAC definitions, if that’s problematic for whatever reason, for windows use…

#if (defined (_WIN32) || defined (_WIN64))

and for OS X use…

if defined (__APPLE_CPP__) || defined(__APPLE_CC__) (warning: that will compile for iOS too, check TARGET_OS_IPHONE and TARGET_IPHONE_SIMULATOR for detecting the difference between iOS and OS X / macOS.

Hope that helps.