| <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="../../../../../../../doc/src/boostbook.css" type="text/css"> |
| <meta name="generator" content="DocBook XSL Stylesheets V1.74.0"> |
| <link rel="home" href="../../index.html" title="Math Toolkit"> |
| <link rel="up" href="../main_overview.html" title="Overview"> |
| <link rel="prev" href="perf_over.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_over.html"><img src="../../../../../../../doc/src/images/prev.png" alt="Prev"></a><a accesskey="u" href="../main_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" lang="en"> |
| <div class="titlepage"><div><div><h3 class="title"> |
| <a name="math_toolkit.main_overview.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> |
| </h3></div></div></div> |
| <a name="math_toolkit.main_overview.building.building_a_library__shared__dynamic__dll_or_static__lib_"></a><h5> |
| <a name="id910772"></a> |
| <a class="link" href="building.html#math_toolkit.main_overview.building.building_a_library__shared__dynamic__dll_or_static__lib_">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='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"><</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">></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"><</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">></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"><</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">></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> |
| <a name="math_toolkit.main_overview.building.building_the_examples"></a><h5> |
| <a name="id911223"></a> |
| <a class="link" href="building.html#math_toolkit.main_overview.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> |
| <a name="math_toolkit.main_overview.building.building_the_tests"></a><h5> |
| <a name="id911263"></a> |
| <a class="link" href="building.html#math_toolkit.main_overview.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 © 2006 , 2007, 2008, 2009, 2010 John Maddock, Paul A. Bristow, |
| Hubert Holin, Xiaogang Zhang, Bruno Lalande, Johan Råde, Gautam Sewani and |
| Thijs van den Berg<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_over.html"><img src="../../../../../../../doc/src/images/prev.png" alt="Prev"></a><a accesskey="u" href="../main_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> |