blob: 99a8081b079c8474a60dab38e73c07a9163c6846 [file] [log] [blame]
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=US-ASCII">
<title>Differences to Boost.Build V1</title>
<link rel="stylesheet" href="../../../doc/src/boostbook.css" type="text/css">
<meta name="generator" content="DocBook XSL Stylesheets V1.75.2">
<link rel="home" href="../index.html" title="The Boost C++ Libraries BoostBook Documentation Subset">
<link rel="up" href="../bbv2.html" title="Chapter&#160;33.&#160;Boost.Build V2 User Manual">
<link rel="prev" href="faq.html" title="Frequently Asked Questions">
</head>
<body bgcolor="white" text="black" link="#0000FF" vlink="#840084" alink="#0000FF">
<table cellpadding="2" width="100%"><tr>
<td valign="top"><img alt="Boost C++ Libraries" width="277" height="86" src="../../../boost.png"></td>
<td align="center"><a href="../../../index.html">Home</a></td>
<td align="center"><a href="../../../libs/libraries.htm">Libraries</a></td>
<td align="center"><a href="http://www.boost.org/users/people.html">People</a></td>
<td align="center"><a href="http://www.boost.org/users/faq.html">FAQ</a></td>
<td align="center"><a href="../../../more/index.htm">More</a></td>
</tr></table>
<hr>
<div class="spirit-nav">
<a accesskey="p" href="faq.html"><img src="../../../doc/src/images/prev.png" alt="Prev"></a><a accesskey="u" href="../bbv2.html"><img src="../../../doc/src/images/up.png" alt="Up"></a><a accesskey="h" href="../index.html"><img src="../../../doc/src/images/home.png" alt="Home"></a>
</div>
<div class="section">
<div class="titlepage"><div><div><h2 class="title" style="clear: both">
<a name="bbv2.vs_v1"></a>Differences to Boost.Build V1</h2></div></div></div>
<div class="toc"><dl>
<dt><span class="section"><a href="vs_v1.html#bbv2.overview.differences_to_v1.configuration">Configuration</a></span></dt>
<dt><span class="section"><a href="vs_v1.html#bbv2.overview.differences_to_v1.jamfiles">Writing Jamfiles</a></span></dt>
<dt><span class="section"><a href="vs_v1.html#bbv2.overview.differences_to_v1.build_process">Build process</a></span></dt>
</dl></div>
<p>While Boost.Build V2 is based on the same ideas as Boost.Build V1,
some of the syntax was changed, and some new important features were
added. This chapter describes most of the changes.</p>
<div class="section">
<div class="titlepage"><div><div><h3 class="title">
<a name="bbv2.overview.differences_to_v1.configuration"></a>Configuration</h3></div></div></div>
<p>In V1, toolsets were configured by environment variables. If you
wanted to use two versions of the same toolset, you had to create a new
toolset module that would set the variables and then invoke the base
toolset. In V2, toolsets are configured by the
<code class="computeroutput">using</code>, and you can easily configure several
versions of a toolset. See <a class="xref" href="overview.html#bbv2.overview.configuration" title="Configuration">the section called &#8220;Configuration&#8221;</a> for details.
</p>
</div>
<div class="section">
<div class="titlepage"><div><div><h3 class="title">
<a name="bbv2.overview.differences_to_v1.jamfiles"></a>Writing Jamfiles</h3></div></div></div>
<p>Probably one of the most important differences in V2 Jamfiles is
the use of project requirements. In V1, if several targets had the same
requirements (for example, a common <code class="computeroutput">#include</code> path), it was necessary to
manually write the requirements or use a helper rule or template target. In V2, the
common properties can be specified with the <code class="computeroutput">requirements</code> project
attribute, as documented in <a class="xref" href="overview.html#bbv2.overview.projects" title="Projects">the section called &#8220;Projects&#8221;</a>.
</p>
<p><a class="link" href="tutorial.html#bbv2.tutorial.libs" title="Dependent Targets">Usage requirements</a>
also help to simplify Jamfiles.
If a library requires
all clients to use specific <code class="computeroutput">#include</code> paths or macros when compiling
code that depends on the library, that information can be cleanly
represented.</p>
<p>The difference between <code class="computeroutput">lib</code> and <code class="computeroutput">dll</code> targets in V1 is completely
eliminated in V2. There's only one library target type, <code class="computeroutput">lib</code>, which can create
either static or shared libraries depending on the value of the
<a class="link" href="reference.html#bbv2.overview.builtins.features.link"><code class="varname">&lt;link&gt;</code>
feature</a>. If your target should be only built in one way, you
can add <code class="computeroutput">&lt;link&gt;shared</code> or <code class="computeroutput">&lt;link&gt;static</code> to its requirements.
</p>
<p>The syntax for referring to other targets was changed a bit. While
in V1 one would use:
</p>
<pre class="programlisting">
exe a : a.cpp &lt;lib&gt;../foo/bar ;
</pre>
<p>
the V2 syntax is:
</p>
<pre class="programlisting">
exe a : a.cpp ../foo//bar ;
</pre>
<p>
Note that you don't need to specify the type of other target, but the
last element should be separated from the others by a double slash to indicate that
you're referring to target <code class="filename">bar</code> in project <code class="filename">../foo</code>, and not to
project <code class="filename">../foo/bar</code>.
</p>
</div>
<div class="section">
<div class="titlepage"><div><div><h3 class="title">
<a name="bbv2.overview.differences_to_v1.build_process"></a>Build process</h3></div></div></div>
<p>The command line syntax in V2 is completely different. For example
</p>
<pre class="programlisting">
bjam -sTOOLS=msvc -sBUILD=release some_target
</pre>
<p>
now becomes:
</p>
<pre class="programlisting">
bjam toolset=msvc variant=release some_target
</pre>
<p>
or, using implicit features, just:
</p>
<pre class="programlisting">
bjam msvc release some_target
</pre>
<p>
See <a class="link" href="overview.html#bbv2.overview.invocation" title="Invocation">the reference</a> for a
complete description of the syntax.
</p>
</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"><div class="copyright-footer">Copyright &#169; 2006-2009 Vladimir Prus<p>Distributed under the Boost Software License, Version 1.0.
(See accompanying file <code class="filename">LICENSE_1_0.txt</code> or copy at
<a href="http://www.boost.org/LICENSE_1_0.txt" target="_top">http://www.boost.org/LICENSE_1_0.txt</a>)
</p>
</div></td>
</tr></table>
<hr>
<div class="spirit-nav">
<a accesskey="p" href="faq.html"><img src="../../../doc/src/images/prev.png" alt="Prev"></a><a accesskey="u" href="../bbv2.html"><img src="../../../doc/src/images/up.png" alt="Up"></a><a accesskey="h" href="../index.html"><img src="../../../doc/src/images/home.png" alt="Home"></a>
</div>
</body>
</html>