From 409ea7b90afff7bc09f24ffe053e5d34200ed4fb Mon Sep 17 00:00:00 2001 From: Rene Rivera Date: Mon, 11 Mar 2024 08:38:17 -0500 Subject: [PATCH] Make the library modular usable. --- build.jam | 40 ++++++++++++++++++++++++++++++ build/Jamfile.v2 | 63 +++++++++++++++++++++++++----------------------- test/Jamfile.v2 | 8 +++++- 3 files changed, 80 insertions(+), 31 deletions(-) create mode 100644 build.jam diff --git a/build.jam b/build.jam new file mode 100644 index 0000000..6ea1c71 --- /dev/null +++ b/build.jam @@ -0,0 +1,40 @@ +# Copyright René Ferdinand Rivera Morell 2024 +# Distributed under 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) + +import project ; + +project /boost/mpi + : common-requirements + /boost/assert//boost_assert + /boost/config//boost_config + /boost/core//boost_core + /boost/foreach//boost_foreach + /boost/function//boost_function + /boost/graph//boost_graph + /boost/integer//boost_integer + /boost/iterator//boost_iterator + /boost/lexical_cast//boost_lexical_cast + /boost/mpl//boost_mpl + /boost/optional//boost_optional + /boost/python//boost_python + /boost/serialization//boost_serialization + /boost/smart_ptr//boost_smart_ptr + /boost/static_assert//boost_static_assert + /boost/throw_exception//boost_throw_exception + /boost/type_traits//boost_type_traits + /boost/utility//boost_utility + include + ; + +explicit + [ alias boost_mpi : build//boost_mpi ] + [ alias boost_mpi_python : build//boost_mpi_python ] + [ alias mpi : build//mpi ] + [ alias all : boost_mpi boost_mpi_python mpi test ] + ; + +call-if : boost-library mpi + : install boost_mpi boost_mpi_python mpi + ; diff --git a/build/Jamfile.v2 b/build/Jamfile.v2 index abfba37..967c5f0 100644 --- a/build/Jamfile.v2 +++ b/build/Jamfile.v2 @@ -15,19 +15,18 @@ 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) -# - - -mpi_python_libs = ; +rule tag ( name : type ? : property-set ) +{ + if python-tag in [ RULENAMES $(__name__) ] + { + return [ $(__name__).python-tag $(name) : $(type) : $(property-set) ] ; + } +} if [ mpi.configured ] { -project boost/mpi +project : source-location ../src ; @@ -57,7 +56,7 @@ lib boost_mpi text_skeleton_oarchive.cpp timer.cpp : # Requirements - ../../serialization/build//boost_serialization + /boost/serialization//boost_serialization /mpi//mpi [ mpi.extra-requirements ] BOOST_MPI_SOURCE=1 shared:BOOST_MPI_DYN_LINK=1 @@ -65,12 +64,12 @@ lib boost_mpi : # Default build shared : # Usage requirements - ../../serialization/build//boost_serialization + /boost/serialization//boost_serialization /mpi//mpi [ mpi.extra-requirements ] ; - if [ python.configured ] - { + if [ python.configured ] + { lib boost_mpi_python : # Sources python/serialize.cpp @@ -84,8 +83,8 @@ lib boost_mpi shared:BOOST_PYTHON_DYN_LINK=1 BOOST_MPI_PYTHON_SOURCE=1 on:BOOST_DEBUG_PYTHON - -@$(BOOST_JAMROOT_MODULE)%$(BOOST_JAMROOT_MODULE).tag - @python-tag + -@%boostcpp.tag + @tag @python.require-py global @@ -93,6 +92,7 @@ lib boost_mpi shared : # Usage requirements /mpi//mpi [ mpi.extra-requirements ] + /python//python ; python-extension mpi @@ -120,22 +120,25 @@ lib boost_mpi shared shared on: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_python ; + alias mpi ; + } } else { - alias boost_mpi ; + 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 b2." + : "note: otherwise, you can safely ignore this message." + ; + } + alias boost_mpi_python ; + alias mpi ; + alias boost_mpi ; } - -boost-install boost_mpi $(mpi_python_libs) ; diff --git a/test/Jamfile.v2 b/test/Jamfile.v2 index 634c61f..96db2b7 100644 --- a/test/Jamfile.v2 +++ b/test/Jamfile.v2 @@ -9,9 +9,15 @@ # Authors: Douglas Gregor # Andrew Lumsdaine -project : requirements /boost//mpi ; import mpi : mpi-test ; +project : requirements + /boost/test//boost_test + /boost/mpi//boost_mpi + /boost/mpi//boost_mpi_python + --oversubscribe + ; + if [ mpi.configured ] { test-suite mpi