Jamfile.v2 9.5 KB

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