Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

source: downloads/boost_1_33_1/doc/html/bbv2/advanced/build_process.html @ 12

Last change on this file since 12 was 12, checked in by landauf, 18 years ago

added boost

File size: 9.7 KB
Line 
1<html>
2<head>
3<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
4<title>The Build Process</title>
5<link rel="stylesheet" href="../../boostbook.css" type="text/css">
6<meta name="generator" content="DocBook XSL Stylesheets V1.69.1">
7<style type="text/css">
8body { background-image: url('http://docbook.sourceforge.net/release/images/draft.png');
9       background-repeat: no-repeat;
10       background-position: top left;
11       /* The following properties make the watermark "fixed" on the page. */
12       /* I think that's just a bit too distracting for the reader... */
13       /* background-attachment: fixed; */
14       /* background-position: center center; */
15     }</style>
16<link rel="start" href="../../index.html" title="The Boost C++ Libraries">
17<link rel="up" href="../advanced.html" title="Chapter 24. User documentation">
18<link rel="prev" href="jamfiles.html" title="Writing Jamfiles">
19<link rel="next" href="builtins/targets.html" title="Builtin target types">
20</head>
21<body bgcolor="white" text="black" link="#0000FF" vlink="#840084" alink="#0000FF">
22<table cellpadding="2" width="100%">
23<td valign="top"><img alt="boost.png (6897 bytes)" width="277" height="86" src="../../../../boost.png"></td>
24<td align="center"><a href="../../../../index.htm">Home</a></td>
25<td align="center"><a href="../../../../libs/libraries.htm">Libraries</a></td>
26<td align="center"><a href="../../../../people/people.htm">People</a></td>
27<td align="center"><a href="../../../../more/faq.htm">FAQ</a></td>
28<td align="center"><a href="../../../../more/index.htm">More</a></td>
29</table>
30<hr>
31<div class="spirit-nav">
32<a accesskey="p" href="jamfiles.html"><img src="../../images/prev.png" alt="Prev"></a><a accesskey="u" href="../advanced.html"><img src="../../images/up.png" alt="Up"></a><a accesskey="h" href="../../index.html"><img src="../../images/home.png" alt="Home"></a><a accesskey="n" href="builtins/targets.html"><img src="../../images/next.png" alt="Next"></a>
33</div>
34<div class="section" lang="en">
35<div class="titlepage"><div><div><h2 class="title" style="clear: both">
36<a name="bbv2.advanced.build_process"></a>The Build Process</h2></div></div></div>
37<div class="toc"><dl>
38<dt><span class="section"><a href="build_process.html#id2856769">Build request</a></span></dt>
39<dt><span class="section"><a href="build_process.html#id2856811">Building a main target</a></span></dt>
40<dt><span class="section"><a href="build_process.html#id2856924">Building a project</a></span></dt>
41</dl></div>
42<p>When you've described your targets, you want Boost.Build to run the
43      right tools and create the needed targets.
44     
45      This section will describe
46      two things: how you specify what to build, and how the main targets are
47      actually constructed.
48    </p>
49<p>The most important thing to note is that in Boost.Build, unlike
50      other build tools, the targets you declare do not correspond to specific
51      files. What you declare in a Jamfile is more like a &#8220;metatarget.&#8221; 
52     
53      Depending on the properties you specify on the command line,
54      each metatarget will produce a set of real targets corresponding
55      to the requested properties. It is quite possible that the same
56      metatarget is built several times with different properties,
57       
58      producing different files.
59    </p>
60<div class="tip" style="margin-left: 0.5in; margin-right: 0.5in;">
61<h3 class="title">Tip</h3>
62<p>
63        This means that for Boost.Build, you cannot directly obtain a build
64        variant from a Jamfile. There could be several variants requested by the
65        user, and each target can be built with different properties.
66      </p>
67</div>
68<div class="section" lang="en">
69<div class="titlepage"><div><div><h3 class="title">
70<a name="id2856769"></a>Build request</h3></div></div></div>
71<p>
72        The command line specifies which targets to build and with which
73        properties. For example:
74</p>
75<pre class="programlisting">
76bjam app1 lib1//lib1 toolset=gcc variant=debug optimization=full
77</pre>
78<p>
79        would build two targets, "app1" and "lib1//lib1" with the specified
80        properties. You can refer to any targets, using
81        <a href="../reference/definitions.html#bbv2.reference.ids" title="Target identifiers and references">target id</a> and specify arbitrary
82        properties. Some of the properties are very common, and for them the name
83        of the property can be omitted. For example, the above can be written as:
84</p>
85<pre class="programlisting">
86bjam app1 lib1//lib1 gcc debug optimization=full
87</pre>
88<p>
89        The complete syntax, which has some additional shortcuts, is
90        described in <a href="../reference.html#bbv2.reference.commandline" title="Command line">the section called &#8220;Command line&#8221;</a>.
91        </p>
92</div>
93<div class="section" lang="en">
94<div class="titlepage"><div><div><h3 class="title">
95<a name="id2856811"></a>Building a main target</h3></div></div></div>
96<p>When you request, directly or indirectly, a build of a main target
97        with specific requirements, the following steps are made. Some brief
98        explanation is provided, and more details are given in <a href="../reference/buildprocess.html" title="Build process">the section called &#8220;Build process&#8221;</a>.
99        </p>
100<div class="orderedlist"><ol type="1">
101<li><p>Applying default build. If the default-build
102          property of a target specifies a value of a feature that is not
103          present in the build request, that value is added.</p></li>
104<li><p>Selecting the main target alternative to use. For
105              each alternative we look how many properties are present both in
106              alternative's requirements, and in build request. The
107              alternative with large number of matching properties is selected.
108            </p></li>
109<li><p>Determining "common" properties.
110         
111              The build request
112              is <a href="../reference/definitions.html#bbv2.reference.variants.proprefine" title="Property refinement">refined</a>
113              with target's requirements.
114             
115              The conditional properties in
116              requirements are handled as well. Finally, default values of
117              features are added.
118            </p></li>
119<li><p>Building targets referred by the sources list and
120              dependency properties. The list of sources and the properties
121              can refer to other target using <a href="../reference/definitions.html#bbv2.reference.ids" title="Target identifiers and references">target references</a>. For each
122              reference, we take all <a href="../reference/definitions.html#bbv2.reference.features.attributes.propagated">propagated</a>
123              properties, refine them by explicit properties specified in the
124              target reference, and pass the resulting properties as build
125              request to the other target.             
126            </p></li>
127<li><p>Adding the usage requirements produced when building
128              dependencies to the "common" properties. When dependencies are
129              built in the previous step, they return
130             
131              both the set of created
132              "real" targets, and usage requirements. The usage requirements
133              are added to the common properties and the resulting property
134              set will be used for building the current target.             
135            </p></li>
136<li><p>Building the target using generators. To convert the
137              sources to the desired type, Boost.Build uses "generators" ---
138              objects that correspond to tools like compilers and
139              linkers. Each generator declares what type of targets it
140             
141              can
142              produce and what type of sources it requires. Using this
143              information, Boost.Build determines which generators must be run
144              to produce a specific target from specific sources. When
145              generators are run, they return the "real" targets.
146            </p></li>
147<li><p>Computing the usage requirements to be returned. The
148          conditional properties in usage requirements are expanded
149         
150          and the
151          result is returned.</p></li>
152</ol></div>
153</div>
154<div class="section" lang="en">
155<div class="titlepage"><div><div><h3 class="title">
156<a name="id2856924"></a>Building a project</h3></div></div></div>
157<p>Often, a user builds a complete project, not just one main
158      target. In fact, invoking <span><strong class="command">bjam</strong></span> without
159      arguments
160     
161      builds the project defined in the current
162      directory.</p>
163<p>When a project is built, the build request is passed without
164        modification to all main targets in that project.
165       
166        It's is possible to
167        prevent implicit building of a target in a project with the
168        <code class="computeroutput">explicit</code> rule:
169</p>
170<pre class="programlisting">
171explicit hello_test ;
172</pre>
173<p>
174        would cause the <code class="computeroutput">hello_test</code> target to be built only if
175        explicitly requested by the user or by some other target.
176      </p>
177<p>The Jamfile for a project can include a number of
178      <code class="computeroutput">build-project</code> rule calls
179     
180      that specify additional projects
181      to be built.
182      </p>
183</div>
184</div>
185<table width="100%"><tr>
186<td align="left"></td>
187<td align="right"><small></small></td>
188</tr></table>
189<hr>
190<div class="spirit-nav">
191<a accesskey="p" href="jamfiles.html"><img src="../../images/prev.png" alt="Prev"></a><a accesskey="u" href="../advanced.html"><img src="../../images/up.png" alt="Up"></a><a accesskey="h" href="../../index.html"><img src="../../images/home.png" alt="Home"></a><a accesskey="n" href="builtins/targets.html"><img src="../../images/next.png" alt="Next"></a>
192</div>
193</body>
194</html>
Note: See TracBrowser for help on using the repository browser.