On Dec 4, 2006, at 9:23 PM, Chris Espinosa wrote: I think that I might have some setting incorrect. I have a subproject which builds a static lib. This lib is used by each of the plugins, and should only need to be built once. However, when I do a full build, my PCH cache ends up with as many copies of this PCH folder as there are plugins, which implies that something is causing XCode to think it needs to be rebuilt for each plugin?
You can reduce or eliminate this by making sure that your plugins share one prefix file and have as many common compiler flags as possible. Inside each .pch directory is a file that contains a list of the relevant compiler flags that generated it. Diff these files, and figure out what settings are different. If you can eliminate the differences, the pch will be shared between targets and reused repeatedly, rather than being regenerated. The biggest offender is Preprocessor Macros; move all of them if possible to Preprocessor Macros Not Used In Precomps.
Expanding on what Chris talks about above, here are a few additional things you can do in defining your projects to make it more likely that they'll share precompiled header files.
First, move the compiler-related build settings that are common to all of the targets in a project into the project itself. In other words, instead of customizing the various compiler warnings, optimization levels, debug information generation, etc. build settings at the target level, customize them at the project level and leave them un-customized — that is, not boldfaced — at the target level. Any place a target-level setting isn't customized the higher project-level setting will be used, and since the compiler-related settings will be identical for every target in your project it will be much more likely that the precompiled header files will be shared among those targets. (If they're not, use the technique Chris describes above to look into why that's the case.)
Second, use the same prefix file (or a small set of common prefix files — say, one for Foundation-only components and one for AppKit-level components) for all of your targets and projects. That way the prefix file's contents will match exactly everywhere it's used, further improving the likelihood that the precompiled header generated from it will be shared.
Finally, if you'll find it helpful to do so, move all of your common customized build settings into an xcconfig file that you share among your projects, and use that as the basis for your projects' build configurations. This way, any time you need to change a setting, you can change it in a single place and have that change affect how all of the targets in all of your projects are built, and still reap the performance benefits of precompiled header sharing.
-- Chris
|