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