1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113
|
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
<HTML>
<HEAD>
<TITLE>The Program Execution Monitor: compilation</TITLE>
<LINK rel="stylesheet" type="text/css" href="../../style/btl.css" media="screen">
<LINK rel="stylesheet" type="text/css" href="../../style/btl-print.css" media="print">
<META http-equiv="Content-Language" content="en-us">
<META http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
</HEAD>
<BODY>
<DIV class="header"> <A href="../../index.html">Boost.Test</A> > <A href="../index.html">Components</A> > <A href="index.html">The
Program Execution Monitor</A> > <SPAN class="current_article">Compilation</SPAN> </DIV>
<DIV class="body"> <IMG src="../../btl1.gif" width="252" height="43" alt="Boost Test logo">
<H1 class="subtitle">The Program Execution Monitor compilation instructions </H1>
<P class="first-line-indented">Unlike most boost libraries the Program Execution
Monitor compilation may require you to go one extra mile. There are several
alternative options that you could consider:</P>
<UL>
<LI><A href="#static_build">Build standalone static library</A> (with possibility
to use <A href="#autolinking">auto linking feature</A>)</LI>
<LI><A href="#static_build">Build standalone dynamic library</A> (with possibility
to use <A href="#autolinking">auto linking feature</A>)</LI>
<LI><A href="#included_header">Single header that includes all the implementation
files</A></LI>
<LI><A href="#include_sources">Include the framework sources directly into
your test module project</A></LI>
</UL>
<P class="first-line-indented">Each option has it's advantages and drawbacks.
By default it's recommended to use standalone static library.</P>
<H4>Building standalone library<A name="build_standalone"></A></H4>
<P class="first-line-indented">The Program Execution Monitor implementaion
wraps a several system headers and designed to be used as standalone library.
While there exist an alternative option to include the whole implementation
directly into your test module, for the long term usage the preferable solution
is to build library once and reuse it.
Depending on your hardware this may save you significant time during compilation
and doesn't really require that much effort. </P>
<P class="first-line-indented">If you decided to go with standalone library,
you first need to build one. There are a varity of make systems that allow
you to do that. To name a few: GNU make and similar, all kinds of integrated
development environments. Boost preferred solution is Boost.Build system,
that is built on top of bjam tool. All make systems require some kind of
configuration file that list all files that constitute the library and all
the build options. For example makefile that is used by make, Microsoft Visual
Studio project file, Jamfile that is used by Boost.Build. For the sake of
simplicity lets call this file the makefile. To build a stanalone library
following files, that are located in the Boost Test Library source directory,
needs to be listed as source files in your makefile:</P>
<P class="indented"><A href="../../../src/execution_monitor.cpp">execution_monitor.cpp</A><BR>
<A href="../../../src/cpp_main.cpp">cpp_main.cpp</A></P>
<P class="first-line-indented">The <A href="../../../build/Jamfile">Jamfile</A> for
use with Boost.Build system is supplied in libs/test/build directory. </P>
<H5>Building static library<A name="static_build"></A></H5>
<P class="first-line-indented">There are no additional build defines or options
required to build static library. Using Boost.build system you could build
the static library with a following command from libs/test/build directory:</P>
<P class="indented">bjam -sTOOLS=<your-tool-name> "-sBUILD=" boost_prg_exec_monitor</P>
<P class="first-line-indented">Also on windows you could use this Microsoft
Visual Studio .NET <A href="../../../build/msvc71_proj/prg_exec_monitor.vcproj">project
file.</A></P>
<H5>Building dynamic library<A name="shared_build"></A></H5>
<P class="first-line-indented">To build dynamic library you need to add BOOST_TEST_DYN_LINK
to the list of defines in makefile. Using Boost.Build system you could build
the dynamic library with a following command from libs/test/build directory:</P>
<P class="indented">bjam -sTOOLS=<your-tool-name> "-sBUILD="boost_prg_exec_monitor</P>
<P class="first-line-indented">Also on windows you could use this Microsoft
Visual Studio .NET <A href="../../../build/msvc71_proj/prg_exec_monitor_dll.vcproj">project
file.</A> </P>
<P class="first-line-indented">Note that the same flag BOOST_TEST_DYN_LINK
needs to be defined during test module compilation for it to successfully
link with dynamic library. </P>
<H5>Using autolinking feature<A name="autolinking"></A></H5>
<P class="first-line-indented">For the Microsoft family of compilers Boost.Test
provides an ability to automatically select proper library name and add it
to the list of objects to be linked with. By default this feature is on.
To disable this feature you should define the flag BOOST_TEST_NO_LIB. More
detailes on autolinking feature implementation and configuration you could
see <A href="../../../../../more/separate_compilation.html#auto-link">here</A>.</P>
<H4>Using "included" option<A name="included_header"></A></H4>
<P class="first-line-indented">While building standalone library is preferred
solution, some users prefer "quick and dirty" include one. The
Program Execution Monitor provides an ability to do that. The only change that
is required for you to employ it is the path to the header file you include.
So the usual include staments:</P>
<PRE class="code">
#<SPAN class="reserv-word">include</SPAN> <boost/test/prg_exec_monitor.hpp>
<SPAN class="comment">...</SPAN></PRE>
<P>becomes:</P>
<PRE class="code">
#<SPAN class="reserv-word">include</SPAN> <boost/test/included/prg_exec_monitor.hpp>
...</PRE>
<P class="first-line-indented">This way you don't need to link with any prebuild
library. The whole Program Execution Monitor implementation in included directly
into your file. The autolionking feature is disabled also. </P>
<H4>Including sources directly into test module project<A name="include_sources"></A> </H4>
<P class="first-line-indented">Finnally you could include all the files listed
in <A href="#build_standalone">build standalone library</A> section directly
into you test module makefile. Obviosly there is no sence to employ an options
for dynamic build since you you are linking with implementation statically.</P>
</DIV>
<DIV class="footer">
<DIV class="footer-body">
<P> © <A name="Copyright">Copyright</A> <A href="mailto:boost-test%20at%20emailaccount%20dot%20com%20%28please%20unobscure%29">Gennadiy Rozental</A> 2001-2006. <BR>
Distributed under the Boost Software License, Version 1.0.
(See accompanying file <A href="../../../../../LICENSE_1_0.txt">LICENSE_1_0.txt</A> or copy at
<A href="http://www.boost.org/LICENSE_1_0.txt">www.boost.org/LICENSE_1_0.txt</A>)</P>
<P>Revised: <!-- #BeginDate format:Sw1 -->8 March, 2006<!-- #EndDate --> </P>
</DIV>
</DIV>
</BODY>
</HTML>
|