blob: a1febbc18aa099eada3a19f6b24a6e23f4899229 [file] [log] [blame]
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
<title>The Program Execution Monitor compilation</title>
<link rel="stylesheet" href="../../style/style.css" type="text/css">
<meta name="generator" content="DocBook XSL Stylesheets V1.74.0">
<link rel="home" href="../index.html" title="Boost Test Library">
<link rel="up" href="../prg-exec-monitor.html" title="Part II. Boost Test Library: The Program Execution Monitor">
<link rel="prev" href="impl.html" title="The Program Execution Monitor implementation">
<link rel="next" href="../minimal.html" title="Part III. Boost Test Library: The minimal testing facility">
<script language="JavaScript1.2" src="../../js/boost-test.js"></script>
</head>
<body bgcolor="white" text="black" link="#0000FF" vlink="#840084" alink="#0000FF">
<table width="100%"><tr>
<td width="10%"><a href="../index.html"><img alt="Home" width="229" height="61" border="0" src="../../../../../libs/test/docbook/img/boost.test.logo.png"></a></td>
<td valign="middle" align="left"> &gt; <a href="../prg-exec-monitor.html">The Program Execution Monitor</a><a href="../minimal.html">
&gt;
</a><b>Compilation</b>
</td>
<td><div class="spirit-nav">
<a href="impl.html"><img src="../../../../../doc/html/images/prev.png" alt="Prev"></a><a href="../minimal.html"><img src="../../../../../doc/html/images/next.png" alt="Next"></a>
</div></td>
</tr></table>
<hr>
<div class="section" lang="en">
<div class="titlepage"><div><div><h3 class="title">
<a name="pem.compilation"></a>The Program Execution Monitor compilation</h3></div></div></div>
<p class="first-line-indented">
In comparison with many other boost libraries, which are completely implemented in header files, compilation and
linking with the Program Execution Monitor may require additional steps. The Program Execution Monitor presents you with options to either
<a class="link" href="compilation.html#pem.compilation.standalone" title="Standalone library compilation">built and link with a standalone library</a> or
<a class="link" href="compilation.html#pem.compilation.direct-include" title="Including the Program Execution Monitor directly into your program">include the implementation directly</a> into your
program. If you opt to use the library the Program Execution Monitor header implements the
<a class="link" href="compilation.html#pem.compilation.auto-linking" title="Support of the auto-linking feature">auto-linking support</a> and following flags can be used to configure
compilation of the Program Execution Monitor library and your program:
</p>
<div class="table">
<a name="pem.compilation.flags"></a><p class="title"><b>Table 2. Program Execution Monitor compilation flags</b></p>
<div class="table-contents"><table class="table" summary="Program Execution Monitor compilation flags">
<colgroup>
<col>
<col>
</colgroup>
<thead><tr>
<th>Variable</th>
<th>Usage</th>
</tr></thead>
<tbody>
<tr>
<td>
<a name="pem.flag.dyn-link"></a>BOOST_TEST_DYN_LINK</td>
<td>Define this flag to build/use dynamic library.</td>
</tr>
<tr>
<td>
<a name="pem.flag.no-lib"></a>BOOST_TEST_NO_LIB</td>
<td>Define this flag to prevent auto-linking.</td>
</tr>
</tbody>
</table></div>
</div>
<br class="table-break"><div class="section" lang="en">
<div class="titlepage"><div><div><h4 class="title">
<a name="pem.compilation.standalone"></a>Standalone library compilation</h4></div></div></div>
<p class="first-line-indented">
If you opted to link your program with the standalone library, you need to build it first. To build a standalone
library all C++ files (.cpp), that constitute Program Execution Monitor <a class="link" href="impl.html" title="The Program Execution Monitor implementation">implementation</a> need to be
listed as source files in your makefile<sup>[<a name="id642858" href="#ftn.id642858" class="footnote">1</a>]</sup>.
</p>
<p class="first-line-indented">
The makefile for use with Boost.Build system is supplied in <code class="filename">libs/test/build</code>
directory. The Program Execution Monitor can be built as either <a class="link" href="compilation.html#pem.compilation.standalone.static" title="Static library compilation">static</a>
or <a class="link" href="compilation.html#pem.compilation.standalone.dynamic" title="Dynamic library compilation">dynamic</a> library.
</p>
<div class="section" lang="en">
<div class="titlepage"><div><div><h5 class="title">
<a name="pem.compilation.standalone.static"></a>Static library compilation</h5></div></div></div>
<p class="first-line-indented">
There are no additional build defines or options required to build static library. Using Boost.Build system you
can build the static library with a following command from libs/test/build directory:
</p>
<div class="cmdsynopsis"><p><code class="command">bjam</code> [-sTOOLS=&lt;your-tool-name&gt;] {-sBUILD=boost_prg_exec_monitor}</p></div>
<p class="first-line-indented">
Also on Windows you can use the Microsoft Visual Studio .NET project file provided.
</p>
</div>
<div class="section" lang="en">
<div class="titlepage"><div><div><h5 class="title">
<a name="pem.compilation.standalone.dynamic"></a>Dynamic library compilation</h5></div></div></div>
<p class="first-line-indented">
To build the dynamic library<sup>[<a name="id643007" href="#ftn.id643007" class="footnote">2</a>]</sup> you
need to add <a class="xref" href="compilation.html#pem.flag.dyn-link">BOOST_TEST_DYN_LINK</a> to the list of macro definitions in the
makefile. Using the Boost.Build system you can build the dynamic library with the following command from
<code class="filename">libs/test/build</code> directory:
</p>
<div class="cmdsynopsis"><p><code class="command">bjam</code> [-sTOOLS=&lt;your-tool-name&gt;] {-sBUILD=boost_prg_exec_monitor}</p></div>
<p class="first-line-indented">
Also on Windows you can use the Microsoft Visual Studio .NET project file provided.
</p>
<div class="important"><table border="0" summary="Important">
<tr>
<td rowspan="2" align="center" valign="top" width="25"><img alt="[Important]" src="../../../../../doc/html/images/important.png"></td>
<th align="left">Important</th>
</tr>
<tr><td align="left" valign="top"><p>
For your program to successfully link with the dynamic library the flag
<a class="xref" href="compilation.html#pem.flag.dyn-link">BOOST_TEST_DYN_LINK</a> needs to be defined both during dynamic library
build and during your program compilation.
</p></td></tr>
</table></div>
</div>
</div>
<div class="section" lang="en">
<div class="titlepage"><div><div><h4 class="title">
<a name="pem.compilation.auto-linking"></a>Support of the auto-linking feature</h4></div></div></div>
<p class="first-line-indented">
For the Microsoft family of compilers the Program Execution Monitor provides an ability to automatically select proper library name
and add it to the list of objects to be linked with. To employ this feature you required to include either header
<a href="../../../../../boost/test/prg_exec_monitor.hpp" target="_top"><code class="filename">boost/test/prg_exec_monitor.hpp</code></a>
or header
<a href="../../../../../boost/test/included/prg_exec_monitor.hpp" target="_top"><code class="filename">boost/test/included/prg_exec_monitor.hpp</code></a>
By default the feature is going to be enabled. To disable it you have to define the flag
<a class="xref" href="compilation.html#pem.flag.no-lib">BOOST_TEST_NO_LIB</a>.
</p>
<p class="first-line-indented">
For more details on the auto-linking feature implementation and configuration you should consult the
<a href="../under_construction.html" target="_top">appropriate documentation</a>.
</p>
</div>
<div class="section" lang="en">
<div class="titlepage"><div><div><h4 class="title">
<a name="pem.compilation.direct-include"></a>Including the Program Execution Monitor directly into your program</h4></div></div></div>
<p class="first-line-indented">
If you prefer to avoid the standalone library compilation you have two alternative usage variants: you can either
include all files that constitute the static library in your program's makefile or include them as a part of
your program's source file. To facilitate the later variant the Program Execution Monitor implementation presents the header
<a href="../../../../../boost/test/included/prg_exec_monitor.hpp" target="_top"><code class="filename">boost/test/included/prg_exec_monitor.hpp</code></a>
In both variants neither <a class="xref" href="compilation.html#pem.flag.dyn-link">BOOST_TEST_DYN_LINK</a> nor
<a class="xref" href="compilation.html#pem.flag.no-lib">BOOST_TEST_NO_LIB</a> are applicable. This solution may not be the best choice
in a long run, since it requires the Program Execution Monitor sources recompilation for every program you use it with.
</p>
</div>
<div class="footnotes">
<br><hr width="100" align="left">
<div class="footnote"><p><sup>[<a name="ftn.id642858" href="#id642858" class="simpara">1</a>] </sup>There are varieties of make systems that can be used. To name
a few: <acronym class="acronym">GNU</acronym> make (and other make clones) and build systems integrated into <acronym class="acronym">IDE</acronym>s
(for example Microsoft Visual Studio). The Boost preferred solution is Boost.Build system that is based on top of
bjam tool. Make systems require some kind of configuration file that lists all files that constitute the library
and all build options. For example the makefile that is used by make, or the Microsoft Visual Studio project file,
Jamfile is used by Boost.Build. For the sake of simplicity let's call this file the makefile.</p></div>
<div class="footnote"><p><sup>[<a name="ftn.id643007" href="#id643007" class="simpara">2</a>] </sup>What is meant by the term dynamic library is a <em class="firstterm">dynamically
loaded library</em>, alternatively called a <em class="firstterm">shared library</em>.</p></div>
</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 © 2001-2007 Gennadiy Rozental</div></td>
</tr></table>
<hr>
<div class="spirit-nav">
<a accesskey="p" href="impl.html"><img src="../../../../../doc/html/images/prev.png" alt="Prev"></a><a accesskey="u" href="../prg-exec-monitor.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="../minimal.html"><img src="../../../../../doc/html/images/next.png" alt="Next"></a>
</div>
</body>
</html>