Jamfile.v2 10.0 KB

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