Re: [FAQ] Sharing Xcode precompiled headers across projects
Re: [FAQ] Sharing Xcode precompiled headers across projects
- Subject: Re: [FAQ] Sharing Xcode precompiled headers across projects
- From: Steve Baxter <email@hidden>
- Date: Tue, 17 Jan 2006 21:13:54 +0000
Thanks Chris - I'll give that a try!
I'd not found the shared .xcconfig stuff - that's going to solve
another problem really nicely I think. It's very laborious changing
a setting across all 80 projects - in Codewarrior we used pragmas to
control optimisation etc so all the projects had the same settings.
In Xcode I guess we can just use a shared .xcconfig file for this!
Cheers,
Steve.
On 17 Jan 2006, at 20:30, Chris Espinosa wrote:
On Jan 17, 2006, at 10:32 AM, Steve Baxter wrote:
I have a set of about 80 projects - a shared framework, 2
applications and about 77 modules. These projects all use the
same prefix file.
The problem is that Xcode precompiles a prefix file for each of my
projects. This is very slow, and at 40MB/project is going to
cause me trouble with disk space on my laptop machine. How can I
get Xcode to share precompiled headers across multiple projects?
On another note, Xcode seems to rebuild the precompiled header if
I look at the settings for a project (look but don't change).
Firstly surely it should be smart enough not to recompile this
unless it really has to, secondly why is looking at settings for a
project or target causing the project.pbxproj to get touched?
This is a really big problem as it can take over 30 minutes to
rebuild the larger projects from scratch!
The two main tools you use to make this happen are shared .xcconfig
files and the Preprocessor Macros Not Used In Precomiled Headers
build setting.
When deciding whether to reuse an existing shared precomp or
generate a new one, Xcode considers all build settings that can
affect the generation of the headers. So to maximize the
probability of sharing headers, you should share as many build
settings as possible among your similar targets. The best way to
do this is to factor out your settings into a
CommonSettings.xcconfig file and set the "Based On:" setting in
your targets to use this common file.
To tell which settings are differing and making Xcode create
separate precomps, follow these steps:
1) Open /Developer/Applications/Utilities/FileMerge.app
2) In the Finder, Go to Folder /Library/Caches/
com.Apple.Xcode.<your UID>/SharedPrecompiledHeaders
3) Find two folders with similar names (based on your prefix file)
that you expected would be shared.
4) In Outline view, turn down the folders so you see the
<prefixname>.gch.hash-criteria files inside those folders
5) Drag those files, one at a time, to the "Left" and "Right" wells
in FileMerge's Open dialog
You'll see a comparison of what criteria caused Xcode to generate
separate precompiled header files. If you can consolidate or
eliminate those flags, Xcode will reuse the precompiled header.
If the flags are -D flags (preprocessor macros), you can try moving
those "Preprocessor Macros" to the "Preprocessor Macros Not Used in
Precompiled Headers" build setting, and they won't be considered in
the hash criteria. Note that this is at your own risk: if one of
your precompiled headers actually uses that flag, and it's
different at build time, your results will be inaccurate.
Chris
Steve Baxter
Software Development Manager
Improvision
+44-2476-692229
_______________________________________________
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