Jamfile.v2 9.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289
  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. # On NT, library with version suffix won't be recognized
  110. # by linkers. On CYGWIN, we get strage duplicate symbol
  111. # errors when library is generated with version suffix.
  112. # On OSX, version suffix is not needed -- the linker expets
  113. # libFoo.1.2.3.dylib format.
  114. # AIX linkers don't accept version suffixes either.
  115. if [ $(property-set).get <os> ] in NT CYGWIN MACOSX AIX
  116. {
  117. return $(name:B)-$(version-tag)$(name:S) ;
  118. }
  119. else
  120. {
  121. return $(name:B)-$(version-tag)$(name:S).$(BOOST_VERSION) ;
  122. }
  123. }
  124. else
  125. {
  126. return [ stage.add-variant-and-compiler $(name)
  127. : $(type) : $(property-set) ] ;
  128. }
  129. }
  130. }
  131. # Install to system location.
  132. local patterns = *.hpp *.ipp *.h *.inc ;
  133. local dirs = boost boost/* boost/*/* ;
  134. # Complete install
  135. package.install install
  136. : <install-source-root>. # No specific requirements
  137. : # No binaries
  138. : libs/$(libraries)/build
  139. : [ glob $(dirs)/$(patterns) ]
  140. ;
  141. # Install just library.
  142. install stage : libs/$(libraries)/build
  143. : <location>$(stage-locate)
  144. ;
  145. # Just build the libraries, don't install them anywhere.
  146. # This is what happend with just "bjam --v2".
  147. alias build_all : libs/$(libraries)/build ;
  148. # This rule should be called from libraries' Jamfiles and will
  149. # create two targets, "install" and "stage", that will install
  150. # or stage that library. The --prefix option is respected, by
  151. # --with and --without options, naturally, are ignored.
  152. #
  153. # - libraries -- list of library targets to install.
  154. rule boost-install ( libraries * )
  155. {
  156. package.install install
  157. : <dependency>/boost//install-headers
  158. : # No binaries
  159. : $(libraries)
  160. : # No headers, it's handled by the dependency
  161. ;
  162. install stage : $(libraries) : <location>$(BOOST_STAGE_LOCATE) ;
  163. local c = [ project.current ] ;
  164. local project-module = [ $(c).project-module ] ;
  165. module $(project-module)
  166. {
  167. explicit stage ;
  168. }
  169. }
  170. # Make project ids of all libraries known.
  171. for local l in $(libraries)
  172. {
  173. use-project /boost/$(l) : libs/$(l)/build ;
  174. }
  175. constant project-help : "
  176. Usage:
  177. bjam [options] [install|stage]
  178. * install Installs to the configured location(s).
  179. * stage Stages the build products only to common stage
  180. location.
  181. Options:
  182. --help This message.
  183. -sTOOLS=<toolsets> Indicates the tools to build with.
  184. --show-libraries Displays the list of Boost libraries that require
  185. build and installation steps, then exit.
  186. --layout=<layout> Determines what kind of build layout to use. This
  187. allows one to control the naming of the resulting
  188. libraries, and the locations of the installed
  189. files. Default is 'versioned'. Possible values:
  190. versioned - Uses the Boost standard names
  191. which include version number for Boost the
  192. release and version and name of the
  193. compiler as part of the library names. Also
  194. installs the includes to a versioned
  195. sub-directory.
  196. system - Builds an install without the
  197. Boost standard names, and does not install
  198. includes to a versioned sub-directory. This
  199. is intended for system integrators to build
  200. for packaging of distributions.
  201. Locations:
  202. --prefix=PREFIX Install architecture independent files here.
  203. Default; C:\\Boost on Win32
  204. Default; /usr/local on Unix. Linux, etc.
  205. --exec-prefix=EPREFIX Install architecture dependent files here.
  206. Default; PREFIX
  207. --libdir=DIR Install libraries here.
  208. Default; EPREFIX/lib
  209. --includedir=DIR Install source headers here.
  210. Default; PREFIX/include
  211. --builddir=DIR Build in this location instead of building
  212. within the distribution tree. Recommended!
  213. --stagedir=DIR When staging only, stage to the location.
  214. Default; ./stage
  215. Features:
  216. --with-<library> Build, stage, or install the specified <library>
  217. If used, the default becomes to only build
  218. indicated libraries.
  219. --without-<library> Do not build, stage, or install the specified
  220. <library>. By default all libraries attempt to
  221. build.
  222. --with-python-root[=PYTHON_ROOT]
  223. Build Boost.Python libraries with the Python
  224. devel packages located at PYTHON_ROOT.
  225. Default PYTHON_ROOT; C:\\Python24 on Win32.
  226. Default PYTHON_ROOT; /usr on Unix, Linux, Cygwin, etc.
  227. --with-python-version[=2.4]
  228. Build Boost.Python libraries with the Python
  229. version indicated.
  230. Default; 2.4.
  231. --with-pydebug Build Boost.Python libraries using the
  232. Python debug runtime.
  233. " ;
粤ICP备19079148号