On Dec 4, 2006, at 5:22 PM, Blair M. Burtan wrote: Is it possible to configure an Xcode project (not using command line or other low tech method) to link in one set of frameworks for PPC and another for i386 so that the UB app doesn't complain when it can't find the set that's not pertinent for that processor?
Yes, but it isn't pretty. This solution is for Xcode 2.3 and later:
1) Add all the frameworks, both PowerPC and Intel, to the target that you want to link with them.
2) Add a build property in the target with the name and value
EXCLUDED_SOURCE_FILE_NAMES $(EXCLUDED_SOURCE_FILE_NAMES_$(CURRENT_ARCH))
3) Add a build property in the target with the name
EXCLUDED_SOURCE_FILE_NAMES_PPC
Its value should be a space-separated list of the names of the Intel-only frameworks (in the form MyIntelFramework.framework)
4) Add a build property in the target with the name
EXCLUDED_SOURCE_FILE_NAMES_i386
Its value should be a space-separated list of the names of the PowerPC-only frameworks.
When you build the target, Xcode iterates with $(CURRENT_ARCH) set in turn to PPC and i386. This will cause the value of EXCLUDED_SOURCE_FILE_NAMES to be the list of Intel-only libraries and the list of PPC-only libraries. When Xcode performs each build phase in the target for that architecture, it will toss out all files in the build phase that match any filename in that build setting. That means that your Intel-only libraries will be skipped for the PPC build and vice versa.
This technique works with all file types in all build phases, so it can be used for selective compilation, resource copying, etc. You can use the same technique with other build setting values than $(CURRENT_ARCH) to do per-variant links as well (debug, profile, etc.)
Make sure to add the build settings to All Configurations of the target so that your Debug and Release configurations do the same thing.
Chris |