1 # Copyright Vladimir Prus 2002-2006.
2 # Copyright Dave Abrahams 2005-2006.
3 # Copyright Rene Rivera 2005-2007.
4 # Copyright Douglas Gregor 2005.
6 # Distributed under the Boost Software License, Version 1.0.
7 # (See accompanying file LICENSE_1_0.txt or copy at
8 # http://www.boost.org/LICENSE_1_0.txt)
12 # b2 [options] [properties] [install|stage]
14 # Builds and installs Boost.
16 # Targets and Related Options:
18 # install Install headers and compiled library files to the
19 # ======= configured locations (below).
21 # --prefix=<PREFIX> Install architecture independent files here.
22 # Default; C:\Boost on Win32
23 # Default; /usr/local on Unix. Linux, etc.
25 # --exec-prefix=<EPREFIX> Install architecture dependent files here.
28 # --libdir=<DIR> Install library files here.
29 # Default; <EPREFIX>/lib
31 # --includedir=<HDRDIR> Install header files here.
32 # Default; <PREFIX>/include
34 # stage Build and install only compiled library files to the
35 # ===== stage directory.
37 # --stagedir=<STAGEDIR> Install library files here
42 # --build-type=<type> Build the specified pre-defined set of variations of
43 # the libraries. Note, that which variants get built
44 # depends on what each library supports.
46 # -- minimal -- (default) Builds a minimal set of
47 # variants. On Windows, these are static
48 # multithreaded libraries in debug and release
49 # modes, using shared runtime. On Linux, these are
50 # static and shared multithreaded libraries in
53 # -- complete -- Build all possible variations.
55 # --build-dir=DIR Build in this location instead of building within
56 # the distribution tree. Recommended!
58 # --show-libraries Display the list of Boost libraries that require
59 # build and installation steps, and then exit.
61 # --layout=<layout> Determine whether to choose library names and header
62 # locations such that multiple versions of Boost or
63 # multiple compilers can be used on the same system.
65 # -- versioned -- Names of boost binaries include
66 # the Boost version number, name and version of
67 # the compiler and encoded build properties. Boost
68 # headers are installed in a subdirectory of
69 # <HDRDIR> whose name contains the Boost version
72 # -- tagged -- Names of boost binaries include the
73 # encoded build properties such as variant and
74 # threading, but do not including compiler name
75 # and version, or Boost version. This option is
76 # useful if you build several variants of Boost,
77 # using the same compiler.
79 # -- system -- Binaries names do not include the
80 # Boost version number or the name and version
81 # number of the compiler. Boost headers are
82 # installed directly into <HDRDIR>. This option is
83 # intended for system integrators building
84 # distribution packages.
86 # The default value is 'versioned' on Windows, and
89 # --buildid=ID Add the specified ID to the name of built libraries.
90 # The default is to not add anything.
92 # --python-buildid=ID Add the specified ID to the name of built libraries
93 # that depend on Python. The default is to not add
94 # anything. This ID is added in addition to --buildid.
96 # --help This message.
98 # --with-<library> Build and install the specified <library>. If this
99 # option is used, only libraries specified using this
100 # option will be built.
102 # --without-<library> Do not build, stage, or install the specified
103 # <library>. By default, all libraries are built.
107 # toolset=toolset Indicate the toolset to build with.
109 # variant=debug|release Select the build variant
111 # link=static|shared Whether to build static or shared libraries
113 # threading=single|multi Whether to build single or multithreaded binaries
115 # runtime-link=static|shared
116 # Whether to link to static or shared C and C++
121 # - handle boost version
122 # - handle python options such as pydebug
133 path-constant BOOST_ROOT : . ;
134 constant BOOST_VERSION : 1.63.0 ;
135 constant BOOST_JAMROOT_MODULE : $(__name__) ;
137 boostcpp.set-version $(BOOST_VERSION) ;
139 use-project /boost/architecture : libs/config/checks/architecture ;
142 [ MATCH .*libs/(.*)/include/boost : [ glob libs/*/include/boost libs/*/*/include/boost ] ] ;
144 for dir in $(all-headers)
146 link-directory $(dir)-headers : libs/$(dir)/include/boost : <location>. ;
147 explicit $(dir)-headers ;
152 constant BOOST_MODULARLAYOUT : $(all-headers) ;
156 : requirements <include>.
158 [ boostcpp.architecture ]
159 [ boostcpp.address-model ]
161 # Disable auto-linking for all targets here, primarily because it caused
163 <define>BOOST_ALL_NO_LIB=1
164 # Used to encode variant in target name. See the 'tag' rule below.
165 <tag>@$(__name__).tag
166 <conditional>@handle-static-runtime
167 # Comeau does not support shared lib
168 <toolset>como:<link>static
169 <toolset>como-linux:<define>_GNU_SOURCE=1
170 # When building docs within Boost, we want the standard Boost style
171 <xsl:param>boost.defaults=Boost
172 : usage-requirements <include>.
176 # This rule is called by Boost.Build to determine the name of target. We use it
177 # to encode the build variant, compiler name and boost version in the target
180 rule tag ( name : type ? : property-set )
182 return [ boostcpp.tag $(name) : $(type) : $(property-set) ] ;
185 rule python-tag ( name : type ? : property-set )
187 return [ boostcpp.python-tag $(name) : $(type) : $(property-set) ] ;
190 rule handle-static-runtime ( properties * )
192 # Using static runtime with shared libraries is impossible on Linux, and
193 # dangerous on Windows. Therefore, we disallow it. This might be drastic,
194 # but it was disabled for a while without anybody complaining.
196 # For CW, static runtime is needed so that std::locale works.
197 if <link>shared in $(properties) && <runtime-link>static in $(properties) &&
198 ! ( <toolset>cw in $(properties) )
200 ECHO "error: link=shared together with runtime-link=static is not allowed" ;
201 ECHO "error: such property combination is either impossible " ;
202 ECHO "error: or too dangerious to be of any use" ;
207 all-libraries = [ MATCH .*libs/(.*)/build/.* : [ glob libs/*/build/Jamfile.v2 ]
208 [ glob libs/*/build/Jamfile ] ] ;
210 all-libraries = [ sequence.unique $(all-libraries) ] ;
211 # The function_types library has a Jamfile, but it's used for maintenance
212 # purposes, there's no library to build and install.
213 all-libraries = [ set.difference $(all-libraries) : function_types ] ;
215 # Setup convenient aliases for all libraries.
217 local rule explicit-alias ( id : targets + )
219 alias $(id) : $(targets) ;
223 # First, the complicated libraries: where the target name in Jamfile is
224 # different from its directory name.
225 explicit-alias prg_exec_monitor : libs/test/build//boost_prg_exec_monitor ;
226 explicit-alias test_exec_monitor : libs/test/build//boost_test_exec_monitor ;
227 explicit-alias unit_test_framework : libs/test/build//boost_unit_test_framework ;
228 explicit-alias bgl-vis : libs/graps/build//bgl-vis ;
229 explicit-alias serialization : libs/serialization/build//boost_serialization ;
230 explicit-alias wserialization : libs/serialization/build//boost_wserialization ;
231 for local l in $(all-libraries)
233 if ! $(l) in test graph serialization
235 explicit-alias $(l) : libs/$(l)/build//boost_$(l) ;
239 # Log has an additional target
240 explicit-alias log_setup : libs/log/build//boost_log_setup ;
242 alias headers : $(all-headers)-headers : : : <include>. ;
245 # Make project ids of all libraries known.
246 for local l in $(all-libraries)
248 use-project /boost/$(l) : libs/$(l)/build ;
251 if [ path.exists $(BOOST_ROOT)/tools/inspect ]
253 use-project /boost/tools/inspect : tools/inspect/build ;
256 if [ path.exists $(BOOST_ROOT)/libs/wave/tool ]
258 use-project /boost/libs/wave/tool : libs/wave/tool/build ;
261 # This rule should be called from libraries' Jamfiles and will create two
262 # targets, "install" and "stage", that will install or stage that library. The
263 # --prefix option is respected, but --with and --without options, naturally, are
266 # - libraries -- list of library targets to install.
268 rule boost-install ( libraries * )
270 package.install install
271 : <dependency>/boost//install-proper-headers $(install-requirements)
274 : # No headers, it is handled by the dependency.
277 install stage : $(libraries) : <location>$(BOOST_STAGE_LOCATE) ;
279 module [ CALLER_MODULE ]
286 # Creates a library target, adding autolink support and also creates
287 # stage and install targets via boost-install, above.
288 rule boost-lib ( name : sources * : requirements * : default-build * : usage-requirements * )
290 name = boost_$(name) ;
291 autolink = <link>shared:<define>BOOST_$(name:U)_DYN_LINK=1 ;
294 : $(requirements) $(autolink)
296 : $(usage-requirements) $(autolink)
298 boost-install $(name) ;
303 # The .SUNWCCh files are present in tr1 include directory and have to be
304 # installed (see http://lists.boost.org/Archives/boost/2007/05/121430.php).
305 [ path.glob-tree $(BOOST_ROOT)/boost : *.hpp *.ipp *.h *.inc *.SUNWCCh : CVS .svn ]
306 [ path.glob-tree $(BOOST_ROOT)/boost/compatibility/cpp_c_headers : c* : CVS .svn ]
307 [ path.glob boost/tr1/tr1 : * : bcc32 sun CVS .svn ]
310 # Declare special top-level targets that build and install the desired variants
312 boostcpp.declare-targets $(all-libraries) : $(headers) ;