[12] | 1 | <?xml version="1.0" encoding="utf-8" ?> |
---|
| 2 | <!DOCTYPE library PUBLIC "-//Boost//DTD BoostBook XML V1.0//EN" |
---|
| 3 | "http://www.boost.org/tools/boostbook/dtd/boostbook.dtd" [ |
---|
| 4 | <!ENTITY % threads.entities SYSTEM "entities.xml"> |
---|
| 5 | %threads.entities; |
---|
| 6 | ]> |
---|
| 7 | <section id="thread.build" last-revision="$Date: 2004/07/17 04:33:59 $"> |
---|
| 8 | <title>Build</title> |
---|
| 9 | <para> |
---|
| 10 | How you build the &Boost.Threads; libraries, and how you build your own applications |
---|
| 11 | that use those libraries, are some of the most frequently asked questions. Build |
---|
| 12 | processes are difficult to deal with in a portable manner. That's one reason |
---|
| 13 | why &Boost.Threads; makes use of &Boost.Build;. |
---|
| 14 | In general you should refer to the documentation for &Boost.Build;. |
---|
| 15 | This document will only supply you with some simple usage examples for how to |
---|
| 16 | use <emphasis>bjam</emphasis> to build and test &Boost.Threads;. In addition, this document |
---|
| 17 | will try to explain the build requirements so that users may create their own |
---|
| 18 | build processes (for instance, create an IDE specific project), both for building |
---|
| 19 | and testing &Boost.Threads;, as well as for building their own projects using |
---|
| 20 | &Boost.Threads;. |
---|
| 21 | </para> |
---|
| 22 | <section id="thread.build.building"> |
---|
| 23 | <title>Building the &Boost.Threads; Libraries</title> |
---|
| 24 | <para> |
---|
| 25 | To build the &Boost.Threads; libraries using &Boost.Build;, simply change to the |
---|
| 26 | directory <emphasis>boost_root</emphasis>/libs/thread/build and execute the command: |
---|
| 27 | <programlisting>bjam -sTOOLS=<emphasis>toolset</emphasis></programlisting> |
---|
| 28 | This will create the debug and the release builds of the &Boost.Threads; library. |
---|
| 29 | <note>Invoking the above command in <emphasis>boost_root</emphasis> will build all of |
---|
| 30 | the Boost distribution, including &Boost.Threads;.</note> |
---|
| 31 | </para> |
---|
| 32 | <para> |
---|
| 33 | The Jamfile supplied with &Boost.Threads; produces a dynamic link library named |
---|
| 34 | <emphasis>boost_thread{build-specific-tags}.{extension}</emphasis>, where the build-specific |
---|
| 35 | tags indicate the toolset used to build the library, whether it's a debug or release |
---|
| 36 | build, what version of Boost was used, etc.; and the extension is the appropriate extension |
---|
| 37 | for a dynamic link library for the platform for which &Boost.Threads; is being built. |
---|
| 38 | For instance, a debug library built for Win32 with VC++ 7.1 using Boost 1.31 would |
---|
| 39 | be named <emphasis>boost_thread-vc71-mt-gd-1_31.dll</emphasis>. |
---|
| 40 | </para> |
---|
| 41 | <para> |
---|
| 42 | The source files that are used to create the &Boost.Threads; library |
---|
| 43 | are all of the *.cpp files found in <emphasis>boost_root</emphasis>/libs/thread/src. |
---|
| 44 | These need to be built with the compiler's and linker's multi-threading support enabled. |
---|
| 45 | If you want to create your own build solution you'll have to follow these same |
---|
| 46 | guidelines. One of the most frequently reported problems when trying to do this |
---|
| 47 | occurs from not enabling the compiler's and linker's support for multi-threading. |
---|
| 48 | </para> |
---|
| 49 | </section> |
---|
| 50 | <section id="thread.build.testing"> |
---|
| 51 | <title>Testing the &Boost.Threads; Libraries</title> |
---|
| 52 | <para> |
---|
| 53 | To test the &Boost.Threads; libraries using &Boost.Build;, simply change to the |
---|
| 54 | directory <emphasis>boost_root</emphasis>/libs/thread/test and execute the command: |
---|
| 55 | <programlisting>bjam -sTOOLS=<emphasis>toolset</emphasis> test</programlisting> |
---|
| 56 | </para> |
---|
| 57 | </section> |
---|
| 58 | </section> |
---|