From b414ada8439511587cf8fe795f8f60f5df7482db Mon Sep 17 00:00:00 2001 From: Andrey Semashev Date: Thu, 20 Apr 2017 23:52:13 +0300 Subject: [PATCH] Fix mpi-python component compilation. Made mpi-python compilation and naming consistent with Boost.Python: - Add property requirement to the components dependent on Python. This ensures that Boost.Build passes include and library paths for the selected Python version while building these components. This fixes the build error of pyconfig.h not found. - Add property handling, to follow Boost.Python practice. This should ensure that correct Python headers and library are used by Boost.Python depending on this property. - Add suffix 3 to the library name when compiled against Python 3.x. This follows Boost.Python practice. The MPI plugin for Python is still named mpi (without suffix) as it may be visible to python programs. Users are expected to build into separate directories when plugins for different Python versions are required. --- build/Jamfile.v2 | 127 ++++++++++++++++++++++++++++++++++--------------------- 1 file changed, 79 insertions(+), 48 deletions(-) diff --git a/build/Jamfile.v2 b/build/Jamfile.v2 index 5a1a54f..827e1d2 100644 --- a/build/Jamfile.v2 +++ b/build/Jamfile.v2 @@ -21,8 +21,8 @@ project boost/mpi : source-location ../src ; -lib boost_mpi - : +lib boost_mpi + : broadcast.cpp cartesian_communicator.cpp communicator.cpp @@ -55,55 +55,86 @@ lib boost_mpi ../../serialization/build//boost_serialization /mpi//mpi [ mpi.extra-requirements ] ; - -libraries += boost_mpi ; + +libraries += boost_mpi ; if [ python.configured ] { - lib boost_mpi_python - : # Sources - python/serialize.cpp - : # Requirements - boost_mpi - /mpi//mpi [ mpi.extra-requirements ] - /boost/python//boost_python - shared:BOOST_MPI_DYN_LINK=1 - shared:BOOST_MPI_PYTHON_DYN_LINK=1 - shared:BOOST_PYTHON_DYN_LINK=1 - BOOST_MPI_PYTHON_SOURCE=1 - -@$(BOOST_JAMROOT_MODULE)%$(BOOST_JAMROOT_MODULE).tag - @$(BOOST_JAMROOT_MODULE)%$(BOOST_JAMROOT_MODULE).python-tag - : # Default build - shared - : # Usage requirements - /mpi//mpi [ mpi.extra-requirements ] - ; - libraries += boost_mpi_python ; - - 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 - /boost/python//boost_python - boost_mpi_python - boost_mpi - /mpi//mpi [ mpi.extra-requirements ] - shared:BOOST_MPI_DYN_LINK=1 - shared:BOOST_MPI_PYTHON_DYN_LINK=1 - shared:BOOST_PYTHON_DYN_LINK=1 - shared shared - ; + py2-version = [ py-version 2 ] ; + py3-version = [ py-version 3 ] ; + + # These library names are synchronized with those defined by Boost.Python, see libs/python/build/Jamfile. + lib_boost_python(2) = boost_python ; + lib_boost_python(3) = boost_python3 ; + + lib_boost_python($(py2-version)) = $(lib_boost_python(2)) ; + lib_boost_python($(py3-version)) = $(lib_boost_python(3)) ; + + lib_boost_mpi_python(2) = boost_mpi_python ; + lib_boost_mpi_python(3) = boost_mpi_python3 ; + + lib_boost_mpi_python($(py2-version)) = $(lib_boost_mpi_python(2)) ; + lib_boost_mpi_python($(py3-version)) = $(lib_boost_mpi_python(3)) ; + + for local N in 2 3 + { + if $(py$(N)-version) + { + lib $(lib_boost_mpi_python($(py$(N)-version))) + : # Sources + python/serialize.cpp + : # Requirements + boost_mpi + /mpi//mpi [ mpi.extra-requirements ] + /boost/python//$(lib_boost_python($(py$(N)-version))) + shared:BOOST_MPI_DYN_LINK=1 + shared:BOOST_MPI_PYTHON_DYN_LINK=1 + shared:BOOST_PYTHON_DYN_LINK=1 + BOOST_MPI_PYTHON_SOURCE=1 + -@$(BOOST_JAMROOT_MODULE)%$(BOOST_JAMROOT_MODULE).tag + @$(BOOST_JAMROOT_MODULE)%$(BOOST_JAMROOT_MODULE).python-tag + on:BOOST_DEBUG_PYTHON + $(py$(N)-version) + : # Default build + shared + : # Usage requirements + /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 + /boost/python//$(lib_boost_python($(py$(N)-version))) + $(lib_boost_mpi_python($(py$(N)-version))) + boost_mpi + /mpi//mpi [ mpi.extra-requirements ] + shared:BOOST_MPI_DYN_LINK=1 + shared:BOOST_MPI_PYTHON_DYN_LINK=1 + shared:BOOST_PYTHON_DYN_LINK=1 + shared shared + on:BOOST_DEBUG_PYTHON + $(py$(N)-version) + ; + + libraries += $(lib_boost_mpi_python($(py$(N)-version))) ; + } + else + { + alias $(lib_boost_mpi_python($(N))) ; + } + } } } else if ! ( --without-mpi in [ modules.peek : ARGV ] )