Re: Optimization flags on a per file and per platform basis
Re: Optimization flags on a per file and per platform basis
- Subject: Re: Optimization flags on a per file and per platform basis
- From: Andreas Wittenstein <email@hidden>
- Date: Sun, 8 Jul 2007 22:20:27 -0700
Emile,
I'm not sure how this will work in our environment, where we have a
single configuration and are building a UB for our final target.
You need to build separate configurations for PPC and X86, and then
use 'lipo' to paste the executable from one into the other.
For example,
1. Open a Terminal window (from the "Applications:Utilities" folder).
2. Navigate to your build directory with the 'cd' command.
3. Paste the PPC executable onto the X86 executable by typing:
lipo "<ppc>/<program>.app/Contents/MacOS/<program>" "<x86>/
<program>.app/Contents/MacOS/<program>" -create -output "<x86>/
<program>.app/Contents/MacOS/<program>"
where <ppc> and <x86> are the subdirectories containing the PPC and
X86 editions, respectively, and <program> is the name of the program.
I should be possible to add a script to Xcode to do this, but I
haven't taken the time to figure out how yet.
Andreas Wittenstein
BitJazz Inc.
http://www.bitjazz.com/
At 8:09 PM -0700 7/8/07, Andreas Wittenstein wrote:
Emile,
I've encountered a situation where the Unroll loops optimization
is causing incorrect behavior on MacIntel but not on PPC. I
(think I) know how to turn this off on a per file, per target
basis, not on a per file, per platform basis. In CodeWarrior, one
could do this sort of thing by conditionally compiling in
#pragmas to change the optimization settings. The documentation
of #pragma for GCC is sparse in this regard.
First of all, GCC doesn't do #pragmas.
To set different optimizations on a per file per platform basis:
1. In the project window, under the desired target, select the
desired source files.
2. Select 'File > Get Info'.
3. In the Info window, select the 'Build' tab.
When I do this, the info window says, "Additional Compiler Flags
for Target "Foo", where "foo" is not necessarily the target in step 1.
Hmm, I see what you mean: in my case it seems to truncate the target
name. But that's just a bug in the display. You can look at the
compiler log to verify that it's doing the right thing.
4. In the 'Additional Compiler Flags' field, type "$
(PlatformFlags)" (without the quotes).
5. In the project window, select the desired target.
6. Select 'File > Get Info'.
7. In the Info windows, click the 'Build' tab.
8. In the 'Configuration' pop-up menu, select the desired platform.
9. In the 'Collection' pop-up menu, select 'Customized Settings'.
10. Below the Settings & Values pane, click the '+' button to add
a new setting.
11. In the new setting, in the 'Setting' field, type
"PlatformFlags" (without the quotes).
12. In the 'Value' field, list the custom flags for this platform.
13. Repeat steps 5..12 for the next platform.
Andreas Wittenstein
BitJazz Inc.
http://www.bitjazz.com/
_______________________________________________
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