Thursday, July 8, 2010

Building from terminal with more than one Xcode version

It's possible to build against more than one Xcode version from terminal.
First step is to install Xcode versions alongside each other instead of as an Update. When you download the latest Xcode from Apple, just choose to install to a directory that's parallel to your current Xcode install. In this case we had Xcode 3.2.2 installed in the /Developer directory, so I installed Xcode 3.2.3 in a directory named /Developer323.
One of the tricky things I ran into after the 3.2.3 install was that it defaulted to this for all builds. I found this out when I tried to build existing iPhoneOS 3.1.3 builds and got the error:

=== BUILD NATIVE TARGET Mobile OF PROJECT Mobile WITH CONFIGURATION Release ===Check dependencies
No architectures to compile for (ARCHS=, VALID_ARCHS=i386 ppc ppc64 ppc7400 ppc970 x86_64).
[BEROR]No architectures to compile for (ARCHS=, VALID_ARCHS=i386 ppc ppc64 ppc7400 ppc970 x86_64).

Since we actually wanted to use 3.2.2 as the default I needed to know how to set this from terminal.
Apple gives several options for calling Xcode version from terminal:
http://developer.apple.com/mac/library/documentation/Xcode/Conceptual/XcodeCoexistence/Contents/Resources/en.lproj/Details/Details.html

Since the installs are sitting in parallel it became as easy as adding this line before the xcodebuild section in the build:
export DEVELOPER_DIR="/Developer"
and when we're ready to build iPhoneOS4 against 3.2.3 this line will become:
export DEVELOPER_DIR="/Developer323"

No comments:

Post a Comment