WSJT-X/boost/libs/math/doc/html/math_toolkit/building.html

165 lines
14 KiB
HTML

<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=US-ASCII">
<title>If and How to Build a Boost.Math Library, and its Examples and Tests</title>
<link rel="stylesheet" href="../math.css" type="text/css">
<meta name="generator" content="DocBook XSL Stylesheets V1.79.1">
<link rel="home" href="../index.html" title="Math Toolkit 2.5.1">
<link rel="up" href="../overview.html" title="Chapter&#160;1.&#160;Overview">
<link rel="prev" href="perf_over1.html" title="Performance">
<link rel="next" href="history1.html" title="History and What's New">
</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="perf_over1.html"><img src="../../../../../doc/src/images/prev.png" alt="Prev"></a><a accesskey="u" href="../overview.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><a accesskey="n" href="history1.html"><img src="../../../../../doc/src/images/next.png" alt="Next"></a>
</div>
<div class="section">
<div class="titlepage"><div><div><h2 class="title" style="clear: both">
<a name="math_toolkit.building"></a><a class="link" href="building.html" title="If and How to Build a Boost.Math Library, and its Examples and Tests">If and How to Build a Boost.Math
Library, and its Examples and Tests</a>
</h2></div></div></div>
<h5>
<a name="math_toolkit.building.h0"></a>
<span class="phrase"><a name="math_toolkit.building.building_a_library_shared_dynami"></a></span><a class="link" href="building.html#math_toolkit.building.building_a_library_shared_dynami">Building a
Library (shared, dynamic .dll or static .lib)</a>
</h5>
<p>
The first thing you need to ask yourself is "Do I need to build anything
at all?" as the bulk of this library is header only: meaning you can use
it just by #including the necessary header(s).
</p>
<p>
For most simple uses, including a header (or few) is best for compile time
and program size.
</p>
<p>
Refer to <a class="link" href="../extern_c.html" title='Chapter&#160;7.&#160;TR1 and C99 external "C" Functions'>C99 and C++ TR1 C-style Functions</a>
for pros and cons of using the TR1 components as opposed to the header only
ones.
</p>
<p>
The <span class="emphasis"><em>only</em></span> time you <span class="emphasis"><em>need</em></span> to build the
library is if you want to use the <code class="computeroutput"><span class="keyword">extern</span>
<span class="string">"C"</span></code> functions declared in
<code class="computeroutput"><span class="special">&lt;</span><span class="identifier">boost</span><span class="special">/</span><span class="identifier">math</span><span class="special">/</span><span class="identifier">tr1</span><span class="special">.</span><span class="identifier">hpp</span><span class="special">&gt;</span></code>. To build this using Boost.Build, from
a commandline boost-root directory issue a command like:
</p>
<pre class="programlisting"><span class="identifier">bjam</span> <span class="identifier">toolset</span><span class="special">=</span><span class="identifier">gcc</span> <span class="special">--</span><span class="identifier">with</span><span class="special">-</span><span class="identifier">math</span> <span class="identifier">install</span>
</pre>
<p>
that will do the job on Linux, while:
</p>
<pre class="programlisting"><span class="identifier">bjam</span> <span class="identifier">toolset</span><span class="special">=</span><span class="identifier">msvc</span> <span class="special">--</span><span class="identifier">with</span><span class="special">-</span><span class="identifier">math</span> <span class="special">--</span><span class="identifier">build</span><span class="special">-</span><span class="identifier">type</span><span class="special">=</span><span class="identifier">complete</span> <span class="identifier">stage</span>
</pre>
<p>
will work better on Windows (leaving libraries built in sub-folder <code class="computeroutput"><span class="special">/</span><span class="identifier">stage</span></code> below
your Boost root directory). Either way you should consult the <a href="http://www.boost.org/doc/libs/release/more/getting_started/index.html" target="_top">getting
started guide</a> for more information.
</p>
<p>
You can also build the libraries from your favourite IDE or command line tool:
each <code class="computeroutput"><span class="keyword">extern</span> <span class="string">"C"</span></code>
function declared in <code class="computeroutput"><span class="special">&lt;</span><span class="identifier">boost</span><span class="special">/</span><span class="identifier">math</span><span class="special">/</span><span class="identifier">tr1</span><span class="special">.</span><span class="identifier">hpp</span><span class="special">&gt;</span></code> has its own source file with the same name
in <code class="computeroutput"><span class="identifier">libs</span><span class="special">/</span><span class="identifier">math</span><span class="special">/</span><span class="identifier">src</span><span class="special">/</span><span class="identifier">tr1</span></code>. Just
select the sources corresponding to the functions you are using and build them
into a library, or else add them directly to your project. Note that the directory
<code class="computeroutput"><span class="identifier">libs</span><span class="special">/</span><span class="identifier">math</span><span class="special">/</span><span class="identifier">src</span><span class="special">/</span><span class="identifier">tr1</span></code> will
need to be in your compiler's #include path as well as the boost-root directory
(MSVC Tools, Options, Projects and Solutions, VC++ Directories, Include files).
</p>
<div class="note"><table border="0" summary="Note">
<tr>
<td rowspan="2" align="center" valign="top" width="25"><img alt="[Note]" src="../../../../../doc/src/images/note.png"></td>
<th align="left">Note</th>
</tr>
<tr><td align="left" valign="top"><p>
If you are using a Windows compiler that supports auto-linking and you have
built the sources yourself (or added them directly to your project) then
you will need to prevent <code class="computeroutput"><span class="special">&lt;</span><span class="identifier">boost</span><span class="special">/</span><span class="identifier">math</span><span class="special">/</span><span class="identifier">tr1</span><span class="special">.</span><span class="identifier">hpp</span><span class="special">&gt;</span></code>
from trying to auto-link to the binaries that Boost.Build generates. You
can do this by defining either BOOST_MATH_NO_LIB or BOOST_ALL_NO_LIB at project
level (so the defines get passed to each compiler invocation).
</p></td></tr>
</table></div>
<p>
Optionally the sources in <code class="computeroutput"><span class="identifier">libs</span><span class="special">/</span><span class="identifier">math</span><span class="special">/</span><span class="identifier">src</span><span class="special">/</span><span class="identifier">tr1</span></code>
have support for using <code class="computeroutput"><span class="identifier">libs</span><span class="special">/</span><span class="identifier">math</span><span class="special">/</span><span class="identifier">src</span><span class="special">/</span><span class="identifier">tr1</span><span class="special">/</span><span class="identifier">pch</span><span class="special">.</span><span class="identifier">hpp</span></code> as a precompiled header <span class="emphasis"><em>if
your compiler supports precompiled headers.</em></span> Note that normally this
header is a do-nothing include: to activate the header so that it #includes
everything required by all the sources you will need to define BOOST_BUILD_PCH_ENABLED
on the command line, both when building the pre-compiled header and when building
the sources. Boost.Build will do this automatically when appropriate.
</p>
<h5>
<a name="math_toolkit.building.h1"></a>
<span class="phrase"><a name="math_toolkit.building.building_the_examples"></a></span><a class="link" href="building.html#math_toolkit.building.building_the_examples">Building
the Examples</a>
</h5>
<p>
The examples are all located in <code class="computeroutput"><span class="identifier">libs</span><span class="special">/</span><span class="identifier">math</span><span class="special">/</span><span class="identifier">example</span></code>, they can all be built without reference
to any external libraries, either with Boost.Build using the supplied Jamfile,
or from your compiler's command line. The only requirement is that the Boost
headers are in your compilers #include search path.
</p>
<h5>
<a name="math_toolkit.building.h2"></a>
<span class="phrase"><a name="math_toolkit.building.building_the_tests"></a></span><a class="link" href="building.html#math_toolkit.building.building_the_tests">Building
the Tests</a>
</h5>
<p>
The tests are located in <code class="computeroutput"><span class="identifier">libs</span><span class="special">/</span><span class="identifier">math</span><span class="special">/</span><span class="identifier">test</span></code> and are best built using Boost.Build
and the supplied Jamfile. If you plan to build them separately from your favourite
IDE then you will need to add <code class="computeroutput"><span class="identifier">libs</span><span class="special">/</span><span class="identifier">math</span><span class="special">/</span><span class="identifier">test</span></code> to the list of your compiler's search
paths.
</p>
<p>
You will also need to build and link to the Boost.Regex library for many of
the tests: this can built from the command line by following the <a href="http://www.boost.org/doc/libs/release/more/getting_started/index.html" target="_top">getting
started guide</a>, using a command such as:
</p>
<pre class="programlisting"><span class="identifier">bjam</span> <span class="identifier">toolset</span><span class="special">=</span><span class="identifier">gcc</span> <span class="special">--</span><span class="identifier">with</span><span class="special">-</span><span class="identifier">regex</span> <span class="identifier">install</span>
</pre>
<p>
or
</p>
<pre class="programlisting"><span class="identifier">bjam</span> <span class="identifier">toolset</span><span class="special">=</span><span class="identifier">msvc</span> <span class="special">--</span><span class="identifier">with</span><span class="special">-</span><span class="identifier">regex</span> <span class="special">--</span><span class="identifier">build</span><span class="special">-</span><span class="identifier">type</span><span class="special">=</span><span class="identifier">complete</span> <span class="identifier">stage</span>
</pre>
<p>
depending on whether you are on Linux or Windows.
</p>
<p>
Many of the tests have optional precompiled header support using the header
<code class="computeroutput"><span class="identifier">libs</span><span class="special">/</span><span class="identifier">math</span><span class="special">/</span><span class="identifier">test</span><span class="special">/</span><span class="identifier">pch</span><span class="special">.</span><span class="identifier">hpp</span></code>. Note that normally this header is a
do-nothing include: to activate the header so that it #includes everything
required by all the sources you will need to define BOOST_BUILD_PCH_ENABLED
on the command line, both when building the pre-compiled header and when building
the sources. Boost.Build will do this automatically when appropriate.
</p>
</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-2010, 2012-2014 Nikhar Agrawal,
Anton Bikineev, Paul A. Bristow, Marco Guazzone, Christopher Kormanyos, Hubert
Holin, Bruno Lalande, John Maddock, Jeremy Murphy, Johan R&#229;de, Gautam Sewani,
Benjamin Sobotta, Thijs van den Berg, Daryle Walker and Xiaogang Zhang<p>
Distributed under the Boost Software License, Version 1.0. (See accompanying
file LICENSE_1_0.txt 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="perf_over1.html"><img src="../../../../../doc/src/images/prev.png" alt="Prev"></a><a accesskey="u" href="../overview.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><a accesskey="n" href="history1.html"><img src="../../../../../doc/src/images/next.png" alt="Next"></a>
</div>
</body>
</html>