Jamfile.v2 5.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177
  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.33.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. # Decides which libraries are to be installed by looking at --with-<library>
  27. # --without-<library> arguments. Returns the list of directories under "libs"
  28. # which must be built at installed.
  29. rule libraries-to-install ( existing-libraries * )
  30. {
  31. local argv = [ modules.peek : ARGV ] ;
  32. local with-parameter = [ MATCH --with-(.*) : $(argv) ] ;
  33. local without-parameter = [ MATCH --without-(.*) : $(argv) ] ;
  34. # Do some checks
  35. if $(with-parameter) && $(without-parameter)
  36. {
  37. ECHO "error: both --with-<library> and --without-<library> specified" ;
  38. EXIT ;
  39. }
  40. local wrong = [ set.difference $(with-parameter) : $(existing-libraries) ] ;
  41. if $(wrong)
  42. {
  43. ECHO "error: wrong library name '$(wrong[1])' in the --with-<library> option." ;
  44. EXIT ;
  45. }
  46. local wrong = [ set.difference $(without-parameter) : $(existing-libraries) ] ;
  47. if $(wrong)
  48. {
  49. ECHO "error: wrong library name '$(wrong[1])' in the --without-<library> option." ;
  50. EXIT ;
  51. }
  52. if $(with-parameter)
  53. {
  54. return [ set.intersection $(existing-libraries) : $(with-parameter) ] ;
  55. }
  56. else
  57. {
  58. return [ set.difference $(existing-libraries) : $(without-parameter) ] ;
  59. }
  60. }
  61. # what kind of layout are we doing?
  62. layout = [ MATCH "^--layout=(.*)" : $(ARGV) ] ;
  63. layout ?= versioned ;
  64. layout-$(layout) = true ;
  65. # possible stage only location
  66. local stage-locate = [ MATCH "^--stagedir=(.*)" : $(ARGV) ] ;
  67. stage-locate ?= stage ;
  68. path-constant BOOST_STAGE_LOCATE : $(stage-locate) ;
  69. # location of python
  70. local python-root = [ MATCH "^--with-python-root=(.*)" : $(ARGV) ] ;
  71. PYTHON_ROOT ?= $(python-root) ;
  72. # Select the libraries to install.
  73. libraries = [ MATCH .*libs/(.*)/build/.* : [ glob libs/*/build/Jamfile.v2 ] ] ;
  74. libraries = [ libraries-to-install $(libraries) ] ;
  75. # This rule is called by Boost.Build to determine the name of
  76. # target. We use it to encode build variant, compiler name and
  77. # boost version in the target name
  78. rule tag ( name : type ? : property-set )
  79. {
  80. if $(type) in STATIC_LIB SHARED_LIB IMPORT_LIB
  81. {
  82. if $(layout) = versioned
  83. {
  84. name = [ stage.add-variant-and-compiler $(name)
  85. : $(type) : $(property-set) ] ;
  86. local version-tag = [ MATCH "^([^.]+)[.]([^.]+)" : $(BOOST_VERSION[1]) ] ;
  87. version-tag = $(version-tag:J="_") ;
  88. # On NT, library with version suffix won't be recognized
  89. # by linkers. On CYGWIN, we get strage duplicate symbol
  90. # errors when library is generated with version suffix.
  91. # On OSX, version suffix is not needed -- the linker expets
  92. # libFoo.1.2.3.dylib format.
  93. # AIX linkers don't accept version suffixes either.
  94. if [ $(property-set).get <os> ] in NT CYGWIN MACOSX AIX
  95. {
  96. return $(name:B)-$(version-tag)$(name:S) ;
  97. }
  98. else
  99. {
  100. return $(name:B)-$(version-tag)$(name:S).$(BOOST_VERSION) ;
  101. }
  102. }
  103. else
  104. {
  105. return [ stage.add-variant-and-compiler $(name)
  106. : $(type) : $(property-set) ] ;
  107. }
  108. }
  109. }
  110. # Install to system location.
  111. local patterns = *.hpp *.ipp *.h *.inc ;
  112. local dirs = boost boost/* boost/*/* ;
  113. # Complete install
  114. package.install install
  115. : <install-source-root>. # No specific requirements
  116. : # No binaries
  117. : libs/$(libraries)/build
  118. : [ glob $(dirs)/$(patterns) ]
  119. ;
  120. # Install just library.
  121. install stage : libs/$(libraries)/build
  122. : <location>$(stage-locate)
  123. ;
  124. # Just build the libraries, don't install them anywhere.
  125. # This is what happend with just "bjam --v2".
  126. alias build_all : libs/$(libraries)/build ;
  127. # This rule should be called from libraries' Jamfiles and will
  128. # create two targets, "install" and "stage", that will install
  129. # or stage that library. The --prefix option is respected, by
  130. # --with and --without options, naturally, are ignored.
  131. #
  132. # - libraries -- list of library targets to install.
  133. rule boost-install ( libraries * )
  134. {
  135. package.install install
  136. : <dependency>/boost//install-headers
  137. : # No binaries
  138. : $(libraries)
  139. : # No headers, it's handled by the dependency
  140. ;
  141. install stage : $(libraries) : <location>$(BOOST_STAGE_LOCATE) ;
  142. }
  143. # Make project ids of all libraries known.
  144. for local l in $(libraries)
  145. {
  146. use-project /boost/$(l) : libs/$(l)/build ;
  147. }
粤ICP备19079148号