]>
Commit | Line | Data |
---|---|---|
7c673cae FG |
1 | <html> |
2 | <head> | |
3 | <meta http-equiv="Content-Type" content="text/html; charset=US-ASCII"> | |
4 | <title>If and How to Build a Boost.Math Library, and its Examples and Tests</title> | |
5 | <link rel="stylesheet" href="../math.css" type="text/css"> | |
6 | <meta name="generator" content="DocBook XSL Stylesheets V1.77.1"> | |
7 | <link rel="home" href="../index.html" title="Math Toolkit 2.5.1"> | |
8 | <link rel="up" href="../overview.html" title="Chapter 1. Overview"> | |
9 | <link rel="prev" href="perf_over1.html" title="Performance"> | |
10 | <link rel="next" href="history1.html" title="History and What's New"> | |
11 | </head> | |
12 | <body bgcolor="white" text="black" link="#0000FF" vlink="#840084" alink="#0000FF"> | |
13 | <table cellpadding="2" width="100%"><tr> | |
14 | <td valign="top"><img alt="Boost C++ Libraries" width="277" height="86" src="../../../../../boost.png"></td> | |
15 | <td align="center"><a href="../../../../../index.html">Home</a></td> | |
16 | <td align="center"><a href="../../../../../libs/libraries.htm">Libraries</a></td> | |
17 | <td align="center"><a href="http://www.boost.org/users/people.html">People</a></td> | |
18 | <td align="center"><a href="http://www.boost.org/users/faq.html">FAQ</a></td> | |
19 | <td align="center"><a href="../../../../../more/index.htm">More</a></td> | |
20 | </tr></table> | |
21 | <hr> | |
22 | <div class="spirit-nav"> | |
23 | <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> | |
24 | </div> | |
25 | <div class="section"> | |
26 | <div class="titlepage"><div><div><h2 class="title" style="clear: both"> | |
27 | <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 | |
28 | Library, and its Examples and Tests</a> | |
29 | </h2></div></div></div> | |
30 | <h5> | |
31 | <a name="math_toolkit.building.h0"></a> | |
32 | <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 | |
33 | Library (shared, dynamic .dll or static .lib)</a> | |
34 | </h5> | |
35 | <p> | |
36 | The first thing you need to ask yourself is "Do I need to build anything | |
37 | at all?" as the bulk of this library is header only: meaning you can use | |
38 | it just by #including the necessary header(s). | |
39 | </p> | |
40 | <p> | |
41 | For most simple uses, including a header (or few) is best for compile time | |
42 | and program size. | |
43 | </p> | |
44 | <p> | |
45 | Refer to <a class="link" href="../extern_c.html" title='Chapter 7. TR1 and C99 external "C" Functions'>C99 and C++ TR1 C-style Functions</a> | |
46 | for pros and cons of using the TR1 components as opposed to the header only | |
47 | ones. | |
48 | </p> | |
49 | <p> | |
50 | The <span class="emphasis"><em>only</em></span> time you <span class="emphasis"><em>need</em></span> to build the | |
51 | library is if you want to use the <code class="computeroutput"><span class="keyword">extern</span> | |
52 | <span class="string">"C"</span></code> functions declared in | |
53 | <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 | |
54 | a commandline boost-root directory issue a command like: | |
55 | </p> | |
56 | <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> | |
57 | </pre> | |
58 | <p> | |
59 | that will do the job on Linux, while: | |
60 | </p> | |
61 | <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> | |
62 | </pre> | |
63 | <p> | |
64 | 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 | |
65 | 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 | |
66 | started guide</a> for more information. | |
67 | </p> | |
68 | <p> | |
69 | You can also build the libraries from your favourite IDE or command line tool: | |
70 | each <code class="computeroutput"><span class="keyword">extern</span> <span class="string">"C"</span></code> | |
71 | 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 | |
72 | 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 | |
73 | select the sources corresponding to the functions you are using and build them | |
74 | into a library, or else add them directly to your project. Note that the directory | |
75 | <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 | |
76 | need to be in your compiler's #include path as well as the boost-root directory | |
77 | (MSVC Tools, Options, Projects and Solutions, VC++ Directories, Include files). | |
78 | </p> | |
79 | <div class="note"><table border="0" summary="Note"> | |
80 | <tr> | |
81 | <td rowspan="2" align="center" valign="top" width="25"><img alt="[Note]" src="../../../../../doc/src/images/note.png"></td> | |
82 | <th align="left">Note</th> | |
83 | </tr> | |
84 | <tr><td align="left" valign="top"><p> | |
85 | If you are using a Windows compiler that supports auto-linking and you have | |
86 | built the sources yourself (or added them directly to your project) then | |
87 | 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> | |
88 | from trying to auto-link to the binaries that Boost.Build generates. You | |
89 | can do this by defining either BOOST_MATH_NO_LIB or BOOST_ALL_NO_LIB at project | |
90 | level (so the defines get passed to each compiler invocation). | |
91 | </p></td></tr> | |
92 | </table></div> | |
93 | <p> | |
94 | 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> | |
95 | 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 | |
96 | your compiler supports precompiled headers.</em></span> Note that normally this | |
97 | header is a do-nothing include: to activate the header so that it #includes | |
98 | everything required by all the sources you will need to define BOOST_BUILD_PCH_ENABLED | |
99 | on the command line, both when building the pre-compiled header and when building | |
100 | the sources. Boost.Build will do this automatically when appropriate. | |
101 | </p> | |
102 | <h5> | |
103 | <a name="math_toolkit.building.h1"></a> | |
104 | <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 | |
105 | the Examples</a> | |
106 | </h5> | |
107 | <p> | |
108 | 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 | |
109 | to any external libraries, either with Boost.Build using the supplied Jamfile, | |
110 | or from your compiler's command line. The only requirement is that the Boost | |
111 | headers are in your compilers #include search path. | |
112 | </p> | |
113 | <h5> | |
114 | <a name="math_toolkit.building.h2"></a> | |
115 | <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 | |
116 | the Tests</a> | |
117 | </h5> | |
118 | <p> | |
119 | 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 | |
120 | and the supplied Jamfile. If you plan to build them separately from your favourite | |
121 | 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 | |
122 | paths. | |
123 | </p> | |
124 | <p> | |
125 | You will also need to build and link to the Boost.Regex library for many of | |
126 | 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 | |
127 | started guide</a>, using a command such as: | |
128 | </p> | |
129 | <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> | |
130 | </pre> | |
131 | <p> | |
132 | or | |
133 | </p> | |
134 | <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> | |
135 | </pre> | |
136 | <p> | |
137 | depending on whether you are on Linux or Windows. | |
138 | </p> | |
139 | <p> | |
140 | Many of the tests have optional precompiled header support using the header | |
141 | <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 | |
142 | do-nothing include: to activate the header so that it #includes everything | |
143 | required by all the sources you will need to define BOOST_BUILD_PCH_ENABLED | |
144 | on the command line, both when building the pre-compiled header and when building | |
145 | the sources. Boost.Build will do this automatically when appropriate. | |
146 | </p> | |
147 | </div> | |
148 | <table xmlns:rev="http://www.cs.rpi.edu/~gregod/boost/tools/doc/revision" width="100%"><tr> | |
149 | <td align="left"></td> | |
150 | <td align="right"><div class="copyright-footer">Copyright © 2006-2010, 2012-2014 Nikhar Agrawal, | |
151 | Anton Bikineev, Paul A. Bristow, Marco Guazzone, Christopher Kormanyos, Hubert | |
152 | Holin, Bruno Lalande, John Maddock, Jeremy Murphy, Johan Råde, Gautam Sewani, | |
153 | Benjamin Sobotta, Thijs van den Berg, Daryle Walker and Xiaogang Zhang<p> | |
154 | Distributed under the Boost Software License, Version 1.0. (See accompanying | |
155 | 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>) | |
156 | </p> | |
157 | </div></td> | |
158 | </tr></table> | |
159 | <hr> | |
160 | <div class="spirit-nav"> | |
161 | <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> | |
162 | </div> | |
163 | </body> | |
164 | </html> |