Jamfile.v2 3.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154
  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. project boost
  13. : requirements <include>$(BOOST_ROOT)
  14. # disable auto-linking for all targets here,
  15. # primarily because it caused troubles with V2
  16. <define>BOOST_ALL_NO_LIB=1
  17. <tag>@stage.add-variant
  18. : usage-requirements <include>$(BOOST_ROOT)
  19. : build-dir bin.v2
  20. ;
  21. # The code hereselects the libraries that must be built and builds
  22. # and creates two targets:
  23. # 'stage', which builds only libraries and placed them in one location
  24. # 'install', which places both libraries and headers in system location
  25. rule libraries-to-install ( existing-libraries * )
  26. {
  27. local argv = [ modules.peek : ARGV ] ;
  28. local with-parameter = [ MATCH --with-(.*) : $(argv) ] ;
  29. local without-parameter = [ MATCH --without-(.*) : $(argv) ] ;
  30. # Do some checks
  31. if $(with-parameter) && $(without-parameter)
  32. {
  33. ECHO "error: both --with-<library> and --without-<library> specified" ;
  34. EXIT ;
  35. }
  36. local wrong = [ set.difference $(with-parameter) : $(existing-libraries) ] ;
  37. if $(wrong)
  38. {
  39. ECHO "error: wrong library name '$(wrong[1])' in the --with-<library> option." ;
  40. EXIT ;
  41. }
  42. local wrong = [ set.difference $(without-parameter) : $(existing-libraries) ] ;
  43. if $(wrong)
  44. {
  45. ECHO "error: wrong library name '$(wrong[1])' in the --without-<library> option." ;
  46. EXIT ;
  47. }
  48. if $(with-parameter)
  49. {
  50. return [ set.intersection $(existing-libraries) : $(with-parameter) ] ;
  51. }
  52. else
  53. {
  54. return [ set.difference $(existing-libraries) : $(without-parameter) ] ;
  55. }
  56. }
  57. # The following is a copy of V1 logic. We don't yet support
  58. # selecting versioned/unversioned install and changing the build
  59. # directory.
  60. ARGV = [ modules.peek : ARGV ] ;
  61. # what kind of layout are we doing?
  62. local 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. # architecture independent files
  69. local boost-locate ;
  70. if ! $(with-stage)
  71. {
  72. boost-locate = [ MATCH "^--prefix=(.*)" : $(ARGV) ] ;
  73. }
  74. else
  75. {
  76. boost-locate = $(stage-locate) ;
  77. }
  78. if [ modules.peek : NT ] { boost-locate ?= C:\\Boost ; }
  79. else if [ modules.peek : UNIX ] { boost-locate ?= /usr/local ; }
  80. # architecture dependent files
  81. local exec-locate = [ MATCH "^--exec-prefix=(.*)" : $(ARGV) ] ;
  82. exec-locate ?= $(boost-locate) ;
  83. # object code libraries
  84. local lib-locate = [ MATCH "^--libdir=(.*)" : $(ARGV) ] ;
  85. lib-locate ?= $(exec-locate)/lib ;
  86. # where to build
  87. local all-locate = [ MATCH "^--builddir=(.*)" : $(ARGV) ] ;
  88. ALL_LOCATE_TARGET ?= $(all-locate) ;
  89. # source header files
  90. local include-locate = [ MATCH "^--includedir=(.*)" : $(ARGV) ] ;
  91. include-locate ?= $(boost-locate)/include ;
  92. # location of python
  93. local python-root = [ MATCH "^--with-python-root=(.*)" : $(ARGV) ] ;
  94. PYTHON_ROOT ?= $(python-root) ;
  95. # Select the libraries to install.
  96. libraries = [ MATCH .*libs/(.*)/build/.* : [ glob libs/*/build/Jamfile.v2 ] ] ;
  97. libraries = [ libraries-to-install $(libraries) ] ;
  98. local rename-rule ;
  99. if $(layout) = versioned
  100. {
  101. rename-rule = stage.add-variant-and-compiler ;
  102. }
  103. else
  104. {
  105. rename-rule = stage.add-variant ;
  106. }
  107. # Install to system location.
  108. alias install : install-libs install-headers ;
  109. stage install-libs : libs/$(libraries)/build
  110. : <so-version>1.32.0
  111. <location>$(lib-locate)
  112. ;
  113. stage install-headers :
  114. [ glob boost/compatibility/cpp_c_headers/c* ]
  115. [ glob boost/*.hpp boost/*/*.hpp *.ipp *.h *.inc ]
  116. :
  117. <location>$(include-locate)
  118. ;
  119. # Install just library.
  120. stage stage : libs/$(libraries)/build
  121. : <so-version>1.32.0
  122. <location>$(stage-locate)
  123. ;
  124. explicit install install-libs install-headers stage ;
粤ICP备19079148号