~ubuntu-branches/ubuntu/raring/boost-build/raring

« back to all changes in this revision

Viewing changes to doc/html/bbv2/reference/precompiled_headers.html

  • Committer: Bazaar Package Importer
  • Author(s): Steve M. Robbins
  • Date: 2008-08-06 00:38:31 UTC
  • mfrom: (4.1.1 intrepid)
  • Revision ID: james.westby@ubuntu.com-20080806003831-zr65893244swds0b
Tags: 2.0-m12-2
* debian/rules: Do not install /etc/user-config.jam.
* debian/site-config.jam: New.  Install into /etc instead of empty
  example.  Closes: #493323.

* debian/control: Update homepage.  Update description.  Closes:
  #493510.  Update Standards-Version to 3.8.0; no changes.

* debian/compat: New.  Set compat level to 7.
* debian/rules: Remove DH_COMPAT setting.
* debian/control: Change debhelper build-dep to version >= 7.

* debian/control: Remove docbook-to-man, bison from build-deps.

* debian/rules: Clean up upstream source by removing debian/conffiles.

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
<html>
 
2
<head>
 
3
<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
 
4
<title>Precompiled Headers</title>
 
5
<link rel="stylesheet" href="../../boostbook.css" type="text/css">
 
6
<meta name="generator" content="DocBook XSL Stylesheets V1.69.1">
 
7
<link rel="start" href="../../index.html" title="Boost.Build V2 User Manual">
 
8
<link rel="up" href="../tasks.html" title="Chapter�5.�Common tasks">
 
9
<link rel="prev" href="../builtins/raw.html" title="Custom commands">
 
10
<link rel="next" href="generated_headers.html" title="Generated headers">
 
11
</head>
 
12
<body bgcolor="white" text="black" link="#0000FF" vlink="#840084" alink="#0000FF">
 
13
<table cellpadding="2" width="100%"><tr><td valign="top"><img alt="Boost C++ Libraries" width="277" height="86" src="../../../../boost.png"></td></tr></table>
 
14
<hr>
 
15
<div class="spirit-nav">
 
16
<a accesskey="p" href="../builtins/raw.html"><img src="../../../../doc/html/images/prev.png" alt="Prev"></a><a accesskey="u" href="../tasks.html"><img src="../../../../doc/html/images/up.png" alt="Up"></a><a accesskey="h" href="../../index.html"><img src="../../../../doc/html/images/home.png" alt="Home"></a><a accesskey="n" href="generated_headers.html"><img src="../../../../doc/html/images/next.png" alt="Next"></a>
 
17
</div>
 
18
<div class="section" lang="en">
 
19
<div class="titlepage"><div><div><h2 class="title" style="clear: both">
 
20
<a name="bbv2.reference.precompiled_headers"></a>Precompiled Headers</h2></div></div></div>
 
21
<p>Precompiled headers is a mechanism to speed up compilation
 
22
      by creating a partially processed version of some header files,
 
23
      and then using that version during compilations rather then
 
24
      repeatedly parsing the original headers. Boost.Build supports
 
25
      precompiled headers with gcc and msvc toolsets.</p>
 
26
<p>To use precompiled headers, follow these steps:</p>
 
27
<div class="orderedlist"><ol type="1">
 
28
<li><p>Create a header that includes big headers used by your project.
 
29
        It's better to include only headers that are sufficiently stable &#8212;
 
30
        like headers from the compiler, and external libraries. Please wrap
 
31
        the header in <code class="computeroutput">#ifdef BOOST_BUILD_PCH_ENABLED</code>, so that
 
32
        the potentially expensive inclusion of headers is not done
 
33
        when PCH is not enabled. Include the new header at the top of your
 
34
        source files.</p></li>
 
35
<li>
 
36
<p>Declare a new Boost.Build target for the precompiled header
 
37
        and add that precompiled header to the sources of the target whose compilation
 
38
        you want to speed up:
 
39
        </p>
 
40
<pre class="programlisting">
 
41
cpp-pch pch : header.hpp ;
 
42
exe main : main.cpp pch ;</pre>
 
43
<p>
 
44
        You can use the <code class="computeroutput">c-pch</code> if you want to use the precompiled
 
45
        header in C programs.
 
46
        </p>
 
47
</li>
 
48
</ol></div>
 
49
<p>The <code class="filename">pch</code> example in Boost.Build distribution
 
50
      can be used as reference.</p>
 
51
<p>Please note the following:</p>
 
52
<div class="itemizedlist"><ul type="disc">
 
53
<li><p>The inclusion of the precompiled header must be the
 
54
        first thing in a source file, before any code or preprocessor directives.
 
55
        </p></li>
 
56
<li><p>The build properties used to compile the source files 
 
57
        and  the precompiled header must be the same. Consider using 
 
58
        project requirements to assure this.
 
59
        </p></li>
 
60
<li><p>Precompiled headers must be used purely as a way to
 
61
        improve compilation time, not to save the number of <code class="computeroutput">#include</code>
 
62
        statements. If a source file needs to include some header, explicitly include
 
63
        it in the source file, even if the same header is included from
 
64
        the precompiled header. This makes sure that your project will build
 
65
        even if precompiled headers are not supported.</p></li>
 
66
</ul></div>
 
67
</div>
 
68
<table xmlns:rev="http://www.cs.rpi.edu/~gregod/boost/tools/doc/revision" width="100%"><tr>
 
69
<td align="left"></td>
 
70
<td align="right"><small></small></td>
 
71
</tr></table>
 
72
<hr>
 
73
<div class="spirit-nav">
 
74
<a accesskey="p" href="../builtins/raw.html"><img src="../../../../doc/html/images/prev.png" alt="Prev"></a><a accesskey="u" href="../tasks.html"><img src="../../../../doc/html/images/up.png" alt="Up"></a><a accesskey="h" href="../../index.html"><img src="../../../../doc/html/images/home.png" alt="Home"></a><a accesskey="n" href="generated_headers.html"><img src="../../../../doc/html/images/next.png" alt="Next"></a>
 
75
</div>
 
76
</body>
 
77
</html>