Jamroot 12 KB

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