kstenerud / iOS-Universal-Framework

An XCode project template to build universal frameworks (arm7, arm7s, and simulator) for iOS / iPhone.
2.95k stars 474 forks source link

Issues with duplicate source file names in different dependent projects #183

Open DarioAhdoot opened 9 years ago

DarioAhdoot commented 9 years ago

I've detected an issue which manifests when you have source files with duplicate names in different dependent projects. The issue results when building the "other" platform (e.g. when building for simulator when build is triggered for device, and vice-versa) and is due to the fact all object files get dumped into the same directory when building for the "other" platform.

For instance, assume you have a file called Foo.cpp in project A and in project B, and your framework is called F. Assume you kick off your archive build building for the Device (i.e. not Simulator). Xcode will go and create a directory structure like this in it's DerivedData folder:

Build/Intermediates/ArchiveIntermediates/IntermediateBuildFilesPath/A.build/Release-iphoneos/ Build/Intermediates/ArchiveIntermediates/IntermediateBuildFilesPath/B.build/Release-iphoneos/ Build/Intermediates/ArchiveIntermediates/IntermediateBuildFilesPath/F.build/Release-iphoneos/

putting the object files for each project in it's respective folder.

Then, the BuildFW.py script runs. Instead of the Xcode build getting kicked off in a way that adheres to the above structure, except that object files get put into Release-iphonesimulator instead of Release-iphoneos, ALL object files from ALL projects get put under F.build/Release-iphonesimulator. In other words, the projects don't get their object files put into their own folders... they all go into the framework's folder.

Obviously, if you have multiple files with the same name in different projects, the one being built second will overwrite the first one.

The workaround is to ensure you don't have identical file names, but this seems like a hack at best.