Re: Cross OS version UB development
Re: Cross OS version UB development
- Subject: Re: Cross OS version UB development
- From: Eric Albert <email@hidden>
- Date: Sat, 24 Feb 2007 11:53:09 -0800
On Feb 24, 2007, at 11:00 AM, Shawn Erickson wrote:
On Feb 24, 2007, at 10:15 AM, Andreas Wittenstein wrote:
It is probably safer to create two targets in your project,
one for Intel only (using 10.4) and one for PPC (10.2) and
meld them together using lipo in a 3rd target that has only a
run script build phase.
Why? Xcode supports building a UB directly for you (by default
Release configuration does this while Debug only build the
platform you are running on). You don't need to make it harder
on yourself. This capability works fine so I suggest you use it.
Because I'm not an Xcode wizard.
You don't have to be.
Right. And you have to be a terminal wizard to set up script
phase that lipos your binaries. This was necessary in Xcode 2.1,
but those days, luckily, are long gone.
I wish that were true. Unfortunately, Xcode's automatic Universal
Binary creation facility always applies exactly the same rules to
exactly the same set of files for both the ppc and i386 editions
of a Universal Binary. Any deviation from this prescription
requires that the two editions be lipo'd together
manually. ...this means I have many processor-specific source
files with processor-specific flags
I don't see why you cannot use it.
If you have different files that contain processor specific
implementation then you can specify per file compiler flags as
needed (sounds like you are doing this) and wrap the code in those
files with architecture ifdefs (__i386__, __ppc__, etc.). Then at
compile time each file should gets compiled with the correct flags
and code not meant for a particular architecture would be ignored.
Unless you really don't have different source files for different
target CPUs.
Also you can use PER_ARCH_CFLAGS_i386, PER_ARCH_CFLAGS_ppc,
OTHER_LDFLAGS_i386, and OTHER_LDFLAGS_ppc to define architecture-
specific flags. These options likely cover the common cases well
enough for most folks and I think can cover your case as well.
On top of that, in many cases common architecture-specific flags are
supported by gcc for other architectures and simply ignored:
black-macbook:~> gcc -arch i386 -Wall -g -o test -faltivec test.c
black-macbook:~>
I've yet to see a project which couldn't be made to build universal
in Xcode via a single target. Some cases require a bit of work, but
it's always possible.
-Eric
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Xcode-users mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden