Home > The Unit Test Framework > Compilation > Standalone library compilation
PrevNext

Standalone library compilation

If you opted to link your program with the standalone library, you need to build it first. To build a standalone library the all C++ files (.cpp), that constitute UTF implementation need to be listed as source files in your makefile[3].

The Jamfile for use with Boost.Build system is supplied in libs/test/build directory. The UTF can be built as either static or dynamic library.

Static library compilation

No special build options or macro definitions are required to build the static library. Using the Boost.Build system you can build the static library with the following command from libs/test/build directory:

bjam [-sTOOLS=<your-tool-name>] {-sBUILD=boost_unit_test_framework}

Also on Windows you can use the Microsoft Visual Studio .NET project file provided.

Dynamic library compilation

To build the dynamic library[4] you need to add BOOST_TEST_DYN_LINK to the list of macro definitions in the makefile. Using the Boost.Build system you can build the dynamic library with the following command from libs/test/build directory:

bjam [-sTOOLS=<your-tool-name>] {-sBUILD=boost_unit_test_framework}

Also on Windows you can use the Microsoft Visual Studio .NET project file provided.

[Important] Important

For test module to successfully link with the dynamic library the flag BOOST_TEST_DYN_LINK needs to be defined both during dynamic library build and during test module compilation.



[3] There are varieties of make systems that can be used. To name a few: GNU make (and other make clones) and build systems integrated into IDEs (for example Microsoft Visual Studio). The Boost preferred solution is Boost.Build system that is based on top of bjam tool. Make systems require some kind of configuration file that lists all files that constitute the library and all build options. For example the makefile that is used by make, or the Microsoft Visual Studio project file, Jamfile is used by Boost.Build. For the sake of simplicity let's call this file the makefile.

[4] What is meant by the term dynamic library is a dynamically loaded library, alternatively called a shared library.


PrevUpHomeNext