building.qbk 4.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108
  1. [section:building If and How to Build a Boost.Math Library, and its Examples and Tests]
  2. [h4 Building a Library (shared, dynamic .dll or static .lib)]
  3. The first thing you need to ask yourself is "Do I need to build anything at all?"
  4. as the bulk of this library is header only: meaning you can use it just by
  5. #including the necessary header(s).
  6. For most simple uses,
  7. including a header (or few) is best for compile time and program size.
  8. Refer to
  9. [link extern_c C99 and C++ TR1 C-style Functions]
  10. for pros and cons of using
  11. the TR1 components as opposed to the header only ones.
  12. The ['only] time you ['need] to build the library is if you want to use the
  13. `extern "C"` functions declared in `<boost/math/tr1.hpp>`. To build this
  14. using Boost.Build, from a command-line boost-root directory issue a command like:
  15. bjam toolset=gcc --with-math install
  16. that will do the job on Linux, while:
  17. bjam toolset=msvc --with-math --build-type=complete stage
  18. will work better on Windows (leaving libraries built
  19. in sub-folder `/stage` below your Boost root directory).
  20. Either way you should consult the
  21. [@http://www.boost.org/doc/libs/release/more/getting_started/index.html
  22. getting started guide] for more information.
  23. You can also build the libraries from your favourite IDE or command line tool:
  24. each `extern "C"` function declared in `<boost/math/tr1.hpp>` has its own
  25. source file with the same name in `libs/math/src/tr1`. Just select the
  26. sources corresponding to the functions you are using and build them into
  27. a library, or else add them directly to your project. Note that the
  28. directory `libs/math/src/tr1` will need to be in your compiler's
  29. #include path as well as the boost-root directory
  30. (MSVC Tools, Options, Projects and Solutions, VC++ Directories, Include files).
  31. [note If you are using
  32. a Windows compiler that supports auto-linking and you have built the sources
  33. yourself (or added them directly to your project) then you will need to
  34. prevent `<boost/math/tr1.hpp>` from trying to auto-link to the binaries
  35. that Boost.Build generates. You can do this by defining either
  36. BOOST_MATH_NO_LIB or BOOST_ALL_NO_LIB at project level
  37. (so the defines get passed to each compiler invocation).
  38. ]
  39. Optionally the sources in `libs/math/src/tr1` have support for using
  40. `libs/math/src/tr1/pch.hpp` as a precompiled header
  41. ['if your compiler supports precompiled headers.] Note that normally
  42. this header is a do-nothing `#include` to activate the header so that
  43. it #includes everything required by all the sources you will need to
  44. define BOOST_BUILD_PCH_ENABLED on the command line, both when building
  45. the pre-compiled header and when building the sources. Boost.Build
  46. will do this automatically when appropriate.
  47. [h4 Building the Examples]
  48. The examples are all located in `libs/math/example`, they can all
  49. be built without reference to any external libraries, either with
  50. Boost.Build using the supplied Jamfile, or from your compiler's
  51. command line. The only requirement is that the Boost headers are
  52. in your compilers #include search path.
  53. [h4 Building the Tests]
  54. The tests are located in `libs/math/test` and are best built
  55. using Boost.Build and the supplied Jamfile. If you plan to
  56. build them separately from your favourite IDE then you will
  57. need to add `libs/math/test` to the list of your compiler's
  58. search paths.
  59. You will also need to build and link to
  60. the Boost.Regex library for many of the tests: this can built
  61. from the command line by following the
  62. [@http://www.boost.org/doc/libs/release/more/getting_started/index.html
  63. getting started guide], using commands such as:
  64. bjam toolset=gcc --with-regex install
  65. or
  66. bjam toolset=clang --with-regex install
  67. or
  68. bjam toolset=gcc,clang --with-regex install
  69. or
  70. bjam toolset=msvc --with-regex --build-type=complete stage
  71. depending on whether you are on Linux or Windows.
  72. Many of the tests have optional precompiled header support
  73. using the header `libs/math/test/pch.hpp`.
  74. Note that normally this header is a do-nothing include:
  75. to activate the header so that
  76. it `#include`s everything required by all the sources you will need to
  77. define BOOST_BUILD_PCH_ENABLED on the command line, both when building
  78. the pre-compiled header and when building the sources. Boost.Build
  79. will do this automatically when appropriate.
  80. [endsect] [/section:building If and How to Build a Boost.Math Library, and its Examples and Tests]
  81. [/ building.qbk
  82. Copyright 2006, 2007, 2008, 2010 John Maddock and Paul A. Bristow.
  83. Distributed under the Boost Software License, Version 1.0.
  84. (See accompanying file LICENSE_1_0.txt or copy at
  85. http://www.boost.org/LICENSE_1_0.txt).
  86. ]