]>
Commit | Line | Data |
---|---|---|
7c673cae FG |
1 | # Boost.Build support specific for the Boost C++ Libraries. |
2 | # Copyright Vladimir Prus 2002-2010. | |
3 | # Copyright Dave Abrahams 2005-2006. | |
4 | # Copyright Rene Rivera 2005-2007. | |
5 | # Copyright Douglas Gregor 2005. | |
6 | # | |
7 | # Distributed under the Boost Software License, Version 1.0. | |
8 | # (See accompanying file LICENSE_1_0.txt or copy at | |
9 | # http://www.boost.org/LICENSE_1_0.txt) | |
10 | ||
11 | import "class" : new ; | |
12 | import common ; | |
13 | import configure ; | |
14 | import build-system ; | |
15 | import generate ; | |
16 | import modules ; | |
17 | import option ; | |
18 | import os ; | |
19 | import package ; | |
20 | import path ; | |
21 | import project ; | |
22 | import regex ; | |
11fdf7f2 | 23 | import sequence ; |
7c673cae FG |
24 | import set ; |
25 | import targets ; | |
26 | import feature ; | |
27 | import property ; | |
92f5a8d4 | 28 | import version : version-less ; |
7c673cae FG |
29 | |
30 | ############################################################################## | |
31 | # | |
32 | # 0. General setup. Parse options, check them. | |
33 | # | |
34 | ############################################################################## | |
35 | ||
36 | BOOST_ROOT = [ modules.binding $(__name__) ] ; | |
37 | BOOST_ROOT = $(BOOST_ROOT:D) ; | |
38 | ||
39 | rule set-version ( version ) | |
40 | { | |
41 | BOOST_VERSION = $(version) ; | |
42 | ||
11fdf7f2 TL |
43 | local version-tag = |
44 | [ MATCH "^([^.]+)[.]([^.]+)[.]([^.]+)" : $(BOOST_VERSION) ] ; | |
7c673cae FG |
45 | if $(version-tag[3]) = 0 |
46 | { | |
47 | version-tag = $(version-tag[1-2]) ; | |
48 | } | |
49 | BOOST_VERSION_TAG = $(version-tag:J=_) ; | |
50 | } | |
51 | ||
52 | # Option to choose how many variants to build. The default is "minimal". | |
53 | build-type = [ option.get build-type ] ; | |
54 | build-type ?= minimal ; | |
55 | if ! ( $(build-type) in complete minimal ) | |
56 | { | |
57 | EXIT The value of the --build-type option should be either 'complete' or | |
58 | 'minimal' ; | |
59 | } | |
60 | ||
61 | # What kind of layout are we doing? | |
62 | layout = [ option.get layout : "" ] ; | |
92f5a8d4 TL |
63 | |
64 | layout = [ MATCH (versioned|tagged|system)(-(.+))? : $(layout) ] ; | |
65 | if $(layout[3]) | |
66 | { | |
67 | layout-version = $(layout[3]) ; | |
68 | layout = $(layout[1]) ; | |
69 | if [ version-less [ regex.split $(layout-version) "[.]" ] : 1 66 ] | |
70 | { | |
71 | layout-version = 1.40 ; | |
72 | } | |
73 | else if [ version-less [ regex.split $(layout-version) "[.]" ] : 1 69 ] | |
74 | { | |
75 | layout-version = 1.66 ; | |
76 | } | |
77 | } | |
78 | layout-version ?= 1.69 ; | |
79 | ||
7c673cae FG |
80 | # On Windows, we used versioned layout by default in order to be compatible with |
81 | # autolink. On other systems, we use system layout which is what every other | |
82 | # program uses. Note that the Windows check is static, and will not be affected | |
83 | # by specific build properties used. | |
84 | if ! $(layout) | |
85 | { | |
86 | if [ os.name ] = NT | |
87 | { | |
88 | layout = versioned ; | |
89 | } | |
90 | else | |
91 | { | |
92 | layout = system ; | |
93 | } | |
94 | } | |
95 | layout-$(layout) = true ; | |
96 | ||
97 | if $(layout) = system && $(build-type) = complete | |
98 | { | |
11fdf7f2 TL |
99 | ECHO error\: Cannot use --layout=system with --build-type complete. ; |
100 | ECHO error\: Please use either --layout=versioned or --layout=tagged ; | |
101 | ECHO error\: if you wish to build multiple variants. ; | |
7c673cae FG |
102 | if [ os.name ] != NT |
103 | { | |
11fdf7f2 | 104 | ECHO error\: Note that --layout=system is used by default on Unix |
7c673cae FG |
105 | starting with Boost 1.40. ; |
106 | } | |
107 | EXIT ; | |
108 | } | |
109 | ||
110 | # Possible stage only location. | |
111 | stage-locate = [ option.get stagedir ] ; | |
92f5a8d4 TL |
112 | |
113 | if $(stage-locate) | |
114 | { | |
115 | stage-locate = [ path.root [ path.make $(stage-locate) ] [ path.pwd ] ] ; | |
116 | } | |
117 | else | |
118 | { | |
119 | stage-locate = $(BOOST_ROOT)/stage ; | |
120 | } | |
121 | ||
7c673cae FG |
122 | BOOST_STAGE_LOCATE = $(stage-locate) ; |
123 | ||
124 | # Custom build ID. | |
125 | build-id = [ option.get buildid ] ; | |
126 | if $(build-id) | |
127 | { | |
128 | BUILD_ID = [ regex.replace $(build-id) "[*\\/:.\"\' ]" _ ] ; | |
129 | } | |
130 | ||
131 | # Python build id (for Python libraries only). | |
132 | python-id = [ option.get "python-buildid" ] ; | |
133 | if $(python-id) | |
134 | { | |
11fdf7f2 | 135 | PYTHON_ID = [ regex.replace $(python-id) "[*\\/:.\"\']" _ ] ; |
7c673cae FG |
136 | } |
137 | ||
138 | ||
92f5a8d4 TL |
139 | if $(layout) = versioned |
140 | { | |
141 | switch $(layout-version) | |
142 | { | |
143 | case 1.40 : | |
144 | .format-name-args = | |
145 | <base> <toolset> <threading> <runtime> ; | |
146 | case 1.66 : | |
147 | .format-name-args = | |
148 | <base> <toolset> <threading> <runtime> <arch-and-model> ; | |
149 | case 1.69 : | |
150 | .format-name-args = | |
151 | <base> <toolset> <threading> <runtime> <arch-and-model> ; | |
152 | } | |
153 | } | |
154 | else if $(layout) = tagged | |
155 | { | |
156 | switch $(layout-version) | |
157 | { | |
158 | case 1.40 : | |
159 | .format-name-args = | |
160 | <base> <threading> <runtime> ; | |
161 | case 1.66 : | |
162 | .format-name-args = | |
163 | <base> <threading> <runtime> ; | |
164 | case 1.69 : | |
165 | .format-name-args = | |
166 | <base> <threading> <runtime> <arch-and-model> ; | |
167 | } | |
168 | } | |
169 | else if $(layout) = system | |
170 | { | |
171 | .format-name-args = <base> ; | |
172 | } | |
173 | else | |
174 | { | |
175 | .format-name-error = true ; | |
176 | } | |
177 | ||
178 | ||
7c673cae FG |
179 | ################################################################################ |
180 | # | |
181 | # 1. 'tag' function adding decorations suitable to the properties if versioned | |
182 | # or tagged layout is requested. Called from Jamroot. | |
183 | # | |
184 | ################################################################################ | |
185 | ||
186 | rule tag ( name : type ? : property-set ) | |
187 | { | |
188 | if $(type) in STATIC_LIB SHARED_LIB IMPORT_LIB | |
189 | { | |
92f5a8d4 | 190 | local args = $(.format-name-args) ; |
7c673cae FG |
191 | if $(layout) = versioned |
192 | { | |
92f5a8d4 | 193 | args += -$(BOOST_VERSION_TAG) ; |
7c673cae | 194 | } |
92f5a8d4 TL |
195 | local result = [ common.format-name |
196 | $(args) -$(BUILD_ID) | |
197 | : $(name) : $(type) : $(property-set) ] ; | |
198 | if $(.format-name-error) | |
7c673cae | 199 | { |
11fdf7f2 | 200 | EXIT error\: invalid layout '$(layout:E=)' ; |
7c673cae FG |
201 | } |
202 | ||
203 | # Optionally add version suffix. On NT, library with version suffix will | |
204 | # not be recognized by linkers. On CYGWIN, we get strage duplicate | |
205 | # symbol errors when library is generated with version suffix. On OSX, | |
206 | # version suffix is not needed -- the linker expects the | |
207 | # libFoo.1.2.3.dylib format. AIX linkers do not accept version suffixes | |
208 | # either. Pgi compilers can not accept a library with version suffix. | |
209 | if $(type) = SHARED_LIB && | |
210 | ! [ $(property-set).get <target-os> ] in windows cygwin darwin aix && | |
211 | ! [ $(property-set).get <toolset> ] in pgi | |
212 | { | |
213 | result = $(result).$(BOOST_VERSION) ; | |
214 | } | |
215 | ||
216 | return $(result) ; | |
217 | } | |
218 | } | |
219 | ||
220 | # Specialized tag function to use for libraries linking to Python. | |
221 | # Appends value of --python-buildid if provided. | |
222 | rule python-tag ( name : type ? : property-set ) | |
223 | { | |
224 | local result = $(name) ; | |
92f5a8d4 TL |
225 | |
226 | if $(type) in STATIC_LIB SHARED_LIB IMPORT_LIB | |
7c673cae | 227 | { |
92f5a8d4 TL |
228 | # Add Python version suffix |
229 | ||
230 | local version = [ $(property-set).get <python> ] ; | |
231 | ||
232 | local major-minor = [ MATCH "^([0-9]+)\.([0-9]+)" : $(version) ] ; | |
233 | local suffix = $(major-minor:J="") ; | |
234 | ||
235 | if $(suffix) | |
236 | { | |
237 | result = $(result)$(suffix) ; | |
238 | } | |
239 | ||
240 | # Add PYTHON_ID if supplied | |
241 | ||
242 | if $(PYTHON_ID) | |
243 | { | |
244 | result = $(result)-$(PYTHON_ID) ; | |
245 | } | |
7c673cae FG |
246 | } |
247 | ||
248 | # forward to the boost tagging rule | |
249 | return [ tag $(result) : $(type) : $(property-set) ] ; | |
250 | } | |
251 | ||
252 | ################################################################################ | |
253 | # | |
254 | # 2. Declare targets that build and install all libraries. Specifically: | |
255 | # | |
256 | # - 'stage-proper' that puts all libraries in stage/lib | |
257 | # - 'install-proper' that install libraries and headers to system location | |
7c673cae FG |
258 | # |
259 | ################################################################################ | |
260 | ||
92f5a8d4 | 261 | rule declare_install_and_stage_proper_targets ( libraries * ) |
7c673cae FG |
262 | { |
263 | local p = [ project.current ] ; | |
7c673cae | 264 | |
92f5a8d4 | 265 | alias install-proper : libs/$(libraries)/build//install ; |
7c673cae FG |
266 | $(p).mark-target-as-explicit install-proper ; |
267 | ||
92f5a8d4 | 268 | alias stage-proper : libs/$(libraries)/build//stage ; |
7c673cae | 269 | $(p).mark-target-as-explicit stage-proper ; |
7c673cae FG |
270 | } |
271 | ||
272 | ||
273 | ################################################################################ | |
274 | # | |
275 | # 3. Declare top-level targets 'stage' and 'install'. These examine the | |
276 | # --build-type option and, in case it is 'complete', build the 'install-proper' | |
277 | # and 'stage-proper' targets with a number of property sets. | |
278 | # | |
279 | ################################################################################ | |
280 | ||
1e59de90 TL |
281 | rule emit-shared-static-warning ( ) |
282 | { | |
283 | if ! $(.shared-static-warning-emitted) | |
284 | { | |
285 | ECHO "" ; | |
286 | ECHO "warning: The configuration link=shared, runtime-link=static is disabled" ; | |
287 | ECHO "warning: by default as being too dangerous to use, and will not be built." ; | |
288 | ECHO "warning: To enable it, use --allow-shared-static." ; | |
289 | ECHO "" ; | |
290 | ||
291 | .shared-static-warning-emitted = 1 ; | |
292 | } | |
293 | } | |
294 | ||
7c673cae FG |
295 | class top-level-target : alias-target-class |
296 | { | |
297 | import modules ; | |
1e59de90 | 298 | import boostcpp ; |
7c673cae FG |
299 | |
300 | rule __init__ ( name : project : sources * : requirements * | |
301 | : default-build * : usage-requirements * ) | |
302 | { | |
303 | alias-target-class.__init__ $(name) : $(project) : $(sources) : | |
304 | $(requirements) : $(default-build) : $(usage-requirements) ; | |
305 | ||
306 | self.build-type = [ modules.peek boostcpp : build-type ] ; | |
307 | # On Linux, we build the release variant by default, since few users | |
308 | # will ever want to debug C++ Boost libraries, and there is no ABI | |
309 | # incompatibility between debug and release variants. We build shared | |
310 | # and static libraries since that is what most packages seem to provide | |
311 | # (.so in libfoo and .a in libfoo-dev). | |
b32b8144 | 312 | |
7c673cae FG |
313 | self.minimal-properties = [ property-set.create <variant>release |
314 | <threading>multi <link>shared <link>static <runtime-link>shared ] ; | |
b32b8144 | 315 | |
7c673cae FG |
316 | # On Windows, new IDE projects use: |
317 | # | |
318 | # runtime-link=dynamic, threading=multi, variant=(debug|release) | |
319 | # | |
320 | # and in addition, C++ Boost's autolink defaults to static linking. | |
b32b8144 | 321 | |
7c673cae FG |
322 | self.minimal-properties-win = [ property-set.create <variant>debug |
323 | <variant>release <threading>multi <link>static <runtime-link>shared | |
b32b8144 | 324 | <address-model>32 <address-model>64 ] ; |
7c673cae FG |
325 | |
326 | self.complete-properties = [ property-set.create | |
327 | <variant>debug <variant>release | |
b32b8144 | 328 | <threading>multi |
7c673cae FG |
329 | <link>shared <link>static |
330 | <runtime-link>shared <runtime-link>static ] ; | |
b32b8144 FG |
331 | |
332 | self.complete-properties-win = [ property-set.create | |
333 | <variant>debug <variant>release | |
334 | <threading>multi | |
335 | <link>shared <link>static | |
336 | <runtime-link>shared <runtime-link>static | |
337 | <address-model>32 <address-model>64 ] ; | |
7c673cae FG |
338 | } |
339 | ||
340 | rule generate ( property-set ) | |
341 | { | |
342 | modules.poke : top-level-targets : [ modules.peek : top-level-targets ] | |
343 | $(self.name) ; | |
b32b8144 FG |
344 | |
345 | local os = [ $(property-set).get <target-os> ] ; | |
346 | ||
347 | # Because we completely override the parent's 'generate' we need to | |
348 | # check for default feature values ourselves. | |
349 | ||
350 | if ! $(os) | |
7c673cae | 351 | { |
b32b8144 FG |
352 | os = [ feature.defaults <target-os> ] ; |
353 | os = $(os:G=) ; | |
354 | } | |
7c673cae | 355 | |
b32b8144 | 356 | local build-type-set ; |
7c673cae | 357 | |
b32b8144 FG |
358 | if $(self.build-type) = minimal |
359 | { | |
7c673cae FG |
360 | if $(os) = windows |
361 | { | |
b32b8144 | 362 | build-type-set = $(self.minimal-properties-win) ; |
7c673cae FG |
363 | } |
364 | else | |
365 | { | |
b32b8144 | 366 | build-type-set = $(self.minimal-properties) ; |
7c673cae | 367 | } |
7c673cae FG |
368 | } |
369 | else if $(self.build-type) = complete | |
b32b8144 FG |
370 | { |
371 | if $(os) = windows | |
372 | { | |
373 | build-type-set = $(self.complete-properties-win) ; | |
374 | } | |
375 | else | |
376 | { | |
377 | build-type-set = $(self.complete-properties) ; | |
378 | } | |
379 | } | |
380 | else | |
381 | { | |
382 | import errors ; | |
383 | errors.error "Unknown build type" ; | |
384 | } | |
385 | ||
386 | if $(build-type-set) | |
7c673cae FG |
387 | { |
388 | local expanded = [ targets.apply-default-build $(property-set) | |
b32b8144 | 389 | : $(build-type-set) ] ; |
7c673cae FG |
390 | |
391 | # Filter inappopriate combinations. | |
1e59de90 | 392 | |
7c673cae | 393 | local filtered ; |
1e59de90 TL |
394 | local skipped ; |
395 | ||
396 | local argv = [ modules.peek : ARGV ] ; | |
397 | ||
7c673cae FG |
398 | for local p in $(expanded) |
399 | { | |
400 | # See comment in handle-static-runtime regarding this logic. | |
401 | if [ $(p).get <link> ] = shared | |
402 | && [ $(p).get <runtime-link> ] = static | |
403 | && [ $(p).get <toolset> ] != cw | |
1e59de90 | 404 | && ! --allow-shared-static in $(argv) |
7c673cae FG |
405 | { |
406 | # Skip this. | |
1e59de90 | 407 | skipped += $(p) ; |
7c673cae FG |
408 | } |
409 | else | |
410 | { | |
411 | filtered += $(p) ; | |
412 | } | |
413 | } | |
b32b8144 | 414 | |
1e59de90 TL |
415 | if $(expanded) = $(skipped) |
416 | { | |
417 | boostcpp.emit-shared-static-warning ; | |
418 | } | |
419 | ||
7c673cae FG |
420 | return [ build-multiple $(filtered) ] ; |
421 | } | |
7c673cae FG |
422 | } |
423 | ||
424 | rule build-multiple ( property-sets * ) | |
425 | { | |
426 | local usage-requirements = [ property-set.empty ] ; | |
427 | local result ; | |
428 | for local p in $(property-sets) | |
429 | { | |
430 | local r = [ alias-target-class.generate $(p) ] ; | |
431 | if $(r) | |
432 | { | |
433 | usage-requirements = [ $(usage-requirements).add $(r[1]) ] ; | |
434 | result += $(r[2-]) ; | |
435 | } | |
436 | } | |
437 | return $(usage-requirements) [ sequence.unique $(result) ] ; | |
438 | } | |
439 | } | |
440 | ||
92f5a8d4 | 441 | rule declare_top_level_targets ( libraries * ) |
7c673cae | 442 | { |
92f5a8d4 | 443 | declare_install_and_stage_proper_targets $(libraries) ; |
7c673cae FG |
444 | |
445 | targets.create-metatarget top-level-target : [ project.current ] | |
446 | : install | |
92f5a8d4 | 447 | : install-proper |
7c673cae FG |
448 | ; |
449 | targets.create-metatarget top-level-target : [ project.current ] | |
450 | : stage | |
92f5a8d4 | 451 | : stage-proper headers |
7c673cae FG |
452 | ; |
453 | ||
454 | p = [ project.current ] ; | |
455 | $(p).mark-target-as-explicit install stage ; | |
456 | ||
457 | # This target is built by default, and will forward to 'stage' after | |
458 | # producing some explanations. | |
459 | targets.create-metatarget top-level-target : [ project.current ] | |
460 | : forward | |
461 | : explain stage | |
462 | ; | |
463 | } | |
464 | ||
465 | ||
7c673cae FG |
466 | ################################################################################ |
467 | # | |
468 | # 4. Add hook to report configuration before the build, and confirmation with | |
469 | # setup instructions after the build. | |
470 | # | |
471 | ################################################################################ | |
472 | ||
473 | message explain : "\nBuilding the Boost C++ Libraries.\n\n" ; | |
474 | local p = [ project.current ] ; | |
475 | $(p).mark-target-as-explicit explain ; | |
476 | ||
477 | rule pre-build ( ) | |
478 | { | |
479 | local tl = [ modules.peek : top-level-targets ] ; | |
480 | if stage in $(tl) || install in $(tl) | |
481 | { | |
482 | # FIXME: Remove 'if' when Boost regression tests start using trunk bjam. | |
483 | if PAD in [ RULENAMES ] | |
484 | { | |
485 | configure.print-component-configuration ; | |
486 | } | |
487 | } | |
488 | } | |
489 | IMPORT $(__name__) : pre-build : : $(__name__).pre-build ; | |
490 | build-system.set-pre-build-hook $(__name__).pre-build ; | |
491 | ||
7c673cae FG |
492 | rule post-build ( ok ? ) |
493 | { | |
494 | if forward in [ modules.peek : top-level-targets ] | |
495 | { | |
496 | if $(ok) | |
497 | { | |
498 | local include-path = [ path.native $(BOOST_ROOT) ] ; | |
92f5a8d4 TL |
499 | local stage-abs = [ path.native $(stage-locate)/lib ] ; |
500 | ||
7c673cae FG |
501 | ECHO " |
502 | ||
503 | The Boost C++ Libraries were successfully built! | |
504 | ||
505 | The following directory should be added to compiler include paths: | |
506 | ||
507 | $(include-path) | |
508 | ||
509 | The following directory should be added to linker library paths: | |
510 | ||
511 | $(stage-abs) | |
512 | " ; | |
513 | } | |
514 | } | |
515 | } | |
516 | IMPORT $(__name__) : post-build : : $(__name__).post-build ; | |
517 | build-system.set-post-build-hook $(__name__).post-build ; | |
518 | ||
519 | ||
520 | ################################################################################ | |
521 | # | |
522 | # 5. Top-level setup. | |
523 | # | |
524 | ################################################################################ | |
525 | ||
526 | # Decides which libraries are to be installed by looking at --with-<library> | |
527 | # --without-<library> arguments. Returns the list of directories under "libs" | |
528 | # which must be built and installed. | |
529 | # | |
530 | rule libraries-to-install ( existing-libs * ) | |
531 | { | |
532 | local argv = [ modules.peek : ARGV ] ; | |
533 | local with-parameter = [ MATCH ^--with-(.*) : $(argv) ] ; | |
534 | local without-parameter = [ MATCH ^--without-(.*) : $(argv) ] ; | |
535 | ||
536 | if ! $(with-parameter) && ! $(without-parameter) | |
537 | { | |
538 | # Nothing is specified on command line. See if maybe project-config.jam | |
539 | # has some choices. | |
540 | local libs = [ modules.peek project-config : libraries ] ; | |
541 | with-parameter = [ MATCH ^--with-(.*) : $(libs) ] ; | |
542 | without-parameter = [ MATCH ^--without-(.*) : $(libs) ] ; | |
543 | } | |
544 | ||
545 | # Do some checks. | |
546 | if $(with-parameter) && $(without-parameter) | |
547 | { | |
11fdf7f2 | 548 | EXIT error\: both --with-<library> and --without-<library> specified ; |
7c673cae FG |
549 | } |
550 | ||
551 | local wrong = [ set.difference $(with-parameter) : $(existing-libs) ] ; | |
552 | if $(wrong) | |
553 | { | |
11fdf7f2 | 554 | EXIT error\: wrong library name '$(wrong[1])' in the --with-<library> |
7c673cae FG |
555 | option. ; |
556 | } | |
557 | local wrong = [ set.difference $(without-parameter) : $(existing-libs) ] ; | |
558 | if $(wrong) | |
559 | { | |
11fdf7f2 | 560 | EXIT error\: wrong library name '$(wrong[1])' in the --without-<library> |
7c673cae FG |
561 | option. ; |
562 | } | |
563 | ||
564 | if $(with-parameter) | |
565 | { | |
566 | return [ set.intersection $(existing-libs) : $(with-parameter) ] ; | |
567 | } | |
568 | else | |
569 | { | |
570 | return [ set.difference $(existing-libs) : $(without-parameter) ] ; | |
571 | } | |
572 | } | |
573 | ||
92f5a8d4 | 574 | rule declare-targets ( all-libraries * ) |
7c673cae FG |
575 | { |
576 | configure.register-components $(all-libraries) ; | |
577 | ||
578 | # Select the libraries to install. | |
579 | libraries = [ libraries-to-install $(all-libraries) ] ; | |
580 | configure.components-building $(libraries) ; | |
581 | ||
582 | if [ option.get "show-libraries" : : true ] | |
583 | { | |
11fdf7f2 | 584 | ECHO The following libraries require building\: ; |
7c673cae FG |
585 | for local l in $(libraries) |
586 | { | |
587 | ECHO " - $(l)" ; | |
588 | } | |
589 | EXIT ; | |
590 | } | |
591 | ||
92f5a8d4 | 592 | declare_top_level_targets $(libraries) ; |
7c673cae FG |
593 | } |
594 | ||
595 | # Returns the properties identifying the toolset. We'll use them | |
596 | # below to configure checks. These are essentially same as in | |
597 | # configure.builds, except we don't use address-model and | |
598 | # architecture - as we're trying to detect them here. | |
599 | # | |
600 | rule toolset-properties ( properties * ) | |
601 | { | |
602 | local toolset = [ property.select <toolset> : $(properties) ] ; | |
603 | local toolset-version-property = "<toolset-$(toolset:G=):version>" ; | |
604 | return [ property.select <target-os> <toolset> $(toolset-version-property) : $(properties) ] ; | |
605 | } | |
606 | ||
607 | feature.feature deduced-address-model : 32 64 : propagated optional composite hidden ; | |
608 | feature.compose <deduced-address-model>32 : <address-model>32 ; | |
609 | feature.compose <deduced-address-model>64 : <address-model>64 ; | |
610 | ||
611 | rule deduce-address-model ( properties * ) | |
612 | { | |
613 | local result ; | |
614 | local filtered = [ toolset-properties $(properties) ] ; | |
11fdf7f2 TL |
615 | local names = 32 64 ; |
616 | local idx = [ configure.find-builds "default address-model" : $(filtered) | |
617 | : /boost/architecture//32 "32-bit" | |
618 | : /boost/architecture//64 "64-bit" ] ; | |
619 | result = $(names[$(idx)]) ; | |
7c673cae FG |
620 | |
621 | if $(result) | |
622 | { | |
623 | # Normally, returning composite feature here is equivalent to forcing | |
624 | # consituent properties as well. But we only want to indicate toolset | |
625 | # deduced default, so also pick whatever address-model is explicitly | |
626 | # specified, if any. | |
627 | result = <deduced-address-model>$(result) [ property.select <address-model> : $(properties) ] ; | |
628 | } | |
629 | return $(result) ; | |
630 | } | |
631 | ||
632 | rule address-model ( ) | |
633 | { | |
634 | return <conditional>@boostcpp.deduce-address-model ; | |
635 | } | |
636 | ||
f67539c2 | 637 | local deducable-architectures = arm mips1 power riscv s390x sparc x86 combined ; |
7c673cae FG |
638 | feature.feature deduced-architecture : $(deducable-architectures) : propagated optional composite hidden ; |
639 | for a in $(deducable-architectures) | |
640 | { | |
641 | feature.compose <deduced-architecture>$(a) : <architecture>$(a) ; | |
642 | } | |
643 | ||
644 | rule deduce-architecture ( properties * ) | |
645 | { | |
646 | local result ; | |
647 | local filtered = [ toolset-properties $(properties) ] ; | |
f67539c2 | 648 | local names = arm mips1 power riscv s390x sparc x86 combined ; |
11fdf7f2 TL |
649 | local idx = [ configure.find-builds "default architecture" : $(filtered) |
650 | : /boost/architecture//arm | |
651 | : /boost/architecture//mips1 | |
652 | : /boost/architecture//power | |
f67539c2 TL |
653 | : /boost/architecture//riscv |
654 | : /boost/architecture//s390x | |
11fdf7f2 TL |
655 | : /boost/architecture//sparc |
656 | : /boost/architecture//x86 | |
657 | : /boost/architecture//combined ] ; | |
658 | result = $(names[$(idx)]) ; | |
7c673cae FG |
659 | |
660 | if $(result) | |
661 | { | |
662 | # See comment in deduce-address-model. | |
663 | result = <deduced-architecture>$(result) [ property.select <architecture> : $(properties) ] ; | |
664 | } | |
665 | return $(result) ; | |
666 | } | |
667 | ||
668 | rule architecture ( ) | |
669 | { | |
670 | return <conditional>@boostcpp.deduce-architecture ; | |
671 | } |