Jamroot 12 KB

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