Jamfile.v2 11 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346
  1. # Copyright Vladimir Prus 2002-2006.
  2. # Copyright Dave Abrahams 2005-2006.
  3. # Copyright Rene Rivera 2005-2006.
  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. # bjam [options] [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=DIR Install header files here.
  31. # Default; PREFIX/include
  32. #
  33. # stage Build and install only compiled library files
  34. # ===== to the stage directory.
  35. #
  36. # --stagedir=DIR Install library files here
  37. # Default; ./stage
  38. #
  39. # Other Options:
  40. #
  41. # --builddir=DIR Build in this location instead of building
  42. # within the distribution tree. Recommended!
  43. #
  44. # --toolset=toolset Indicates the toolset to build with.
  45. #
  46. # --show-libraries Displays the list of Boost libraries that require
  47. # build and installation steps, then exit.
  48. #
  49. # --layout=<layout> Determines what kind of build layout to use. This
  50. # allows one to control the naming of the resulting
  51. # libraries, and the locations of the installed
  52. # files. Default is 'versioned'. Possible values:
  53. #
  54. # versioned - Uses the Boost standard names
  55. # which include version number for Boost the
  56. # release and version and name of the
  57. # compiler as part of the library names. Also
  58. # installs the includes to a versioned
  59. # sub-directory.
  60. #
  61. # system - Builds an install without the
  62. # Boost standard names, and does not install
  63. # includes to a versioned sub-directory. This
  64. # is intended for system integrators to build
  65. # for packaging of distributions.
  66. #
  67. # --help This message.
  68. #
  69. # --with-<library> Build and install the specified <library>
  70. # If this option is used, only libraries
  71. # specified using this option will be built.
  72. #
  73. # --without-<library> Do not build, stage, or install the specified
  74. # <library>. By default, all libraries are built.
  75. #
  76. # --with-python-root[=PYTHON_ROOT]
  77. # Build Boost.Python libraries with the Python
  78. # devel packages located at PYTHON_ROOT.
  79. # Default PYTHON_ROOT; C:\Python24 on Win32.
  80. # Default PYTHON_ROOT; /usr on Unix, Linux,
  81. # Cygwin, etc.
  82. #
  83. # --with-python-version[=2.4]
  84. # Build Boost.Python libraries with the Python
  85. # version indicated.
  86. # Default; 2.4.
  87. #
  88. # --with-pydebug Build Boost.Python libraries for use with a
  89. # debug build of Python.
  90. #
  91. # This is Boost Jamfile for Boost.Build V2.
  92. #
  93. # Pass --v2 option to bjam to use this file. For example:
  94. #
  95. # bjam --v2 link=static
  96. #
  97. # TODO:
  98. # - handle boost version
  99. import modules ;
  100. import set ;
  101. import stage ;
  102. import package ;
  103. import path ;
  104. import common ;
  105. constant BOOST_VERSION : 1.35.0 ;
  106. local version-tag = [ MATCH "^([^.]+)[.]([^.]+)[.]([^.]+)" : $(BOOST_VERSION) ] ;
  107. if $(version-tag[3]) = 0
  108. {
  109. version-tag = $(version-tag[1-2]) ;
  110. }
  111. constant BOOST_VERSION_TAG : $(version-tag:J="_") ;
  112. local default-build ;
  113. if $(__file__:D) = ""
  114. {
  115. default-build =
  116. debug release
  117. <threading>single <threading>multi
  118. <link>shared <link>static
  119. # <runtime-link>shared <runtime-link>static
  120. <runtime-debugging>off
  121. ;
  122. }
  123. else
  124. {
  125. default-build =
  126. debug
  127. ;
  128. }
  129. project boost
  130. : requirements <include>.
  131. # disable auto-linking for all targets here,
  132. # primarily because it caused troubles with V2
  133. <define>BOOST_ALL_NO_LIB=1
  134. # Used to encode variant in target name. See the
  135. # 'tag' rule below.
  136. <tag>@$(__name__).tag
  137. # This property combination is impossible on gcc.
  138. # Until we have a more general mechanism for
  139. # toolset to declare impossible properties,
  140. # just hardcode this knowledge here
  141. <toolset>gcc,<link>shared,<runtime-link>static:<build>no
  142. : usage-requirements <include>.
  143. : build-dir bin.v2
  144. : default-build $(default-build)
  145. ;
  146. # Setup convenient aliases for all libraries.
  147. all-libraries =
  148. [ MATCH .*libs/(.*)/build/.* : [ glob libs/*/build/Jamfile.v2 ] ]
  149. ;
  150. # First, the complicated libraries: where the target name in
  151. # Jamfile is different from directory name.
  152. alias prg_exec_monitor : libs/test/build//boost_prg_exec_monitor ;
  153. alias test_exec_monitor : libs/test/build//boost_test_exec_monitor ;
  154. alias unit_test_framework : libs/test/build//boost_unit_test_framework ;
  155. alias bgl-vis : libs/graps/build//bgl-vis ;
  156. alias serialization : libs/serialization/build//boost_serialization ;
  157. alias wserialization : libs/serialization/build//boost_wserialization ;
  158. explicit prg_exec_monitor test_exec_monitor unit_test_framework
  159. bgl-vis serialization wserialization ;
  160. for local l in $(all-libraries)
  161. {
  162. if ! $(l) in test graph serialization
  163. {
  164. alias $(l) : libs/$(l)/build//boost_$(l) ;
  165. explicit $(l) ;
  166. }
  167. }
  168. alias headers : : : : <include>. ;
  169. # Decides which libraries are to be installed by looking at --with-<library>
  170. # --without-<library> arguments. Returns the list of directories under "libs"
  171. # which must be built at installed.
  172. rule libraries-to-install ( existing-libraries * )
  173. {
  174. local argv = [ modules.peek : ARGV ] ;
  175. local with-parameter = [ MATCH --with-(.*) : $(argv) ] ;
  176. local without-parameter = [ MATCH --without-(.*) : $(argv) ] ;
  177. # Do some checks
  178. if $(with-parameter) && $(without-parameter)
  179. {
  180. ECHO "error: both --with-<library> and --without-<library> specified" ;
  181. EXIT ;
  182. }
  183. local wrong = [ set.difference $(with-parameter) : $(existing-libraries) ] ;
  184. if $(wrong)
  185. {
  186. ECHO "error: wrong library name '$(wrong[1])' in the --with-<library> option." ;
  187. EXIT ;
  188. }
  189. local wrong = [ set.difference $(without-parameter) : $(existing-libraries) ] ;
  190. if $(wrong)
  191. {
  192. ECHO "error: wrong library name '$(wrong[1])' in the --without-<library> option." ;
  193. EXIT ;
  194. }
  195. if $(with-parameter)
  196. {
  197. return [ set.intersection $(existing-libraries) : $(with-parameter) ] ;
  198. }
  199. else
  200. {
  201. return [ set.difference $(existing-libraries) : $(without-parameter) ] ;
  202. }
  203. }
  204. # what kind of layout are we doing?
  205. layout = [ MATCH "^--layout=(.*)" : [ modules.peek : ARGV ] ] ;
  206. layout ?= versioned ;
  207. layout-$(layout) = true ;
  208. # possible stage only location
  209. local stage-locate = [ MATCH "^--stagedir=(.*)" : [ modules.peek : ARGV ] ] ;
  210. stage-locate ?= stage ;
  211. path-constant BOOST_STAGE_LOCATE : $(stage-locate) ;
  212. # location of python
  213. local python-root = [ MATCH "^--with-python-root=(.*)" : [ modules.peek : ARGV ] ] ;
  214. PYTHON_ROOT ?= $(python-root) ;
  215. # Select the libraries to install.
  216. libraries = [ libraries-to-install $(all-libraries) ] ;
  217. # This rule is called by Boost.Build to determine the name of
  218. # target. We use it to encode build variant, compiler name and
  219. # boost version in the target name
  220. rule tag ( name : type ? : property-set )
  221. {
  222. if $(type) in STATIC_LIB SHARED_LIB IMPORT_LIB
  223. {
  224. if $(layout) = versioned
  225. {
  226. local result = [ common.format-name
  227. <base> <toolset> <threading> <runtime> -$(BOOST_VERSION_TAG)
  228. : $(name) : $(type) : $(property-set) ] ;
  229. # Optionally add version suffix.
  230. # On NT, library with version suffix won't be recognized
  231. # by linkers. On CYGWIN, we get strage duplicate symbol
  232. # errors when library is generated with version suffix.
  233. # On OSX, version suffix is not needed -- the linker expets
  234. # libFoo.1.2.3.dylib format.
  235. # AIX linkers don't accept version suffixes either.
  236. if $(type) = SHARED_LIB &&
  237. ! ( [ $(property-set).get <target-os> ] in windows cygwin darwin aix )
  238. {
  239. result = $(result).$(BOOST_VERSION) ;
  240. }
  241. return $(result) ;
  242. }
  243. else
  244. {
  245. return [ common.format-name
  246. boost_ <base> <toolset> <threading> <runtime>
  247. : $(name) : $(type) : $(property-set) ] ;
  248. }
  249. }
  250. }
  251. # Install to system location.
  252. local headers =
  253. [ path.glob-tree boost : *.hpp *.ipp *.h *.inc : CVS ]
  254. [ path.glob-tree boost/compatibility/cpp_c_headers : c* : CVS ]
  255. ;
  256. local header-subdir ;
  257. if $(layout-versioned) { header-subdir = boost-$(BOOST_VERSION_TAG)/boost ; }
  258. else { header-subdir = boost ; }
  259. # Complete install
  260. package.install install
  261. : <install-source-root>boost
  262. <install-header-subdir>$(header-subdir)
  263. :
  264. : libs/$(libraries)/build
  265. : $(headers)
  266. ;
  267. # Install just library.
  268. install stage
  269. : libs/$(libraries)/build
  270. : <location>$(stage-locate)
  271. <install-dependencies>on <install-type>LIB
  272. ;
  273. # Just build the libraries, don't install them anywhere.
  274. # This is what happend with just "bjam --v2".
  275. alias build_all : libs/$(libraries)/build ;
  276. # This rule should be called from libraries' Jamfiles and will
  277. # create two targets, "install" and "stage", that will install
  278. # or stage that library. The --prefix option is respected, by
  279. # --with and --without options, naturally, are ignored.
  280. #
  281. # - libraries -- list of library targets to install.
  282. rule boost-install ( libraries * )
  283. {
  284. package.install install
  285. : <dependency>/boost//install-headers
  286. : # No binaries
  287. : $(libraries)
  288. : # No headers, it's handled by the dependency
  289. ;
  290. install stage : $(libraries) : <location>$(BOOST_STAGE_LOCATE) ;
  291. local c = [ project.current ] ;
  292. local project-module = [ $(c).project-module ] ;
  293. module $(project-module)
  294. {
  295. explicit stage ;
  296. }
  297. }
  298. # Make project ids of all libraries known.
  299. for local l in $(libraries)
  300. {
  301. use-project /boost/$(l) : libs/$(l)/build ;
  302. }
粤ICP备19079148号