boostcpp.jam 23 KB

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