From 610f8f6981be3ad56d0df1d6920cc9ae5970b04b Mon Sep 17 00:00:00 2001 From: Rene Rivera Date: Mon, 11 Mar 2024 08:38:16 -0500 Subject: [PATCH 1/9] Make the library modular usable. --- build.jam | 42 ++++++++++++++++++++++++++++++++ build/Jamfile | 61 ++++++++++++++++++++++------------------------- example/README.md | 2 +- test/Jamfile | 8 ++++--- 4 files changed, 76 insertions(+), 37 deletions(-) create mode 100644 build.jam diff --git a/build.jam b/build.jam new file mode 100644 index 0000000000..f5bd099742 --- /dev/null +++ b/build.jam @@ -0,0 +1,42 @@ +# 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/python + : common-requirements + /boost/align//boost_align + /boost/bind//boost_bind + /boost/config//boost_config + /boost/conversion//boost_conversion + /boost/core//boost_core + /boost/detail//boost_detail + /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/numeric_conversion//boost_numeric_conversion + /boost/preprocessor//boost_preprocessor + /boost/property_map//boost_property_map + /boost/smart_ptr//boost_smart_ptr + /boost/static_assert//boost_static_assert + /boost/tuple//boost_tuple + /boost/type_traits//boost_type_traits + /boost/utility//boost_utility + include + ; + +explicit + [ alias boost_python : build//boost_python ] + [ alias boost_numpy : build//boost_numpy ] + [ alias all : boost_python boost_numpy test ] + ; + +call-if : boost-library python + : install boost_python boost_numpy + ; diff --git a/build/Jamfile b/build/Jamfile index 03b69a25dd..d85c165baf 100644 --- a/build/Jamfile +++ b/build/Jamfile @@ -30,7 +30,7 @@ else ; } -project boost/python +project : source-location ../src ; @@ -38,6 +38,17 @@ rule cond ( test ? : yes * : no * ) { if $(test) { return $(yes) ; } else { retu rule unless ( test ? : yes * : no * ) { if ! $(test) { return $(yes) ; } else { return $(no) ; } } local rule eq ( a : b ) { if $(a) = $(b) { return 1 ; } } +rule tag ( name : type ? : property-set ) +{ + if python-tag in [ RULENAMES $(__name__) ] + { + return [ $(__name__).python-tag $(name) : $(type) : $(property-set) ] ; + } +} + +if [ python.configured ] +{ + lib boost_python : # sources list.cpp @@ -92,8 +103,8 @@ lib boost_python [ unless [ python.configured ] : no ] config-warning on:BOOST_DEBUG_PYTHON - -@$(BOOST_JAMROOT_MODULE)%$(BOOST_JAMROOT_MODULE).tag - @python-tag + -@%boostcpp.tag + @tag @python.require-py : # default build @@ -103,6 +114,17 @@ lib boost_python on:BOOST_DEBUG_PYTHON ; +} +else +{ + +alias boost_python : config-warning ; + +} + +if [ python.configured ] && [ python.numpy ] +{ + numpy-include = [ python.numpy-include ] ; lib boost_numpy : # sources @@ -120,8 +142,8 @@ lib boost_numpy /python//numpy boost_python on:BOOST_DEBUG_PYTHON - -@$(BOOST_JAMROOT_MODULE)%$(BOOST_JAMROOT_MODULE).tag - @python-tag + -@%boostcpp.tag + @tag @python.require-py : # default build @@ -131,37 +153,10 @@ lib boost_numpy on:BOOST_DEBUG_PYTHON ; -# boost-install creates `stage` and `install` targets -# -# `stage` stages (builds and copies into `stage/lib`) the given libraries -# `boost_python` and `boost_numpy` and their dependencies and is similar -# to issuing `b2 --with-python stage` from top level -# -# `install` installs the two libraries and their dependencies and is similar -# to issuing `b2 --with-python install` from top level - -if [ python.configured ] -{ - if [ python.numpy ] - { - boost-install boost_python boost_numpy ; - } - else - { - boost-install boost_python ; - } } else { -# When Python isn't configured, the above `boost-install` is not executed, -# so we create empty `stage` and `install` targets that do nothing but issue -# a warning message unless `--without-python` is given - -alias stage : config-warning ; -explicit stage ; - -alias install : config-warning ; -explicit install ; +alias boost_numpy : config-warning ; } diff --git a/example/README.md b/example/README.md index b090cbe1e3..af03f20ba8 100644 --- a/example/README.md +++ b/example/README.md @@ -3,7 +3,7 @@ # Examples This directory contains various examples using Boost.Python. -You may compile these using the `bjam` command either in this directory +You may compile these using the `b2` command either in this directory or in any of the subdirectories. You may need to adjust the paths in the Jamroot file if Boost.Python is not installed in a default location. diff --git a/test/Jamfile b/test/Jamfile index 07cbd4c7e5..48e57487f5 100644 --- a/test/Jamfile +++ b/test/Jamfile @@ -2,14 +2,16 @@ # Software License, Version 1.0. (See accompanying # file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) +require-b2 5.0.1 ; +import-search /boost/config/checks ; + import python ; import os ; -import ../../config/checks/config : requires ; +import config : requires ; lib socket ; -use-project /boost/python : ../build ; -project /boost/python/test +project : requirements gcc:-Wextra qnxnto:socket From 8c16b8b1a97cec4ebce407021ffb506d29eb336f Mon Sep 17 00:00:00 2001 From: Rene Rivera Date: Sun, 17 Mar 2024 18:33:44 -0500 Subject: [PATCH 2/9] Put back removing qualified boostcpp tag. As we need it until the Jamroot removes the qualified tag. --- build/Jamfile | 2 ++ 1 file changed, 2 insertions(+) diff --git a/build/Jamfile b/build/Jamfile index d85c165baf..64843288ae 100644 --- a/build/Jamfile +++ b/build/Jamfile @@ -104,6 +104,7 @@ lib boost_python config-warning on:BOOST_DEBUG_PYTHON -@%boostcpp.tag + -@$(BOOST_JAMROOT_MODULE)%$(BOOST_JAMROOT_MODULE).tag @tag @python.require-py @@ -143,6 +144,7 @@ lib boost_numpy boost_python on:BOOST_DEBUG_PYTHON -@%boostcpp.tag + -@$(BOOST_JAMROOT_MODULE)%$(BOOST_JAMROOT_MODULE).tag @tag @python.require-py From a95c8584d41717089472c2f759750fad23e2a368 Mon Sep 17 00:00:00 2001 From: Rene Rivera Date: Fri, 29 Mar 2024 21:15:59 -0500 Subject: [PATCH 3/9] Switch to library requirements instead of source. As source puts extra source in install targets. --- build.jam | 42 +++++++++++++++++++++--------------------- 1 file changed, 21 insertions(+), 21 deletions(-) diff --git a/build.jam b/build.jam index f5bd099742..d03ca41b11 100644 --- a/build.jam +++ b/build.jam @@ -7,27 +7,27 @@ import project ; project /boost/python : common-requirements - /boost/align//boost_align - /boost/bind//boost_bind - /boost/config//boost_config - /boost/conversion//boost_conversion - /boost/core//boost_core - /boost/detail//boost_detail - /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/numeric_conversion//boost_numeric_conversion - /boost/preprocessor//boost_preprocessor - /boost/property_map//boost_property_map - /boost/smart_ptr//boost_smart_ptr - /boost/static_assert//boost_static_assert - /boost/tuple//boost_tuple - /boost/type_traits//boost_type_traits - /boost/utility//boost_utility + /boost/align//boost_align + /boost/bind//boost_bind + /boost/config//boost_config + /boost/conversion//boost_conversion + /boost/core//boost_core + /boost/detail//boost_detail + /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/numeric_conversion//boost_numeric_conversion + /boost/preprocessor//boost_preprocessor + /boost/property_map//boost_property_map + /boost/smart_ptr//boost_smart_ptr + /boost/static_assert//boost_static_assert + /boost/tuple//boost_tuple + /boost/type_traits//boost_type_traits + /boost/utility//boost_utility include ; From 30d2263b0752f3f3f90ed2fd76b80c8c8c917f45 Mon Sep 17 00:00:00 2001 From: Rene Rivera Date: Sun, 28 Apr 2024 20:16:29 -0500 Subject: [PATCH 4/9] Add missing NO_LIB usage requirements. --- build/Jamfile | 2 ++ 1 file changed, 2 insertions(+) diff --git a/build/Jamfile b/build/Jamfile index 64843288ae..76042bb12a 100644 --- a/build/Jamfile +++ b/build/Jamfile @@ -113,6 +113,7 @@ lib boost_python : # usage requirements static:BOOST_PYTHON_STATIC_LIB on:BOOST_DEBUG_PYTHON + BOOST_PYTHON_NO_LIB ; } @@ -153,6 +154,7 @@ lib boost_numpy : # usage requirements static:BOOST_NUMPY_STATIC_LIB on:BOOST_DEBUG_PYTHON + BOOST_NUMPY_NO_LIB ; } From 04cc056a7ba8b1759146713d5ef86a1e7de1fc65 Mon Sep 17 00:00:00 2001 From: Rene Rivera Date: Sun, 5 May 2024 09:00:01 -0500 Subject: [PATCH 5/9] Add requires-b2 check to top-level build file. --- build.jam | 2 ++ 1 file changed, 2 insertions(+) diff --git a/build.jam b/build.jam index d03ca41b11..dbd0f1ffa5 100644 --- a/build.jam +++ b/build.jam @@ -3,6 +3,8 @@ # (See accompanying file LICENSE_1_0.txt or copy at # http://www.boost.org/LICENSE_1_0.txt) +require-b2 5.1 ; + import project ; project /boost/python From d66a25033502efa93bd038e46003b82d37a0d008 Mon Sep 17 00:00:00 2001 From: Rene Rivera Date: Fri, 14 Jun 2024 11:33:56 -0500 Subject: [PATCH 6/9] Bump B2 require to 5.2 --- build.jam | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/build.jam b/build.jam index dbd0f1ffa5..77aea7b462 100644 --- a/build.jam +++ b/build.jam @@ -3,9 +3,7 @@ # (See accompanying file LICENSE_1_0.txt or copy at # http://www.boost.org/LICENSE_1_0.txt) -require-b2 5.1 ; - -import project ; +require-b2 5.2 ; project /boost/python : common-requirements From dfd6ef63fe4c35abf6e90b99e745fa61686b8bbe Mon Sep 17 00:00:00 2001 From: Rene Rivera Date: Tue, 23 Jul 2024 22:34:22 -0500 Subject: [PATCH 7/9] Move inter-lib dependencies to a project variable and into the build targets. --- build.jam | 45 ++++++++++++++++++++++++--------------------- build/Jamfile | 1 + 2 files changed, 25 insertions(+), 21 deletions(-) diff --git a/build.jam b/build.jam index 77aea7b462..7adb65de6b 100644 --- a/build.jam +++ b/build.jam @@ -5,29 +5,31 @@ require-b2 5.2 ; +constant boost_dependencies : + /boost/align//boost_align + /boost/bind//boost_bind + /boost/config//boost_config + /boost/conversion//boost_conversion + /boost/core//boost_core + /boost/detail//boost_detail + /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/numeric_conversion//boost_numeric_conversion + /boost/preprocessor//boost_preprocessor + /boost/property_map//boost_property_map + /boost/smart_ptr//boost_smart_ptr + /boost/static_assert//boost_static_assert + /boost/tuple//boost_tuple + /boost/type_traits//boost_type_traits + /boost/utility//boost_utility ; + project /boost/python : common-requirements - /boost/align//boost_align - /boost/bind//boost_bind - /boost/config//boost_config - /boost/conversion//boost_conversion - /boost/core//boost_core - /boost/detail//boost_detail - /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/numeric_conversion//boost_numeric_conversion - /boost/preprocessor//boost_preprocessor - /boost/property_map//boost_property_map - /boost/smart_ptr//boost_smart_ptr - /boost/static_assert//boost_static_assert - /boost/tuple//boost_tuple - /boost/type_traits//boost_type_traits - /boost/utility//boost_utility include ; @@ -40,3 +42,4 @@ explicit call-if : boost-library python : install boost_python boost_numpy ; + diff --git a/build/Jamfile b/build/Jamfile index 76042bb12a..dfc1e92d63 100644 --- a/build/Jamfile +++ b/build/Jamfile @@ -32,6 +32,7 @@ else project : source-location ../src + : common-requirements $(boost_dependencies) ; rule cond ( test ? : yes * : no * ) { if $(test) { return $(yes) ; } else { return $(no) ; } } From 23b676fe93c3d5e8a0d7fde9efd75c85fc1fce87 Mon Sep 17 00:00:00 2001 From: Rene Rivera Date: Fri, 26 Jul 2024 17:39:24 -0500 Subject: [PATCH 8/9] Split b2 dependencies into public and private. --- build.jam | 4 ---- build/Jamfile | 8 ++++++++ 2 files changed, 8 insertions(+), 4 deletions(-) diff --git a/build.jam b/build.jam index 7adb65de6b..e9eb1a11a2 100644 --- a/build.jam +++ b/build.jam @@ -14,15 +14,11 @@ constant boost_dependencies : /boost/detail//boost_detail /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/numeric_conversion//boost_numeric_conversion /boost/preprocessor//boost_preprocessor - /boost/property_map//boost_property_map - /boost/smart_ptr//boost_smart_ptr /boost/static_assert//boost_static_assert /boost/tuple//boost_tuple /boost/type_traits//boost_type_traits diff --git a/build/Jamfile b/build/Jamfile index dfc1e92d63..c8f9859c64 100644 --- a/build/Jamfile +++ b/build/Jamfile @@ -30,9 +30,17 @@ else ; } +constant boost_dependencies_private : + /boost/graph//boost_graph + /boost/integer//boost_integer + /boost/property_map//boost_property_map + /boost/smart_ptr//boost_smart_ptr + ; + project : source-location ../src : common-requirements $(boost_dependencies) + : requirements $(boost_dependencies_private) ; rule cond ( test ? : yes * : no * ) { if $(test) { return $(yes) ; } else { return $(no) ; } } From fe045d77796b3dfe4e3346535c87d12b98c899eb Mon Sep 17 00:00:00 2001 From: Rene Rivera Date: Wed, 7 Aug 2024 23:28:26 -0500 Subject: [PATCH 9/9] Update build deps. --- test/Jamfile | 45 +++++++++++++++++++++++++++++---------------- 1 file changed, 29 insertions(+), 16 deletions(-) diff --git a/test/Jamfile b/test/Jamfile index 48e57487f5..40115d86cb 100644 --- a/test/Jamfile +++ b/test/Jamfile @@ -30,7 +30,7 @@ rule py-run ( sources * : input-file ? ) : $(input-file) : #requirements BOOST_PYTHON_SUPPRESS_REGISTRY_INITIALIZATION - + ] ; } @@ -54,6 +54,18 @@ rule require-windows ( properties * ) if [ python.configured ] { +alias base_deps : usage-requirements + /boost/align//boost_align + /boost/assert//boost_assert + /boost/config//boost_config + /boost/core//boost_core + /boost/detail//boost_detail + /boost/function//boost_function + /boost/mpl//boost_mpl + /boost/preprocessor//boost_preprocessor + /boost/static_assert//boost_static_assert + /boost/type_traits//boost_type_traits + ; test-suite python : @@ -99,8 +111,8 @@ bpl-test crossmod_exception [ bpl-test andreas_beyer ] [ bpl-test wrapper_held_type ] -[ bpl-test polymorphism2_auto_ptr - : polymorphism2_auto_ptr.py polymorphism2.py polymorphism2_auto_ptr.cpp +[ bpl-test polymorphism2_auto_ptr + : polymorphism2_auto_ptr.py polymorphism2.py polymorphism2_auto_ptr.cpp : [ requires auto_ptr ] ] @@ -121,7 +133,7 @@ bpl-test crossmod_exception [ bpl-test try : newtest.py m1.cpp m2.cpp ] [ bpl-test const_argument ] [ bpl-test keywords : keywords.cpp keywords_test.py ] - + [ python-extension builtin_converters_ext : builtin_converters.cpp /boost/python//boost_python ] [ bpl-test builtin_converters : test_builtin_converters.py builtin_converters_ext ] @@ -194,13 +206,13 @@ bpl-test crossmod_opaque # Whenever the cause for the failure of the polymorphism test is found # and fixed, this should be retested. hp_cxx:no ] - + [ python-extension map_indexing_suite_ext : map_indexing_suite.cpp int_map_indexing_suite.cpp a_map_indexing_suite.cpp /boost/python//boost_python ] -[ bpl-test +[ bpl-test map_indexing_suite : map_indexing_suite.py map_indexing_suite_ext ] - + [ run import_.cpp /boost/python//boost_python $(PY) : : import_.py ] # if $(TEST_BIENSTMAN_NON_BUGS) @@ -214,28 +226,29 @@ bpl-test crossmod_opaque # --- unit tests of library components --- -[ compile indirect_traits_test.cpp ] -[ run destroy_test.cpp ] +[ compile indirect_traits_test.cpp : base_deps ] +[ run destroy_test.cpp : : : base_deps ] [ py-run pointer_type_id_test.cpp ] [ py-run bases.cpp ] -[ run if_else.cpp ] +[ run if_else.cpp : : : base_deps ] [ py-run pointee.cpp ] -[ run result.cpp ] +[ run result.cpp : : : base_deps ] -[ compile string_literal.cpp ] +[ compile string_literal.cpp : base_deps ] [ py-compile borrowed.cpp ] [ py-compile object_manager.cpp ] [ py-compile copy_ctor_mutates_rhs.cpp ] [ py-run upcast.cpp ] - + [ py-compile select_holder.cpp ] - -[ run select_from_python_test.cpp ../src/converter/type_id.cpp - : + +[ run select_from_python_test.cpp ../src/converter/type_id.cpp + : : : BOOST_PYTHON_STATIC_LIB $(PY) + base_deps ]