Imported Upstream version 1.63.0
[platform/upstream/boost.git] / Jamroot
1 # Copyright Vladimir Prus 2002-2006.
2 # Copyright Dave Abrahams 2005-2006.
3 # Copyright Rene Rivera 2005-2007.
4 # Copyright Douglas Gregor 2005.
5 #
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)
9
10 # Usage:
11 #
12 #   b2 [options] [properties] [install|stage]
13 #
14 #   Builds and installs Boost.
15 #
16 # Targets and Related Options:
17 #
18 #   install                 Install headers and compiled library files to the
19 #   =======                 configured locations (below).
20 #
21 #   --prefix=<PREFIX>       Install architecture independent files here.
22 #                           Default; C:\Boost on Win32
23 #                           Default; /usr/local on Unix. Linux, etc.
24 #
25 #   --exec-prefix=<EPREFIX> Install architecture dependent files here.
26 #                           Default; <PREFIX>
27 #
28 #   --libdir=<DIR>          Install library files here.
29 #                           Default; <EPREFIX>/lib
30 #
31 #   --includedir=<HDRDIR>   Install header files here.
32 #                           Default; <PREFIX>/include
33 #
34 #   stage                   Build and install only compiled library files to the
35 #   =====                   stage directory.
36 #
37 #   --stagedir=<STAGEDIR>   Install library files here
38 #                           Default; ./stage
39 #
40 # Other Options:
41 #
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.
45 #
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
51 #                               release mode.
52 #
53 #                               -- complete -- Build all possible variations.
54 #
55 #   --build-dir=DIR         Build in this location instead of building within
56 #                           the distribution tree. Recommended!
57 #
58 #   --show-libraries        Display the list of Boost libraries that require
59 #                           build and installation steps, and then exit.
60 #
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.
64 #
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
70 #                               number.
71 #
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.
78 #
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.
85 #
86 #                           The default value is 'versioned' on Windows, and
87 #                           'system' on Unix.
88 #
89 #   --buildid=ID            Add the specified ID to the name of built libraries.
90 #                           The default is to not add anything.
91 #
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.
95 #
96 #   --help                  This message.
97 #
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.
101 #
102 #   --without-<library>     Do not build, stage, or install the specified
103 #                           <library>. By default, all libraries are built.
104 #
105 # Properties:
106 #
107 #   toolset=toolset         Indicate the toolset to build with.
108 #
109 #   variant=debug|release   Select the build variant
110 #
111 #   link=static|shared      Whether to build static or shared libraries
112 #
113 #   threading=single|multi  Whether to build single or multithreaded binaries
114 #
115 #   runtime-link=static|shared
116 #                           Whether to link to static or shared C and C++
117 #                           runtime.
118 #
119
120 # TODO:
121 #  - handle boost version
122 #  - handle python options such as pydebug
123
124 import boostcpp ;
125 import package ;
126
127 import sequence ;
128 import xsltproc ;
129 import set ;
130 import path ;
131 import link ;
132
133 path-constant BOOST_ROOT : . ;
134 constant BOOST_VERSION : 1.63.0 ;
135 constant BOOST_JAMROOT_MODULE : $(__name__) ;
136
137 boostcpp.set-version $(BOOST_VERSION) ;
138
139 use-project /boost/architecture : libs/config/checks/architecture ;
140
141 local all-headers =
142     [ MATCH .*libs/(.*)/include/boost : [ glob libs/*/include/boost libs/*/*/include/boost ] ] ;
143
144 for dir in $(all-headers)
145 {
146     link-directory $(dir)-headers : libs/$(dir)/include/boost : <location>. ;
147     explicit $(dir)-headers ;
148 }
149
150 if $(all-headers)
151 {
152     constant BOOST_MODULARLAYOUT : $(all-headers) ;
153 }
154
155 project boost
156     : requirements <include>.
157
158       [ boostcpp.architecture ]
159       [ boostcpp.address-model ]
160
161       # Disable auto-linking for all targets here, primarily because it caused
162       # troubles with V2.
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>.
173     : build-dir bin.v2
174     ;
175
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
178 # name.
179 #
180 rule tag ( name : type ? : property-set )
181 {
182     return [ boostcpp.tag $(name) : $(type) : $(property-set) ] ;
183 }
184
185 rule python-tag ( name : type ? : property-set )
186 {
187     return [ boostcpp.python-tag $(name) : $(type) : $(property-set) ] ;
188 }
189
190 rule handle-static-runtime ( properties * )
191 {
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.
195
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) )
199     {
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" ;
203         EXIT ;
204     }
205 }
206
207 all-libraries = [ MATCH .*libs/(.*)/build/.* : [ glob libs/*/build/Jamfile.v2 ]
208     [ glob libs/*/build/Jamfile ] ] ;
209
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 ] ;
214
215 # Setup convenient aliases for all libraries.
216
217 local rule explicit-alias ( id : targets + )
218 {
219     alias $(id) : $(targets) ;
220     explicit $(id) ;
221 }
222
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)
232 {
233     if ! $(l) in test graph serialization
234     {
235         explicit-alias $(l) : libs/$(l)/build//boost_$(l) ;
236     }
237 }
238
239 # Log has an additional target
240 explicit-alias log_setup : libs/log/build//boost_log_setup ;
241
242 alias headers : $(all-headers)-headers : : : <include>.  ;
243 explicit headers ;
244
245 # Make project ids of all libraries known.
246 for local l in $(all-libraries)
247 {
248     use-project /boost/$(l) : libs/$(l)/build ;
249 }
250
251 if [ path.exists $(BOOST_ROOT)/tools/inspect ]
252 {
253     use-project /boost/tools/inspect : tools/inspect/build ;
254 }
255
256 if [ path.exists $(BOOST_ROOT)/libs/wave/tool ]
257 {
258     use-project /boost/libs/wave/tool : libs/wave/tool/build ;
259 }
260
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
264 # ignored.
265 #
266 # - libraries -- list of library targets to install.
267 #
268 rule boost-install ( libraries * )
269 {
270     package.install install
271         : <dependency>/boost//install-proper-headers $(install-requirements)
272         : # No binaries
273         : $(libraries)
274         : # No headers, it is handled by the dependency.
275     ;
276
277     install stage : $(libraries) : <location>$(BOOST_STAGE_LOCATE) ;
278
279     module [ CALLER_MODULE ]
280     {
281         explicit stage ;
282         explicit install ;
283     }
284 }
285
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 * )
289 {
290     name = boost_$(name) ;
291     autolink = <link>shared:<define>BOOST_$(name:U)_DYN_LINK=1 ;
292     lib $(name)
293         : $(sources)
294         : $(requirements) $(autolink)
295         : $(default-build)
296         : $(usage-requirements) $(autolink)
297         ;
298     boost-install $(name) ;
299 }
300
301
302 headers =
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 ]
308     ;
309
310 # Declare special top-level targets that build and install the desired variants
311 # of the libraries.
312 boostcpp.declare-targets $(all-libraries) : $(headers) ;