Jamfile.v2 5.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190
  1. # Copyright (C) 2005, 2006 The Trustees of Indiana University.
  2. # Copyright (C) 2005 Douglas Gregor <doug.gregor -at- gmail.com>
  3. # Copyright (c) 2018 Stefan Seefeld
  4. # Use, modification and distribution is subject to the Boost Software
  5. # License, Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at
  6. # http://www.boost.org/LICENSE_1_0.txt)
  7. # Authors: Douglas Gregor
  8. # Andrew Lumsdaine
  9. import mpi ;
  10. import indirect ;
  11. import python ;
  12. import option ;
  13. import regex ;
  14. #
  15. # The `version-suffix` rule really belongs into python.jam, and
  16. # should be moved there. `split-version` is only duplicated here
  17. # as a prerequisite. (See https://github.com/boostorg/build/pull/290)
  18. #
  19. # Validate the version string and extract the major/minor part we care about.
  20. #
  21. local rule split-version ( version )
  22. {
  23. local major-minor = [ MATCH "^([0-9]+)\.([0-9]+)(.*)$" : $(version) : 1 2 3 ] ;
  24. if ! $(major-minor[2]) || $(major-minor[3])
  25. {
  26. ECHO "Warning: \"using python\" expects a two part (major, minor) version number; got" $(version) instead ;
  27. # Add a zero to account for the missing digit if necessary.
  28. major-minor += 0 ;
  29. }
  30. return $(major-minor[1]) $(major-minor[2]) ;
  31. }
  32. # Define a version suffix for libraries depending on Python.
  33. # For example, Boost.Python built for Python 2.7 uses the suffix "27"
  34. rule version-suffix ( version )
  35. {
  36. local major-minor = [ split-version $(version) ] ;
  37. local suffix = $(major-minor:J="") ;
  38. return $(suffix) ;
  39. }
  40. # Python build id (for Python libraries only).
  41. python-id = [ option.get "python-buildid" ] ;
  42. if $(python-id)
  43. {
  44. PYTHON_ID = [ regex.replace $(python-id) "[*\\/:.\"\']" _ ] ;
  45. }
  46. rule python-tag ( name : type ? : property-set )
  47. {
  48. local result = $(name) ;
  49. if $(type) in STATIC_LIB SHARED_LIB IMPORT_LIB
  50. {
  51. local version = [ $(property-set).get <python> ] ;
  52. local lib-suffix = [ version-suffix $(version) ] ;
  53. result = $(result)$(lib-suffix) ;
  54. }
  55. if $(type) in STATIC_LIB SHARED_LIB IMPORT_LIB && $(PYTHON_ID)
  56. {
  57. result = $(result)-$(PYTHON_ID) ;
  58. }
  59. # forward to the boost tagging rule
  60. return [ tag $(result) : $(type) : $(property-set) ] ;
  61. }
  62. mpi_python_libs = ;
  63. if [ mpi.configured ]
  64. {
  65. project boost/mpi
  66. : source-location ../src
  67. ;
  68. lib boost_mpi
  69. :
  70. broadcast.cpp
  71. cartesian_communicator.cpp
  72. communicator.cpp
  73. computation_tree.cpp
  74. content_oarchive.cpp
  75. environment.cpp
  76. error_string.cpp
  77. exception.cpp
  78. graph_communicator.cpp
  79. group.cpp
  80. intercommunicator.cpp
  81. mpi_datatype_cache.cpp
  82. mpi_datatype_oarchive.cpp
  83. packed_iarchive.cpp
  84. packed_oarchive.cpp
  85. packed_skeleton_iarchive.cpp
  86. packed_skeleton_oarchive.cpp
  87. point_to_point.cpp
  88. request.cpp
  89. text_skeleton_oarchive.cpp
  90. timer.cpp
  91. offsets.cpp
  92. : # Requirements
  93. <library>../../serialization/build//boost_serialization
  94. <library>/mpi//mpi [ mpi.extra-requirements ]
  95. <define>BOOST_MPI_SOURCE=1
  96. <link>shared:<define>BOOST_MPI_DYN_LINK=1
  97. <local-visibility>global
  98. : # Default build
  99. <link>shared
  100. : # Usage requirements
  101. <library>../../serialization/build//boost_serialization
  102. <library>/mpi//mpi [ mpi.extra-requirements ]
  103. ;
  104. if [ python.configured ]
  105. {
  106. lib boost_mpi_python
  107. : # Sources
  108. python/serialize.cpp
  109. : # Requirements
  110. <library>boost_mpi
  111. <library>/mpi//mpi [ mpi.extra-requirements ]
  112. <library>/boost/python//boost_python
  113. <link>shared:<define>BOOST_MPI_DYN_LINK=1
  114. <link>shared:<define>BOOST_MPI_PYTHON_DYN_LINK=1
  115. <link>shared:<define>BOOST_PYTHON_DYN_LINK=1
  116. <define>BOOST_MPI_PYTHON_SOURCE=1
  117. <python-debugging>on:<define>BOOST_DEBUG_PYTHON
  118. -<tag>@$(BOOST_JAMROOT_MODULE)%$(BOOST_JAMROOT_MODULE).tag
  119. <tag>@$(__name__).python-tag
  120. <conditional>@python.require-py
  121. <local-visibility>global
  122. : # Default build
  123. <link>shared
  124. : # Usage requirements
  125. <library>/mpi//mpi [ mpi.extra-requirements ]
  126. ;
  127. python-extension mpi
  128. : # Sources
  129. python/collectives.cpp
  130. python/py_communicator.cpp
  131. python/datatypes.cpp
  132. python/documentation.cpp
  133. python/py_environment.cpp
  134. python/py_nonblocking.cpp
  135. python/py_exception.cpp
  136. python/module.cpp
  137. python/py_request.cpp
  138. python/skeleton_and_content.cpp
  139. python/status.cpp
  140. python/py_timer.cpp
  141. : # Requirements
  142. <library>/boost/python//boost_python
  143. <library>boost_mpi_python
  144. <library>boost_mpi
  145. <library>/mpi//mpi [ mpi.extra-requirements ]
  146. <link>shared:<define>BOOST_MPI_DYN_LINK=1
  147. <link>shared:<define>BOOST_MPI_PYTHON_DYN_LINK=1
  148. <link>shared:<define>BOOST_PYTHON_DYN_LINK=1
  149. <link>shared <runtime-link>shared
  150. <python-debugging>on:<define>BOOST_DEBUG_PYTHON
  151. ;
  152. mpi_python_libs = boost_mpi_python mpi ;
  153. }
  154. }
  155. else if ! ( --without-mpi in [ modules.peek : ARGV ] )
  156. {
  157. message boost_mpi
  158. : "warning: skipping optional Message Passing Interface (MPI) library."
  159. : "note: to enable MPI support, add \"using mpi ;\" to user-config.jam."
  160. : "note: to suppress this message, pass \"--without-mpi\" to bjam."
  161. : "note: otherwise, you can safely ignore this message."
  162. ;
  163. }
  164. else
  165. {
  166. alias boost_mpi ;
  167. }
  168. boost-install boost_mpi $(mpi_python_libs) ;