Imported Upstream version 1.68.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 import notfile ;
133 import virtual-target ;
134 import "class" : new ;
135 import property-set ;
136 import threadapi-feature ;
137 import option ;
138
139 path-constant BOOST_ROOT : . ;
140 constant BOOST_VERSION : 1.68.0 ;
141 constant BOOST_JAMROOT_MODULE : $(__name__) ;
142
143 boostcpp.set-version $(BOOST_VERSION) ;
144
145 use-project /boost/architecture : libs/config/checks/architecture ;
146
147 local all-headers =
148     [ MATCH .*libs/(.*)/include/boost : [ glob libs/*/include/boost libs/*/*/include/boost ] ] ;
149
150 for dir in $(all-headers)
151 {
152     link-directory $(dir)-headers : libs/$(dir)/include/boost : <location>. ;
153     explicit $(dir)-headers ;
154 }
155
156 if $(all-headers)
157 {
158     constant BOOST_MODULARLAYOUT : $(all-headers) ;
159 }
160
161 project boost
162     : requirements <include>.
163
164       [ boostcpp.architecture ]
165       [ boostcpp.address-model ]
166
167       # Disable auto-linking for all targets here, primarily because it caused
168       # troubles with V2.
169       <define>BOOST_ALL_NO_LIB=1
170       # Used to encode variant in target name. See the 'tag' rule below.
171       <tag>@$(__name__).tag
172       <conditional>@handle-static-runtime
173       # Comeau does not support shared lib
174       <toolset>como:<link>static
175       <toolset>como-linux:<define>_GNU_SOURCE=1
176       # When building docs within Boost, we want the standard Boost style
177       <xsl:param>boost.defaults=Boost
178       <conditional>@threadapi-feature.detect
179     : usage-requirements <include>.
180     : build-dir bin.v2
181     ;
182
183 # This rule is called by Boost.Build to determine the name of target. We use it
184 # to encode the build variant, compiler name and boost version in the target
185 # name.
186 #
187 rule tag ( name : type ? : property-set )
188 {
189     return [ boostcpp.tag $(name) : $(type) : $(property-set) ] ;
190 }
191
192 rule python-tag ( name : type ? : property-set )
193 {
194     return [ boostcpp.python-tag $(name) : $(type) : $(property-set) ] ;
195 }
196
197 rule handle-static-runtime ( properties * )
198 {
199     # Using static runtime with shared libraries is impossible on Linux, and
200     # dangerous on Windows. Therefore, we disallow it. This might be drastic,
201     # but it was disabled for a while without anybody complaining.
202
203     # For CW, static runtime is needed so that std::locale works.
204     if <link>shared in $(properties) && <runtime-link>static in $(properties) &&
205         ! ( <toolset>cw in $(properties) )
206     {
207         if ! $(.shared-static-warning-emitted)
208         {
209             ECHO "warning: skipping configuration link=shared, runtime-link=static" ;
210             ECHO "warning: this combination is either impossible or too dangerous" ;
211             ECHO "warning: to be of any use" ;
212             .shared-static-warning-emitted = 1 ;
213         }
214
215         return <build>no ;
216     }
217 }
218
219 all-libraries = [ MATCH .*libs/(.*)/build/.* : [ glob libs/*/build/Jamfile.v2 ]
220     [ glob libs/*/build/Jamfile ] ] ;
221
222 all-libraries = [ sequence.unique $(all-libraries) ] ;
223 # The function_types library has a Jamfile, but it's used for maintenance
224 # purposes, there's no library to build and install.
225 all-libraries = [ set.difference $(all-libraries) : function_types ] ;
226
227 # Setup convenient aliases for all libraries.
228
229 local rule explicit-alias ( id : targets + )
230 {
231     alias $(id) : $(targets) ;
232     explicit $(id) ;
233 }
234
235 # First, the complicated libraries: where the target name in Jamfile is
236 # different from its directory name.
237 explicit-alias prg_exec_monitor : libs/test/build//boost_prg_exec_monitor ;
238 explicit-alias test_exec_monitor : libs/test/build//boost_test_exec_monitor ;
239 explicit-alias unit_test_framework : libs/test/build//boost_unit_test_framework ;
240 explicit-alias bgl-vis : libs/graps/build//bgl-vis ;
241 explicit-alias serialization : libs/serialization/build//boost_serialization ;
242 explicit-alias wserialization : libs/serialization/build//boost_wserialization ;
243 for local l in $(all-libraries)
244 {
245     if ! $(l) in test graph serialization
246     {
247         explicit-alias $(l) : libs/$(l)/build//boost_$(l) ;
248     }
249 }
250
251 # Log has an additional target
252 explicit-alias log_setup : libs/log/build//boost_log_setup ;
253
254 rule do-nothing { }
255
256 rule generate-alias ( project name : property-set : sources * )
257 {
258     local action-name = [ $(property-set).get <action> ] ;
259     local m = [ MATCH ^@(.*) : $(action-name) ] ;
260     property-set = [ property-set.empty ] ;
261     local action = [ new action $(sources) : $(m[1]) : $(property-set) ] ;
262     local t = [ new notfile-target $(name) : $(project) : $(action) ] ;
263     return [ virtual-target.register $(t) ] ;
264 }
265
266 generate headers : $(all-headers)-headers : <generating-rule>@generate-alias <action>@do-nothing : : <include>.  ;
267
268 #alias headers : $(all-headers)-headers : : : <include>.  ;
269 explicit headers ;
270
271 # Make project ids of all libraries known.
272 for local l in $(all-libraries)
273 {
274     use-project /boost/$(l) : libs/$(l)/build ;
275 }
276
277 if [ path.exists $(BOOST_ROOT)/tools/inspect/build ]
278 {
279     use-project /boost/tools/inspect : tools/inspect/build ;
280 }
281
282 if [ path.exists $(BOOST_ROOT)/libs/wave/tool/build ]
283 {
284     use-project /boost/libs/wave/tool : libs/wave/tool/build ;
285 }
286
287 # This rule should be called from libraries' Jamfiles and will create two
288 # targets, "install" and "stage", that will install or stage that library. The
289 # --prefix option is respected, but --with and --without options, naturally, are
290 # ignored.
291 #
292 # - libraries -- list of library targets to install.
293 #
294 rule boost-install ( libraries * )
295 {
296     package.install install
297         : <dependency>/boost//install-proper-headers $(install-requirements)
298         : # No binaries
299         : $(libraries)
300         : # No headers, it is handled by the dependency.
301     ;
302
303     local stage-locate = [ option.get stagedir : $(BOOST_ROOT)/stage ] ;
304
305     install stage : $(libraries) : <location>$(stage-locate)/lib ;
306
307     module [ CALLER_MODULE ]
308     {
309         explicit stage ;
310         explicit install ;
311     }
312 }
313
314 # Creates a library target, adding autolink support and also creates
315 # stage and install targets via boost-install, above.
316 rule boost-lib ( name : sources * : requirements * : default-build * : usage-requirements * )
317 {
318     name = boost_$(name) ;
319     autolink = <link>shared:<define>$(name:U)_DYN_LINK=1 ;
320     lib $(name)
321         : $(sources)
322         : $(requirements) $(autolink)
323         : $(default-build)
324         : $(usage-requirements) $(autolink)
325         ;
326     boost-install $(name) ;
327 }
328
329
330 headers =
331     # The .SUNWCCh files are present in tr1 include directory and have to be
332     # installed (see http://lists.boost.org/Archives/boost/2007/05/121430.php).
333     [ path.glob-tree $(BOOST_ROOT)/boost : *.hpp *.ipp *.h *.inc *.SUNWCCh : CVS .svn ]
334     [ path.glob-tree $(BOOST_ROOT)/boost/compatibility/cpp_c_headers : c* : CVS .svn ]
335     [ path.glob $(BOOST_ROOT)/boost/tr1/tr1 : * : bcc32 sun CVS .svn ]
336     ;
337
338 # Declare special top-level targets that build and install the desired variants
339 # of the libraries.
340 boostcpp.declare-targets $(all-libraries) : $(headers) : $(all-headers) ;