summaryrefslogtreecommitdiffstats
path: root/src/boost/libs/mpi/build/Jamfile.v2
blob: 1f42346387991d15694949a424b40a2243d44f1d (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
# Copyright (C) 2005, 2006 The Trustees of Indiana University.
# Copyright (C) 2005 Douglas Gregor <doug.gregor -at- gmail.com>
# Copyright (c) 2018 Stefan Seefeld

# Use, modification and distribution is subject to the Boost Software
# License, Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at
# http://www.boost.org/LICENSE_1_0.txt)

#  Authors: Douglas Gregor
#           Andrew Lumsdaine

import mpi ;
import indirect ;
import python ;
import option ;
import regex ;

#
# The `version-suffix` rule really belongs into python.jam, and
# should be moved there. `split-version` is only duplicated here
# as a prerequisite. (See https://github.com/boostorg/build/pull/290)
#


# Validate the version string and extract the major/minor part we care about.
#
local rule split-version ( version )
{
    local major-minor = [ MATCH "^([0-9]+)\.([0-9]+)(.*)$" : $(version) : 1 2 3 ] ;
    if ! $(major-minor[2]) || $(major-minor[3])
    {
        ECHO "Warning: \"using python\" expects a two part (major, minor) version number; got" $(version) instead ;

        # Add a zero to account for the missing digit if necessary.
        major-minor += 0 ;
    }

    return $(major-minor[1]) $(major-minor[2]) ;
}

# Define a version suffix for libraries depending on Python.
# For example, Boost.Python built for Python 2.7 uses the suffix "27"
rule version-suffix ( version )
{
    local major-minor = [ split-version $(version) ] ;
    local suffix = $(major-minor:J="") ;
    return $(suffix) ;
}


# Python build id (for Python libraries only).
python-id = [ option.get "python-buildid" ] ;
if $(python-id)
{
    PYTHON_ID = [ regex.replace $(python-id) "[*\\/:.\"\']" _ ] ;
}

rule python-tag ( name : type ? : property-set )
{
    local result = $(name) ;
    if $(type) in STATIC_LIB SHARED_LIB IMPORT_LIB
    {
        local version = [ $(property-set).get <python> ] ;
        local lib-suffix = [ version-suffix $(version) ] ;
        result = $(result)$(lib-suffix) ;
    }
    if $(type) in STATIC_LIB SHARED_LIB IMPORT_LIB && $(PYTHON_ID)
    {
        result = $(result)-$(PYTHON_ID) ;
    }

    # forward to the boost tagging rule
    return  [ tag $(result) : $(type) : $(property-set) ] ;
}

mpi_python_libs = ;

if [ mpi.configured ]
{

project boost/mpi
  : source-location ../src
  ;

lib boost_mpi
  :
    broadcast.cpp
    cartesian_communicator.cpp
    communicator.cpp
    computation_tree.cpp
    content_oarchive.cpp
    environment.cpp
    error_string.cpp
    exception.cpp
    graph_communicator.cpp
    group.cpp
    intercommunicator.cpp
    mpi_datatype_cache.cpp
    mpi_datatype_oarchive.cpp
    packed_iarchive.cpp
    packed_oarchive.cpp
    packed_skeleton_iarchive.cpp
    packed_skeleton_oarchive.cpp
    point_to_point.cpp
    request.cpp
    text_skeleton_oarchive.cpp
    timer.cpp
    offsets.cpp
  : # Requirements
    <library>../../serialization/build//boost_serialization
    <library>/mpi//mpi [ mpi.extra-requirements ]
    <define>BOOST_MPI_SOURCE=1
    <link>shared:<define>BOOST_MPI_DYN_LINK=1
    <local-visibility>global
  : # Default build
    <link>shared
  : # Usage requirements
    <library>../../serialization/build//boost_serialization
    <library>/mpi//mpi [ mpi.extra-requirements ]
  ;

  if [ python.configured ]
  {
            lib boost_mpi_python
              : # Sources
                python/serialize.cpp
              : # Requirements
                <library>boost_mpi
                <library>/mpi//mpi [ mpi.extra-requirements ]
                <library>/boost/python//boost_python
                <link>shared:<define>BOOST_MPI_DYN_LINK=1
                <link>shared:<define>BOOST_MPI_PYTHON_DYN_LINK=1
                <link>shared:<define>BOOST_PYTHON_DYN_LINK=1
                <define>BOOST_MPI_PYTHON_SOURCE=1
                <python-debugging>on:<define>BOOST_DEBUG_PYTHON
                -<tag>@$(BOOST_JAMROOT_MODULE)%$(BOOST_JAMROOT_MODULE).tag
                <tag>@$(__name__).python-tag
                <conditional>@python.require-py
                <local-visibility>global

              : # Default build
                <link>shared
              : # Usage requirements
                <library>/mpi//mpi [ mpi.extra-requirements ]
              ;

            python-extension mpi
              : # Sources
                python/collectives.cpp
                python/py_communicator.cpp
                python/datatypes.cpp
                python/documentation.cpp
                python/py_environment.cpp
                python/py_nonblocking.cpp
                python/py_exception.cpp
                python/module.cpp
                python/py_request.cpp
                python/skeleton_and_content.cpp
                python/status.cpp
                python/py_timer.cpp
              : # Requirements
                <library>/boost/python//boost_python
                <library>boost_mpi_python
                <library>boost_mpi
                <library>/mpi//mpi [ mpi.extra-requirements ]
                <link>shared:<define>BOOST_MPI_DYN_LINK=1
                <link>shared:<define>BOOST_MPI_PYTHON_DYN_LINK=1
                <link>shared:<define>BOOST_PYTHON_DYN_LINK=1
                <link>shared <runtime-link>shared
                <python-debugging>on:<define>BOOST_DEBUG_PYTHON
              ;

            mpi_python_libs = boost_mpi_python mpi ;
  }
}
else if ! ( --without-mpi in  [ modules.peek : ARGV ] )
{
  message boost_mpi   
      : "warning: skipping optional Message Passing Interface (MPI) library."
      : "note: to enable MPI support, add \"using mpi ;\" to user-config.jam."
      : "note: to suppress this message, pass \"--without-mpi\" to bjam."
      : "note: otherwise, you can safely ignore this message." 
      ;
}
else
{
  alias boost_mpi ;
}

boost-install boost_mpi $(mpi_python_libs) ;