Imported Upstream version 1.74.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 Windows
23 #                           Default: /usr/local on Unix, Linux, etc.
24 #
25 #   --exec-prefix=<EPREFIX> Install architecture dependent files here.
26 #                           Default: <PREFIX>
27 #
28 #   --libdir=<LIBDIR>       Install library files here.
29 #                           Default: <EPREFIX>/lib
30 #
31 #   --includedir=<HDRDIR>   Install header files here.
32 #                           Default: <PREFIX>/include
33 #
34 #   --cmakedir=<CMAKEDIR>   Install CMake configuration files here.
35 #                           Default: <LIBDIR>/cmake
36 #
37 #   --no-cmake-config       Do not install CMake configuration files.
38 #
39 #   stage                   Build and install only compiled library files to the
40 #   =====                   stage directory.
41 #
42 #   --stagedir=<STAGEDIR>   Install library files here
43 #                           Default: ./stage
44 #
45 # Other Options:
46 #
47 #   --build-type=<type>     Build the specified pre-defined set of variations of
48 #                           the libraries. Note, that which variants get built
49 #                           depends on what each library supports.
50 #
51 #                               -- minimal -- (default) Builds a minimal set of
52 #                               variants. On Windows, these are static
53 #                               multithreaded libraries in debug and release
54 #                               modes, using shared runtime. On Linux, these are
55 #                               static and shared multithreaded libraries in
56 #                               release mode.
57 #
58 #                               -- complete -- Build all possible variations.
59 #
60 #   --build-dir=DIR         Build in this location instead of building within
61 #                           the distribution tree. Recommended!
62 #
63 #   --show-libraries        Display the list of Boost libraries that require
64 #                           build and installation steps, and then exit.
65 #
66 #   --layout=<layout>       Determine whether to choose library names and header
67 #                           locations such that multiple versions of Boost or
68 #                           multiple compilers can be used on the same system.
69 #
70 #                               -- versioned -- Names of boost binaries include
71 #                               the Boost version number, name and version of
72 #                               the compiler and encoded build properties. Boost
73 #                               headers are installed in a subdirectory of
74 #                               <HDRDIR> whose name contains the Boost version
75 #                               number.
76 #
77 #                               -- tagged -- Names of boost binaries include the
78 #                               encoded build properties such as variant and
79 #                               threading, but do not including compiler name
80 #                               and version, or Boost version. This option is
81 #                               useful if you build several variants of Boost,
82 #                               using the same compiler.
83 #
84 #                               -- system -- Binaries names do not include the
85 #                               Boost version number or the name and version
86 #                               number of the compiler. Boost headers are
87 #                               installed directly into <HDRDIR>. This option is
88 #                               intended for system integrators building
89 #                               distribution packages.
90 #
91 #                           The default value is 'versioned' on Windows, and
92 #                           'system' on Unix.
93 #
94 #   --buildid=ID            Add the specified ID to the name of built libraries.
95 #                           The default is to not add anything.
96 #
97 #   --python-buildid=ID     Add the specified ID to the name of built libraries
98 #                           that depend on Python. The default is to not add
99 #                           anything. This ID is added in addition to --buildid.
100 #
101 #   --help                  This message.
102 #
103 #   --with-<library>        Build and install the specified <library>. If this
104 #                           option is used, only libraries specified using this
105 #                           option will be built.
106 #
107 #   --without-<library>     Do not build, stage, or install the specified
108 #                           <library>. By default, all libraries are built.
109 #
110 # Properties:
111 #
112 #   toolset=toolset         Indicate the toolset to build with.
113 #
114 #   variant=debug|release   Select the build variant
115 #
116 #   link=static|shared      Whether to build static or shared libraries
117 #
118 #   threading=single|multi  Whether to build single or multithreaded binaries
119 #
120 #   runtime-link=static|shared
121 #                           Whether to link to static or shared C and C++
122 #                           runtime.
123 #
124
125 # TODO:
126 #  - handle boost version
127 #  - handle python options such as pydebug
128
129 import boostcpp ;
130 import package ;
131
132 import sequence ;
133 import xsltproc ;
134 import set ;
135 import path ;
136 import link ;
137 import notfile ;
138 import virtual-target ;
139 import "class" : new ;
140 import property-set ;
141 import threadapi-feature ;
142 import option ;
143 # Backslash because of `bcp --namespace`
144 import tools/boost\_install/boost-install ;
145
146 path-constant BOOST_ROOT : . ;
147 constant BOOST_VERSION : 1.74.0 ;
148 constant BOOST_JAMROOT_MODULE : $(__name__) ;
149
150 boostcpp.set-version $(BOOST_VERSION) ;
151
152 use-project /boost/architecture : libs/config/checks/architecture ;
153
154 local all-headers =
155     [ MATCH .*libs/(.*)/include/boost : [ glob libs/*/include/boost libs/*/*/include/boost ] ] ;
156
157 for dir in $(all-headers)
158 {
159     link-directory $(dir)-headers : libs/$(dir)/include/boost : <location>. ;
160     explicit $(dir)-headers ;
161 }
162
163 if $(all-headers)
164 {
165     constant BOOST_MODULARLAYOUT : $(all-headers) ;
166 }
167
168 project boost
169     : requirements <include>.
170
171       [ boostcpp.architecture ]
172       [ boostcpp.address-model ]
173
174       # Disable auto-linking for all targets here, primarily because it caused
175       # troubles with V2.
176       <define>BOOST_ALL_NO_LIB=1
177       # Used to encode variant in target name. See the 'tag' rule below.
178       <tag>@$(__name__).tag
179       <conditional>@handle-static-runtime
180       # Comeau does not support shared lib
181       <toolset>como:<link>static
182       <toolset>como-linux:<define>_GNU_SOURCE=1
183       # When building docs within Boost, we want the standard Boost style
184       <xsl:param>boost.defaults=Boost
185       <conditional>@threadapi-feature.detect
186     : usage-requirements <include>.
187     : default-build
188       <visibility>hidden
189       <threading>multi
190     : build-dir bin.v2
191     ;
192
193 # This rule is called by Boost.Build to determine the name of target. We use it
194 # to encode the build variant, compiler name and boost version in the target
195 # name.
196 #
197 rule tag ( name : type ? : property-set )
198 {
199     return [ boostcpp.tag $(name) : $(type) : $(property-set) ] ;
200 }
201
202 rule python-tag ( name : type ? : property-set )
203 {
204     return [ boostcpp.python-tag $(name) : $(type) : $(property-set) ] ;
205 }
206
207 rule handle-static-runtime ( properties * )
208 {
209     # Using static runtime with shared libraries is impossible on Linux, and
210     # dangerous on Windows. Therefore, we disallow it. This might be drastic,
211     # but it was disabled for a while without anybody complaining.
212
213     # For CW, static runtime is needed so that std::locale works.
214     if <link>shared in $(properties) && <runtime-link>static in $(properties) &&
215         ! ( <toolset>cw in $(properties) )
216     {
217         if ! $(.shared-static-warning-emitted)
218         {
219             ECHO "warning: skipping configuration link=shared, runtime-link=static" ;
220             ECHO "warning: this combination is either impossible or too dangerous" ;
221             ECHO "warning: to be of any use" ;
222             .shared-static-warning-emitted = 1 ;
223         }
224
225         return <build>no ;
226     }
227 }
228
229 all-libraries = [ MATCH .*libs/(.*)/build/.* : [ glob libs/*/build/Jamfile.v2 ]
230     [ glob libs/*/build/Jamfile ] ] ;
231
232 all-libraries = [ sequence.unique $(all-libraries) ] ;
233 # The function_types library has a Jamfile, but it's used for maintenance
234 # purposes, there's no library to build and install.
235 all-libraries = [ set.difference $(all-libraries) : function_types ] ;
236
237 # Setup convenient aliases for all libraries.
238
239 local rule explicit-alias ( id : targets + )
240 {
241     alias $(id) : $(targets) ;
242     explicit $(id) ;
243 }
244
245 # First, the complicated libraries: where the target name in Jamfile is
246 # different from its directory name.
247 explicit-alias prg_exec_monitor : libs/test/build//boost_prg_exec_monitor ;
248 explicit-alias test_exec_monitor : libs/test/build//boost_test_exec_monitor ;
249 explicit-alias unit_test_framework : libs/test/build//boost_unit_test_framework ;
250 explicit-alias bgl-vis : libs/graps/build//bgl-vis ;
251 explicit-alias serialization : libs/serialization/build//boost_serialization ;
252 explicit-alias wserialization : libs/serialization/build//boost_wserialization ;
253 for local l in $(all-libraries)
254 {
255     if ! $(l) in test graph serialization headers
256     {
257         explicit-alias $(l) : libs/$(l)/build//boost_$(l) ;
258     }
259 }
260
261 # Log has an additional target
262 explicit-alias log_setup : libs/log/build//boost_log_setup ;
263
264 rule do-nothing { }
265
266 rule generate-alias ( project name : property-set : sources * )
267 {
268     local action-name = [ $(property-set).get <action> ] ;
269     local m = [ MATCH ^@(.*) : $(action-name) ] ;
270     property-set = [ property-set.empty ] ;
271     local action = [ new action $(sources) : $(m[1]) : $(property-set) ] ;
272     local t = [ new notfile-target $(name) : $(project) : $(action) ] ;
273     return [ virtual-target.register $(t) ] ;
274 }
275
276 generate headers : $(all-headers)-headers : <generating-rule>@generate-alias <action>@do-nothing : : <include>.  ;
277
278 #alias headers : $(all-headers)-headers : : : <include>.  ;
279 explicit headers ;
280
281 # Make project ids of all libraries known.
282 for local l in $(all-libraries)
283 {
284     use-project /boost/$(l) : libs/$(l)/build ;
285 }
286
287 if [ path.exists $(BOOST_ROOT)/tools/inspect/build ]
288 {
289     use-project /boost/tools/inspect : tools/inspect/build ;
290 }
291
292 if [ path.exists $(BOOST_ROOT)/libs/wave/tool/build ]
293 {
294     use-project /boost/libs/wave/tool : libs/wave/tool/build ;
295 }
296
297 # Make the boost-install rule visible in subprojects
298
299 # This rule should be called from libraries' Jamfiles and will create two
300 # targets, "install" and "stage", that will install or stage that library. The
301 # --prefix option is respected, but --with and --without options, naturally, are
302 # ignored.
303 #
304 # - libraries -- list of library targets to install.
305
306 rule boost-install ( libraries * )
307 {
308     boost-install.boost-install $(libraries) ;
309 }
310
311 # Creates a library target, adding autolink support and also creates
312 # stage and install targets via boost-install, above.
313 rule boost-lib ( name : sources * : requirements * : default-build * : usage-requirements * )
314 {
315     autolink = <link>shared:<define>BOOST_$(name:U)_DYN_LINK=1 ;
316     name = boost_$(name) ;
317     lib $(name)
318         : $(sources)
319         : $(requirements) $(autolink)
320         : $(default-build)
321         : $(usage-requirements) $(autolink)
322         ;
323     boost-install $(name) ;
324 }
325
326
327 # Declare special top-level targets that build and install the desired variants
328 # of the libraries.
329 boostcpp.declare-targets $(all-libraries) ;