Files per target

Is it possible to specify certain files for a certain target in Introjucer? I have some iOS specific files I don't want to be compiled on other platforms.



It's a feature request we've had before, but is quite complex to implement as it means adding new per-file settings. I'm sure we'll add it though, it's a useful this to be able to do.

In the meantime, if these are source code files, you can easily just #ifdef out the code for different build settings.

The issue with using #ifdef is that it will still try and compile all the files in the project, even if they are not used or included ... and if I have Objective C and Swift files for an iOS build then they will also appear in the Android build and of course throw errors on compilation. I then have to manually delete the files from the non-iOS builds. 


It will be done, it's just a matter of when :)

I've been spending some time on improving the Introjucer UX recently, so I might get time to work on this soon after the next version of JUCE is out! I really hope I do, it's something I'd like too.

OK thanks, good to know its in the pipeline :)

Hey there !

Same here, I got some files to compile only in Xcode and some files only in Visual. The code is already multiplatform, inclusion of headers is protected by #ifdef but still if some .cpp files are included, the IDE will still try to compile them and fail. (And I don’t want to modify the content of external libraries with #ifdef everywhere)

In my case the nice feature would be to be able to ignore some files selectively per target. Nice to know that it is WIP.

Would you have any workaround to ignore files at compilations ? Through specific g++ flags or Xcode flags for example ?

My current workaround is deleting the directory each time I generate a new Xcode project file.

All the best.

Maybe have a look at a file like juce_gui_basics.cpp to see how we prefer to handle this kind of thing.

Could you put your platform dependent code in a custom JUCE module? If so, you can use filenames to specify when they should be compiled: