bjam是boost的编译工具,类似于gnu make,但是据说比make脚本功能强大很多,最方便的是支持vstudio。
要使用boost必须学会使用bjam,下面把在windows下配置bjam的步骤记录如下:
1.下载安装boost包。
最方便的方法是从http://www.boostpro.com/products/free 下载安装包,通过 这个安装工具来安装编译好的boost。好像需要手工设置boost_root变量。
2.安装好后,在安装目录下会有bin目录,里面有bjam.exe
3.把这个bin目录加入path,在命令行下敲bjam应该有反应了。
4.接下来配置boost.build。这个工具包实际上是真正干活的,利用bjam做事。没有他,bjam什么也干不了。boost.build 缺省安装在%boost_root%/tools/build/v2。
可调的配置基本在user-config.jam中,详细地参看boost.build的文档,这里贴一个例子。
# Copyright 2003, 2005 Douglas Gregor
# Copyright 2004 John Maddock
# Copyright 2002, 2003, 2004, 2007 Vladimir Prus
# 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 )
# This file is used to configure your Boost.Build installation.
# You can modify this file in place, or you can place it it
# permanent location so that it’s not overwritten should you
# get new version of Boost.Build. See:
#
# http://boost.org/boost-build2/doc/html/bbv2/reference.html#bbv2.reference.init
#
# for documentation about permanent location.
# This file specifies which toolsets (C++ compilers), libraries,
# and other tools are available. Often, you should be able to
# just uncomment existing example lines and adjust them to taste.
# The complete list of supported tools, and configuration instructions
# can be found at:
#
# http://boost.org/boost-build2/doc/html/bbv2/reference/tools.html
#
# This file uses Jam language syntax to describe available tools.
# Mostly, there are ‘using’ lines, that contain the name of the used
# tools, and parameters to pass to those tools — where paremeters
# are separated by semicolons.
# Important syntax notes:
#
# – Both ‘:’ and ‘;’ must be separated from other tokens by whitespace
# – The ‘/’ symbol is quote character, so when specifying Windows paths
# it’s recommended to use ‘/’ instead, or use ‘//’.
#
# More details about syntax can be found at:
#
# http://boost.org/boost-build2/doc/html/bbv2/advanced.html#bbv2.advanced.jam_language
#
# GCC configuration
# Configure gcc (default version)
# using gcc ;
# Configure specific gcc version, giving alternative name to use
# using gcc : 3.2 : g++-3.2 ;
# MSVC configuration
# Configure msvc (default version, searched in standard location
# and PATH).
using msvc ;
# Borland configuration
# using borland ;
# STLPort configuration
# Configure, specifying location of STLPort headers.
# Libraries must be either not needed, or available to
# the compiler by default
# using stlport : : /usr/include/stlport ;
# Configure, specifying locatioh of both headers and libraries
# using stlport : : /usr/include/stlport /usr/lib ;
# QT configuration
# Configure, assuming QTDIR gives the installation prefix
# using qt ;
# Configure with explicit installation prefix
# using qt : /usr/opt/qt ;
using xsltproc ;
using boostbook
: “D:/Program Files/boost/boost_1_35_0/tools/boostbook/xsl”
: “D:/Program Files/boost/boost_1_35_0/tools/boostbook/dtd”
;
using doxygen ;
5.最后要做的是告诉bjam,where is boost.build。有两种方法:
(1)配置环境变量,但是这种方法有时候不管用
(2)在源文件的根目录建立一个boost-build.jam文件,在里面增加一行:
boost-build “D:/Program Files/boost/boost_1_35_0/tools/build/v2″ ; #后面是boost.build的路径。
在自己的工程根目录下创建 boost-build.jam 并添加以上内容, 上述路径要修改为自己本机实际路径。