Boost C++ Libraries

...one of the most highly regarded and expertly designed C++ library projects in the world. Herb Sutter and Andrei Alexandrescu, C++ Coding Standards

This is the documentation for an old version of boost. Click here for the latest Boost documentation.

Jamfile

#~ Copyright 2003-2004, Rene Rivera.
#~ Distributed under the Boost Software License, Version 1.0.
#~ (See accompanying file LICENSE_1_0.txt or http://www.boost.org/LICENSE_1_0.txt)

if --help in $(ARGV)
{
    ECHO "
Usage:
    bjam [options] [install|stage]

    * install               Installs to the configured location(s).
    * stage                 Stages the build products only to common stage location.

Options:
    --help                  This message.
    
    -sTOOLS=<toolsets>      Indicates the tools to build with.
    
    --layout=<layout>       Determines what kind of build layout to use. This
                            allows one to control the naming of the resulting
                            libraries, and the locations of the installed
                            files. Default is 'versioned'. Possible values:
                            
                                versioned - Uses the Boost standard names
                                which include version number for Boost the
                                release and version and name of the
                                compiler as part of the library names. Also
                                installs the includes to a versioned
                                sub-directory.
                                
                                system - Builds an install without the
                                Boost standard names, and does not install
                                includes to a versioned sub-directory. This
                                is intended for system integrators to build
                                for packaging of distributions.

Locations:
    --prefix=PREFIX         Install architecture independent files here.
                            Default; C:\\Boost on Win32
                            Default; /usr/local on Unix. Linux, etc.
                            
    --exec-prefix=EPREFIX   Install architecture dependent files here.
                            Default; PREFIX
                            
    --libdir=DIR            Install libraries here.
                            Default; EPREFIX/lib
                            
    --includedir=DIR        Install source headers here.
                            Default; PREFIX/include
                            
    --builddir=DIR          Build in this location instead of building
                            within the distribution tree. Recomended!
                            
    --stagedir=DIR          When staging only, stage to the location.
                            Default; ./stage

Features:
    --with-<library>        Build, stage, or install the specified <library>
                            If used, teh default becomes to only build
                            indicated libraries.
                            
    --without-<library>     Do not build, stage, or install the specified
                            <library>. By default all libraries attempt to build.
                            
    --with-python-root[=PYTHON_ROOT]
                            Build Boost.Python libraries with the Python
                            devel packages located at PYTHON_ROOT.
                            Default PYTHON_ROOT; C:\\tools\\python on Win32.
                            Default PYTHON_ROOT; /usr/local on Unix, Linux, etc.
                            Default PYTHON_ROOT; /usr on Cygwin.
                            
    --with-pydebug          Build Boost.Python libraries using the
                            Python debug runtime.
" ;
    EXIT "" ;
}

local with-install = ;
local with-stage = ;

# build only, or build+install
if install in $(ARGV)
{
    with-install = install ;
    with-stage = ;
}

# stage only? (no install, only build and stage to a common dir)
if stage in $(ARGV)
{
    with-stage = stage ;
    with-install = ;
}

# what kind of layout are we doing?
local layout = [ MATCH "^--layout=(.*)" : $(ARGV) ] ;
layout ?= versioned ;
layout-$(layout) = true ;

# possible stage only location
local stage-locate = [ MATCH "^--stagedir=(.*)" : $(ARGV) ] ;
stage-locate ?= stage ;

# architecture independent files
local boost-locate = [ unless $(with-stage) : [ MATCH "^--prefix=(.*)" : $(ARGV) ] : $(stage-locate) ] ;
if $(NT) { boost-locate ?= C:\\Boost ; }
else if $(UNIX) { boost-locate ?= /usr/local ; }

# architecture dependent files
local exec-locate = [ MATCH "^--exec-prefix=(.*)" : $(ARGV) ] ;
exec-locate ?= $(boost-locate) ;

# object code libraries
local lib-locate = [ MATCH "^--libdir=(.*)" : $(ARGV) ] ;
lib-locate ?= $(exec-locate)/lib ;

# where to build
local all-locate = [ MATCH "^--builddir=(.*)" : $(ARGV) ] ;
ALL_LOCATE_TARGET ?= $(all-locate) ;

# source header files
local include-locate = [ MATCH "^--includedir=(.*)" : $(ARGV) ] ;
include-locate ?= $(boost-locate)/include ;

# location of python
local python-root = [ MATCH "^--with-python-root=(.*)" : $(ARGV) ] ;
PYTHON_ROOT ?= $(python-root) ;

# variant for pydebug build
local with-debug-python ;
if --with-pydebug in $(ARGV)
{
    with-debug-python = debug-python ;
}

# libraries to disable building, etc.
local without-libraries = [ MATCH "^--without-(.*)" : $(ARGV) ] ;

# libraries to enable
local with-libraries ;
for local arg in $(ARGV)
{
    switch $(arg)
    {
        case --with-python-root=* : local _ ;
        case --with-pydebug : local _ ;
        
        case --with-* :
        with-libraries += [ MATCH "^--with-(.*)" : $(arg) ] ;
    }
}

#
project-root ;

# bring in the rules for python
import python ;

#
local version-tag = [ MATCH "^([^.]+).([^.]+)" : $(BOOST_VERSION) ] ;
version-tag = $(version-tag:J="_") ;

#
install-subinclude
    [ MATCH ^(.*build[/\\:]$(JAMFILE))$ : [ glob-tree $(BOOST_ROOT)/libs : $(JAMFILE) ] ]
    : <exclude>$(without-libraries) <include>$(with-libraries) ;

local lib-sources = [ install-sources lib ] ;

if $(lib-sources)
{
    local gNOWARN_INCOMPATIBLE_BUILDS = TRUE ;
    local gUNVERSIONED_VARIANT_TAG = [ cond $(layout-system) : TRUE ] ;
    
    local lib-build =
        debug release
        [ cond $(with-debug-python) : debug-python ]
        [ cond $(NT) : <runtime-link>static/dynamic ]
        <threading>single/multi
        ;
    local lib-target =
        [ cond $(with-install) : install : all ]
        [ cond $(with-stage) : stage : all ]
        ;
    local lib-dest-files = [
        stage $(lib-locate:D=)
            :
                $(lib-sources)
            :
                <locate>$(lib-locate:D)
                common-variant-tag
                <target>$(lib-target)
            :
                $(lib-build)
                [ unless $(with-install) $(with-stage) : <suppress>true ]
        ] ;
    if ! $(gIN_LIB_INCLUDE) && $(layout-versioned)
    {
        local unversioned-files ;
        if $(with-install) || $(with-stage)
        {
            if $(NT)
            {
                local version-files = [ MATCH "(.*[.]lib)" : $(lib-dest-files) ] ;
                local noversion-files ;
                for local version-file in $(version-files)
                {
                    local noversion-file =
                        [ MATCH "(.*)-[0-9_]+([.]lib)" : $(version-file) ] ;
                    noversion-file = $(noversion-file[1])$(noversion-file[2]) ;
                    MakeLocate $(noversion-file) : [ FDirName [ split-path $(lib-locate) ] ] ;
                    HardLink $(noversion-file) : $(version-file) ;
                    noversion-files += $(noversion-file) ;
                }
                declare-fake-targets $(lib-target) : $(noversion-files) ;
            }
            else if $(UNIX)
            {
                local so-version-files = [ MATCH "(.*[.]so[.0-9]+)" : $(lib-dest-files) ] ;
                so-version-files ?= [ MATCH "(.*[.]so)" : $(lib-dest-files) ] ;
                local version-files = $(so-version-files) [ MATCH "(.*[.]a)" : $(lib-dest-files) ] ;
                local noversion-files ;
                for local version-file in $(version-files)
                {
                    local noversion-file =
                        [ MATCH "(.*)-[0-9_]+([.]so)[.0-9]*" : $(version-file) ]
                        [ MATCH "(.*)-[0-9_]+([.]a)" : $(version-file) ] ;
                    noversion-file = $(noversion-file[1])$(noversion-file[2]) ;
                    MakeLocate $(noversion-file) : [ FDirName [ split-path $(lib-locate) ] ] ;
                    HardLink $(noversion-file) : $(version-file) ;
                    noversion-files += $(noversion-file) ;
                }
                declare-fake-targets $(lib-target) : $(noversion-files) ;
            }
        }
    }
}

stage [ cond $(layout-versioned) : $(include-locate:D=)/boost-$(version-tag) : $(include-locate:D=) ]
    :
        [ glob-tree $(BOOST_ROOT)/boost/compatibility/cpp_c_headers : c* ]
        [ glob-tree $(BOOST_ROOT)/boost : *.hpp *.ipp *.h *.inc ]
    :
        <locate>$(include-locate:D)
        <tree-subdirs>$(BOOST_ROOT)
        [ cond $(with-install) : <target>install : <target>all ]
    :
        [ unless $(with-install) : <suppress>true ]
    ;