Adding custom Destinations in Xcode 4
I'm trying to use Xcode with an existing project that has a custom build system. It has several different platform targets, and I'd like to be able to specify any one of these and build it easily. All Xcode has to do is run make build-platform DEBUG=1
or something similar.
I've created an External Build System project (under the Mac OS X category, since that was the only option.) My only foreseeable problem is the Destination list. All I see here now is:
- My Mac 64-bit
- My Mac 32-bit
I've looked everywhere I can think of to change these, but to no avail. I need a list of different platforms here. How can I do this, and what would be the correct way to customize the build settings based on the destination?
(Note: I could p开发者_JAVA技巧robably also make this work with schemes for each platform, but I'd rather do it with destinations. Either way I still need to know how to get the make target to change based on the active setting.)
I have to work with an external Makefile project in Xcode 4, it's 32-bit only. It seems to me the trick to remove the "My Mac 64-bit" item was to set the architecture value (ARCH) to "i386".
In the Info tab I'm setting the makefile options and target:
These changes are really only cosmetic for Xcode's menu items - it's up to my build makefiles to build for the correct architectures. I have the "pass build settings ..." un-ticked, so I'm ignoring ARCH setting, and the rest for that matter.
I don't need i386 and x86-64, but if I did I would need to add rules to makefiles to build a universal binary.
The external makefile project support in Xcode 4 is a bit fiddly to get Xcode to show the correct target types, but it does seem to work. Watch out that by default it'll auto-create schemes when adding another target; you might end up with more schemes than you expected, or a mis-match between a scheme and it's target. I rename my targets and schemes to suite.
Hope this helps.
If you want to build the platforms separately, you will need to create individual configurations. Otherwise the XCode build step will build all defined architectures you have defined in the configuration into a single binary (eg. i386 + x86_64). This is true whether the build is run from XCode's IDE or from the xcodebuild command line, I'll presume you are using the latter as you have an external build system.
精彩评论