| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135 |
- <html>
- <head>
- <meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
- <title>Chapter 23. Tutorial</title>
- <link rel="stylesheet" href="../boostbook.css" type="text/css">
- <meta name="generator" content="DocBook XSL Stylesheets V1.68.1">
- <style type="text/css">
- body { background-image: url('http://docbook.sourceforge.net/release/images/draft.png');
- background-repeat: no-repeat;
- background-position: top left;
- /* The following properties make the watermark "fixed" on the page. */
- /* I think that's just a bit too distracting for the reader... */
- /* background-attachment: fixed; */
- /* background-position: center center; */
- }</style>
- <link rel="start" href="../index.html" title="The Boost C++ Libraries">
- <link rel="up" href="../bbv2.html" title="Part III. Boost.Build v2 User Manual">
- <link rel="prev" href="installation.html" title="Chapter 22. Installation">
- <link rel="next" href="tutorial/properties.html" title="Properties">
- </head>
- <body bgcolor="white" text="black" link="#0000FF" vlink="#840084" alink="#0000FF">
- <table cellpadding="2" width="100%">
- <td valign="top"><img alt="boost.png (6897 bytes)" width="277" height="86" src="../../../boost.png"></td>
- <td align="center"><a href="../../../index.htm">Home</a></td>
- <td align="center"><a href="../../../libs/libraries.htm">Libraries</a></td>
- <td align="center"><a href="../../../people/people.htm">People</a></td>
- <td align="center"><a href="../../../more/faq.htm">FAQ</a></td>
- <td align="center"><a href="../../../more/index.htm">More</a></td>
- </table>
- <hr>
- <div class="spirit-nav">
- <a accesskey="p" href="installation.html"><img src="../images/prev.png" alt="Prev"></a><a accesskey="u" href="../bbv2.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="tutorial/properties.html"><img src="../images/next.png" alt="Next"></a>
- </div>
- <div class="chapter" lang="en">
- <div class="titlepage"><div><div><h2 class="title">
- <a name="bbv2.tutorial"></a>Chapter 23. Tutorial</h2></div></div></div>
- <div class="toc">
- <p><b>Table of Contents</b></p>
- <dl>
- <dt><span class="section"><a href="tutorial.html#bbv2.tutorial.hello">Hello, world</a></span></dt>
- <dt><span class="section"><a href="tutorial/properties.html">Properties</a></span></dt>
- <dd><dl>
- <dt><span class="section"><a href="tutorial/properties.html#bbv2.tutorial.properties.requirements">Build Requests and Target Requirements</a></span></dt>
- <dt><span class="section"><a href="tutorial/properties.html#bbv2.tutorial.properties.project_attributes">Project Attributes</a></span></dt>
- </dl></dd>
- <dt><span class="section"><a href="tutorial/hierarchy.html">Project Hierarchies</a></span></dt>
- <dt><span class="section"><a href="tutorial/libs.html">Dependent Targets</a></span></dt>
- <dt><span class="section"><a href="tutorial/linkage.html">Static and shared libaries</a></span></dt>
- <dt><span class="section"><a href="tutorial/conditions.html">Conditions and alternatives</a></span></dt>
- <dt><span class="section"><a href="tutorial/prebuilt.html">Prebuilt targets</a></span></dt>
- </dl>
- </div>
- <div class="section" lang="en">
- <div class="titlepage"><div><div><h2 class="title" style="clear: both">
- <a name="bbv2.tutorial.hello"></a>Hello, world</h2></div></div></div>
- <p>The simplest project that Boost.Build can construct is
- stored in <code class="filename">example/hello/</code> directory. The
- project is described by a file
- called <code class="filename">Jamroot</code> that contains:
- </p>
- <pre class="programlisting">
- exe hello : hello.cpp ;
- </pre>
- <p>
- Even with this simple setup, you can do some interesting
- things. First of all, just invoking <span><strong class="command">bjam</strong></span> will
- build the <code class="filename">hello</code>
- executable by compiling and
- linking <code class="filename">hello.cpp</code>. By default, debug variant
- is built. Now, to build the
- release variant of <code class="filename">hello</code>, invoke
- </p>
- <pre class="screen">
- bjam release
- </pre>
- <p>
- Note that debug and release variants are created in different
- directories, so you can switch between variants or even build
- multiple variants at once, without any unnecessary
- recompilation. Let's extend the example by adding another line
- to our project's <code class="filename">Jamroot</code>:
- </p>
- <pre class="programlisting">
- exe hello2 : hello.cpp ;
- </pre>
- <p>
- Now let us build both the debug and release variants of our project
- again:
- </p>
- <pre class="screen">
- bjam debug release
- </pre>
- <p>
- Note that two variants of <code class="filename">hello2</code> are linked.
- Since we have already built both variants
- of <code class="filename">hello</code>, hello.cpp won't be recompiled;
- instead the existing object files will just be linked into the
- corresponding variants of <code class="filename">hello2</code>. Now
- let's remove all the built products:
- </p>
- <pre class="screen">
- bjam --clean debug release
- </pre>
- <p>
- It's also possible to build or clean specific targets. The
- following two commands, respectively, build or clean only the
- debug version of <code class="filename">hello2</code>.
- </p>
- <pre class="screen">
- bjam hello2
- bjam --clean hello2
- </pre>
- </div>
- </div>
- <table xmlns:rev="http://www.cs.rpi.edu/~gregod/boost/tools/doc/revision" width="100%"><tr>
- <td align="left"></td>
- <td align="right"><small></small></td>
- </tr></table>
- <hr>
- <div class="spirit-nav">
- <a accesskey="p" href="installation.html"><img src="../images/prev.png" alt="Prev"></a><a accesskey="u" href="../bbv2.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="tutorial/properties.html"><img src="../images/next.png" alt="Next"></a>
- </div>
- </body>
- </html>
|