From dcaee178a68566bbe50c5454a8ff3db67412055e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ren=C3=A9=20Ferdinand=20Rivera=20Morell?= Date: Mon, 19 Aug 2024 16:13:10 -0500 Subject: [PATCH] Add support for modular build structure. (#107) * Make the library modular usable. * Switch to library requirements instead of source. As source puts extra source in install targets. * Add missing NO_LIB usage requirements. * Update library dependencies. * Add requires-b2 check to top-level build file. * Bump B2 require to 5.2 * Update copyright dates. * Move inter-lib dependencies to a project variable and into the build targets. * Switch to /boost/test//included target for header only mode of Boost.Test. * Adjust doc build to avoid boost-root references. * Update build deps. * Change Boost Test build refs to work with both old and modular test lib targets. * Change math dep real target math/tr1. * Allow deprecated Node version * Drop MSVC 14.0 support --------- Co-authored-by: Matt Borland --- .github/workflows/ci.yml | 5 +- .github/workflows/codecov.yml | 1 + build.jam | 36 ++++++ build/Jamfile.v2 | 9 +- doc/Jamfile.v2 | 4 +- example/Jamfile.v2 | 6 +- extra/Jamfile.v2 | 4 +- performance/Jamfile.v2 | 6 +- test/Jamfile.v2 | 229 ++++++++++++++++++---------------- 9 files changed, 176 insertions(+), 124 deletions(-) create mode 100644 build.jam diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 23de89f..35f6a9d 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -21,6 +21,7 @@ env: GIT_FETCH_JOBS: 8 NET_RETRY_COUNT: 5 DEFAULT_BUILD_VARIANT: debug,release + ACTIONS_ALLOW_USE_UNSECURE_NODE_VERSION: true jobs: posix: @@ -445,10 +446,6 @@ jobs: fail-fast: false matrix: include: - - toolset: msvc-14.0 - cxxstd: "14,latest" - addrmd: 64 - os: windows-2019 - toolset: msvc-14.2 cxxstd: "14,17,latest" addrmd: 64 diff --git a/.github/workflows/codecov.yml b/.github/workflows/codecov.yml index 345c205..54cdbce 100644 --- a/.github/workflows/codecov.yml +++ b/.github/workflows/codecov.yml @@ -28,6 +28,7 @@ env: B2_LINK: shared,static LCOV_BRANCH_COVERAGE: 0 CODECOV_NAME: Github Actions + ACTIONS_ALLOW_USE_UNSECURE_NODE_VERSION: true jobs: posix: diff --git a/build.jam b/build.jam new file mode 100644 index 0000000..ad7e37d --- /dev/null +++ b/build.jam @@ -0,0 +1,36 @@ +# Copyright René Ferdinand Rivera Morell 2023-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) + +require-b2 5.2 ; + +constant boost_dependencies : + /boost/array//boost_array + /boost/assert//boost_assert + /boost/config//boost_config + /boost/core//boost_core + /boost/dynamic_bitset//boost_dynamic_bitset + /boost/integer//boost_integer + /boost/io//boost_io + /boost/range//boost_range + /boost/static_assert//boost_static_assert + /boost/system//boost_system + /boost/throw_exception//boost_throw_exception + /boost/type_traits//boost_type_traits + /boost/utility//boost_utility ; + +project /boost/random + : common-requirements + include + ; + +explicit + [ alias boost_random : build//boost_random ] + [ alias all : boost_random example extra test ] + ; + +call-if : boost-library random + : install boost_random + ; + diff --git a/build/Jamfile.v2 b/build/Jamfile.v2 index 60dffca..5c353b9 100644 --- a/build/Jamfile.v2 +++ b/build/Jamfile.v2 @@ -7,9 +7,11 @@ # accompanying file LICENSE_1_0.txt or copy at # http://www.boost.org/LICENSE_1_0.txt) -import ../../config/checks/config : requires ; +import-search /boost/config/checks ; +import config : requires ; -project boost/random ; +project + : common-requirements $(boost_dependencies) ; local SOURCES = random_device.cpp ; @@ -29,7 +31,6 @@ lib boost_random # usage-requirements : shared:BOOST_RANDOM_DYN_LINK=1 + BOOST_RANDOM_NO_LIB=1 ; - -boost-install boost_random ; diff --git a/doc/Jamfile.v2 b/doc/Jamfile.v2 index 07d196c..dbabb5d 100644 --- a/doc/Jamfile.v2 +++ b/doc/Jamfile.v2 @@ -83,8 +83,8 @@ local BOOST_ROOT = [ path.relative-to [ path.pwd ] ] ] ; doxygen reference : - $(here)/../../../boost/random/$(doxygen_files).hpp - $(here)/../../../boost/random.hpp + $(here)/../include/boost/random/$(doxygen_files).hpp + $(here)/../include/boost/random.hpp : EXPAND_ONLY_PREDEF=YES "ALIASES= \\ diff --git a/example/Jamfile.v2 b/example/Jamfile.v2 index c598e78..0a11a74 100644 --- a/example/Jamfile.v2 +++ b/example/Jamfile.v2 @@ -7,7 +7,9 @@ # accompanying file LICENSE_1_0.txt or copy at # http://www.boost.org/LICENSE_1_0.txt) +project : requirements /boost/random//boost_random ; + run die.cpp ; run weighted_die.cpp ; -run password.cpp /boost//random ; -run intersections.cpp /boost//random ; +run password.cpp /boost/random//boost_random ; +run intersections.cpp /boost/math//boost_math_tr1 /boost/random//boost_random ; diff --git a/extra/Jamfile.v2 b/extra/Jamfile.v2 index a0ee2af..d4b5ed1 100644 --- a/extra/Jamfile.v2 +++ b/extra/Jamfile.v2 @@ -7,4 +7,6 @@ # accompanying file LICENSE_1_0.txt or copy at # http://www.boost.org/LICENSE_1_0.txt) -run test_haertel.cpp ; +project : requirements /boost/random//boost_random ; + +run test_haertel.cpp /boost/format//boost_format /boost/test//included ; diff --git a/performance/Jamfile.v2 b/performance/Jamfile.v2 index 4315385..f4291d4 100644 --- a/performance/Jamfile.v2 +++ b/performance/Jamfile.v2 @@ -1,3 +1,5 @@ +project : requirements /boost/random//boost_random ; + mt19937ar-files = [ glob mt19937ar.c ] ; if $(mt19937ar-files) @@ -10,8 +12,8 @@ else } exe random_speed.exe : random_speed.cpp mt19937ar : release ; -exe generate_table.exe : generate_table.cpp /boost//regex : static ; -exe nondet_random_speed.exe : nondet_random_speed.cpp /boost//random : release static ; +exe generate_table.exe : generate_table.cpp /boost/regex//boost_regex : static ; +exe nondet_random_speed.exe : nondet_random_speed.cpp /boost/random//boost_random : release static ; install random_speed : random_speed.exe : EXE . ; install nondet_random_speed : nondet_random_speed.exe : EXE . ; diff --git a/test/Jamfile.v2 b/test/Jamfile.v2 index d45ef37..691d878 100644 --- a/test/Jamfile.v2 +++ b/test/Jamfile.v2 @@ -5,9 +5,12 @@ # Boost Random Library test Jamfile +require-b2 5.0.1 ; +import-search /boost/config/checks ; +import config : requires ; + # bring in rules for testing import testing ; -import ../../config/checks/config : requires ; project /boost/random/test : requirements @@ -16,56 +19,56 @@ project /boost/random/test : requirements msvc:_SCL_SECURE_NO_WARNINGS ; -run test_const_mod.cpp /boost//unit_test_framework ; -run test_generate_canonical.cpp /boost//unit_test_framework ; -run test_random_number_generator.cpp /boost//unit_test_framework ; +run test_const_mod.cpp /boost/test//boost_unit_test_framework ; +run test_generate_canonical.cpp /boost/test//boost_unit_test_framework ; +run test_random_number_generator.cpp /boost/test//boost_unit_test_framework ; run ../example/random_demo.cpp ; -run test_random_device.cpp /boost//random : : : static : test_random_device ; -run test_random_device.cpp /boost//random : : : shared : test_random_device_dll ; +run test_random_device.cpp /boost/random//boost_random /boost/test//included : : : static : test_random_device ; +run test_random_device.cpp /boost/random//boost_random /boost/test//included : : : shared : test_random_device_dll ; -run test_minstd_rand0.cpp /boost//unit_test_framework ; -run test_minstd_rand.cpp /boost//unit_test_framework ; -run test_rand48.cpp /boost//unit_test_framework ; -run test_mt11213b.cpp /boost//unit_test_framework ; -run test_mt19937.cpp /boost//unit_test_framework ; -run test_mt19937_64.cpp /boost//unit_test_framework ; -run test_mixmax.cpp /boost//unit_test_framework ; -run test_ecuyer1988.cpp /boost//unit_test_framework ; -run test_hellekalek1995.cpp /boost//unit_test_framework ; -run test_linear_feedback_shift.cpp /boost//unit_test_framework ; -run test_taus88.cpp /boost//unit_test_framework ; -run test_kreutzer1986.cpp /boost//unit_test_framework ; -run test_ranlux3.cpp /boost//unit_test_framework ; -run test_ranlux4.cpp /boost//unit_test_framework ; -run test_ranlux3_01.cpp /boost//unit_test_framework ; -run test_ranlux4_01.cpp /boost//unit_test_framework ; -run test_ranlux64_4.cpp /boost//unit_test_framework ; -run test_ranlux64_3.cpp /boost//unit_test_framework ; -run test_ranlux64_3_01.cpp /boost//unit_test_framework ; -run test_ranlux64_4_01.cpp /boost//unit_test_framework ; -run test_ranlux24_base.cpp /boost//unit_test_framework ; -run test_ranlux24.cpp /boost//unit_test_framework ; -run test_ranlux48_base.cpp /boost//unit_test_framework ; -run test_ranlux48.cpp /boost//unit_test_framework ; -run test_knuth_b.cpp /boost//unit_test_framework ; -run test_independent_bits31.cpp /boost//unit_test_framework ; -run test_independent_bits32.cpp /boost//unit_test_framework ; -run test_lagged_fibonacci.cpp /boost//unit_test_framework ; -run test_lagged_fibonacci607.cpp /boost//unit_test_framework ; -run test_lagged_fibonacci1279.cpp /boost//unit_test_framework ; -run test_lagged_fibonacci2281.cpp /boost//unit_test_framework ; -run test_lagged_fibonacci3217.cpp /boost//unit_test_framework ; -run test_lagged_fibonacci4423.cpp /boost//unit_test_framework ; -run test_lagged_fibonacci9689.cpp /boost//unit_test_framework ; -run test_lagged_fibonacci19937.cpp /boost//unit_test_framework ; -run test_lagged_fibonacci23209.cpp /boost//unit_test_framework ; -run test_lagged_fibonacci44497.cpp /boost//unit_test_framework ; -run test_zero_seed.cpp /boost//unit_test_framework ; -run test_splitmix64.cpp /boost//unit_test_framework ; +run test_minstd_rand0.cpp /boost/test//boost_unit_test_framework ; +run test_minstd_rand.cpp /boost/test//boost_unit_test_framework ; +run test_rand48.cpp /boost/test//boost_unit_test_framework ; +run test_mt11213b.cpp /boost/test//boost_unit_test_framework ; +run test_mt19937.cpp /boost/test//boost_unit_test_framework ; +run test_mt19937_64.cpp /boost/test//boost_unit_test_framework ; +run test_mixmax.cpp /boost/test//boost_unit_test_framework ; +run test_ecuyer1988.cpp /boost/test//boost_unit_test_framework ; +run test_hellekalek1995.cpp /boost/test//boost_unit_test_framework ; +run test_linear_feedback_shift.cpp /boost/test//boost_unit_test_framework ; +run test_taus88.cpp /boost/test//boost_unit_test_framework ; +run test_kreutzer1986.cpp /boost/test//boost_unit_test_framework ; +run test_ranlux3.cpp /boost/test//boost_unit_test_framework ; +run test_ranlux4.cpp /boost/test//boost_unit_test_framework ; +run test_ranlux3_01.cpp /boost/test//boost_unit_test_framework ; +run test_ranlux4_01.cpp /boost/test//boost_unit_test_framework ; +run test_ranlux64_4.cpp /boost/test//boost_unit_test_framework ; +run test_ranlux64_3.cpp /boost/test//boost_unit_test_framework ; +run test_ranlux64_3_01.cpp /boost/test//boost_unit_test_framework ; +run test_ranlux64_4_01.cpp /boost/test//boost_unit_test_framework ; +run test_ranlux24_base.cpp /boost/test//boost_unit_test_framework ; +run test_ranlux24.cpp /boost/test//boost_unit_test_framework ; +run test_ranlux48_base.cpp /boost/test//boost_unit_test_framework ; +run test_ranlux48.cpp /boost/test//boost_unit_test_framework ; +run test_knuth_b.cpp /boost/test//boost_unit_test_framework ; +run test_independent_bits31.cpp /boost/test//boost_unit_test_framework ; +run test_independent_bits32.cpp /boost/test//boost_unit_test_framework ; +run test_lagged_fibonacci.cpp /boost/test//boost_unit_test_framework ; +run test_lagged_fibonacci607.cpp /boost/test//boost_unit_test_framework ; +run test_lagged_fibonacci1279.cpp /boost/test//boost_unit_test_framework ; +run test_lagged_fibonacci2281.cpp /boost/test//boost_unit_test_framework ; +run test_lagged_fibonacci3217.cpp /boost/test//boost_unit_test_framework ; +run test_lagged_fibonacci4423.cpp /boost/test//boost_unit_test_framework ; +run test_lagged_fibonacci9689.cpp /boost/test//boost_unit_test_framework ; +run test_lagged_fibonacci19937.cpp /boost/test//boost_unit_test_framework ; +run test_lagged_fibonacci23209.cpp /boost/test//boost_unit_test_framework ; +run test_lagged_fibonacci44497.cpp /boost/test//boost_unit_test_framework ; +run test_zero_seed.cpp /boost/test//boost_unit_test_framework ; +run test_splitmix64.cpp /boost/test//boost_unit_test_framework ; -run niederreiter_base2_validate.cpp /boost//unit_test_framework ; -run sobol_validate.cpp /boost//unit_test_framework ; -run faure_validate.cpp /boost//unit_test_framework ; +run niederreiter_base2_validate.cpp /boost/test//boost_unit_test_framework ; +run sobol_validate.cpp /boost/test//boost_unit_test_framework ; +run faure_validate.cpp /boost/test//boost_unit_test_framework ; # Disable by default. These don't add much and the larger # ones can overflow the stack. @@ -75,66 +78,74 @@ explicit test_lagged_fibonacci1279 test_lagged_fibonacci2281 test_lagged_fibonacci19937 test_lagged_fibonacci23209 test_lagged_fibonacci44497 ; -run test_seed_seq.cpp /boost//unit_test_framework ; +alias math_test : + /boost/assign//boost_assign + /boost/exception//boost_exception + /boost/lexical_cast//boost_lexical_cast + /boost/math//boost_math_tr1 + /boost/numeric_conversion//boost_numeric_conversion + ; -run test_binomial.cpp ; -run test_binomial_distribution.cpp /boost//unit_test_framework ; -run test_poisson.cpp ; -run test_poisson_distribution.cpp /boost//unit_test_framework ; -run test_discrete.cpp ; -run test_discrete_distribution.cpp /boost//unit_test_framework ; -run test_gamma.cpp ; -run test_gamma_distribution.cpp /boost//unit_test_framework ; -run test_weibull.cpp ; -run test_weibull_distribution.cpp /boost//unit_test_framework ; -run test_extreme_value.cpp ; -run test_extreme_value_distribution.cpp /boost//unit_test_framework ; -run test_negative_binomial.cpp ; -run test_negative_binomial_distribution.cpp /boost//unit_test_framework ; -run test_chi_squared.cpp ; -run test_chi_squared_distribution.cpp /boost//unit_test_framework ; -run test_fisher_f.cpp ; -run test_fisher_f_distribution.cpp /boost//unit_test_framework ; -run test_student_t.cpp ; -run test_student_t_distribution.cpp /boost//unit_test_framework ; -run test_normal.cpp ; -run test_normal_distribution.cpp /boost//unit_test_framework ; -run test_piecewise_constant.cpp ; -run test_piecewise_constant_distribution.cpp /boost//unit_test_framework ; -run test_piecewise_linear.cpp ; -run test_piecewise_linear_distribution.cpp /boost//unit_test_framework ; -run test_exponential.cpp ; -run test_exponential_distribution.cpp /boost//unit_test_framework ; -run test_bernoulli.cpp ; -run test_bernoulli_distribution.cpp /boost//unit_test_framework ; -run test_cauchy.cpp ; -run test_cauchy_distribution.cpp /boost//unit_test_framework ; -run test_geometric.cpp ; -run test_geometric_distribution.cpp /boost//unit_test_framework ; -run test_lognormal.cpp ; -run test_lognormal_distribution.cpp /boost//unit_test_framework ; -run test_triangle.cpp ; -run test_triangle_distribution.cpp /boost//unit_test_framework ; -run test_uniform_int.cpp ; -run test_uniform_int_distribution.cpp /boost//unit_test_framework ; -run test_uniform_real.cpp ; -run test_uniform_real_distribution.cpp /boost//unit_test_framework ; -run test_uniform_on_sphere.cpp ; -run test_uniform_on_sphere_distribution.cpp /boost//unit_test_framework ; -run test_uniform_smallint.cpp ; -run test_uniform_smallint_distribution.cpp /boost//unit_test_framework ; -run test_old_uniform_real.cpp ; -run test_old_uniform_real_distribution.cpp /boost//unit_test_framework ; -run test_old_uniform_int.cpp ; -run test_old_uniform_int_distribution.cpp /boost//unit_test_framework ; -run test_beta.cpp ; -run test_beta_distribution.cpp /boost//unit_test_framework ; -run test_laplace.cpp ; -run test_laplace_distribution.cpp /boost//unit_test_framework ; -run test_non_central_chi_squared.cpp ; -run test_non_central_chi_squared_distribution.cpp /boost//unit_test_framework ; -run test_hyperexponential.cpp ; -run test_hyperexponential_distribution.cpp /boost//unit_test_framework ; +run test_seed_seq.cpp /boost/assign//boost_assign /boost/test//boost_unit_test_framework ; + +run test_binomial.cpp math_test ; +run test_binomial_distribution.cpp /boost/test//boost_unit_test_framework ; +run test_poisson.cpp math_test ; +run test_poisson_distribution.cpp /boost/test//boost_unit_test_framework ; +run test_discrete.cpp math_test ; +run test_discrete_distribution.cpp /boost/assign//boost_assign /boost/test//boost_unit_test_framework ; +run test_gamma.cpp math_test ; +run test_gamma_distribution.cpp /boost/test//boost_unit_test_framework ; +run test_weibull.cpp math_test ; +run test_weibull_distribution.cpp /boost/test//boost_unit_test_framework ; +run test_extreme_value.cpp math_test ; +run test_extreme_value_distribution.cpp /boost/test//boost_unit_test_framework ; +run test_negative_binomial.cpp math_test ; +run test_negative_binomial_distribution.cpp /boost/test//boost_unit_test_framework ; +run test_chi_squared.cpp math_test ; +run test_chi_squared_distribution.cpp /boost/test//boost_unit_test_framework ; +run test_fisher_f.cpp math_test ; +run test_fisher_f_distribution.cpp /boost/test//boost_unit_test_framework ; +run test_student_t.cpp math_test ; +run test_student_t_distribution.cpp /boost/test//boost_unit_test_framework ; +run test_normal.cpp math_test ; +run test_normal_distribution.cpp /boost/test//boost_unit_test_framework ; +run test_piecewise_constant.cpp math_test ; +run test_piecewise_constant_distribution.cpp /boost/assign//boost_assign /boost/test//boost_unit_test_framework ; +run test_piecewise_linear.cpp math_test ; +run test_piecewise_linear_distribution.cpp /boost/assign//boost_assign /boost/test//boost_unit_test_framework ; +run test_exponential.cpp math_test ; +run test_exponential_distribution.cpp /boost/test//boost_unit_test_framework ; +run test_bernoulli.cpp math_test ; +run test_bernoulli_distribution.cpp /boost/test//boost_unit_test_framework ; +run test_cauchy.cpp math_test ; +run test_cauchy_distribution.cpp /boost/test//boost_unit_test_framework ; +run test_geometric.cpp math_test ; +run test_geometric_distribution.cpp /boost/test//boost_unit_test_framework ; +run test_lognormal.cpp math_test ; +run test_lognormal_distribution.cpp /boost/test//boost_unit_test_framework ; +run test_triangle.cpp math_test ; +run test_triangle_distribution.cpp /boost/test//boost_unit_test_framework ; +run test_uniform_int.cpp math_test ; +run test_uniform_int_distribution.cpp math_test /boost/test//boost_unit_test_framework ; +run test_uniform_real.cpp math_test ; +run test_uniform_real_distribution.cpp /boost/test//boost_unit_test_framework ; +run test_uniform_on_sphere.cpp math_test ; +run test_uniform_on_sphere_distribution.cpp math_test /boost/test//boost_unit_test_framework ; +run test_uniform_smallint.cpp math_test ; +run test_uniform_smallint_distribution.cpp /boost/test//boost_unit_test_framework ; +run test_old_uniform_real.cpp math_test ; +run test_old_uniform_real_distribution.cpp /boost/test//boost_unit_test_framework ; +run test_old_uniform_int.cpp math_test ; +run test_old_uniform_int_distribution.cpp math_test /boost/test//boost_unit_test_framework ; +run test_beta.cpp math_test ; +run test_beta_distribution.cpp /boost/test//boost_unit_test_framework ; +run test_laplace.cpp math_test ; +run test_laplace_distribution.cpp /boost/test//boost_unit_test_framework ; +run test_non_central_chi_squared.cpp math_test ; +run test_non_central_chi_squared_distribution.cpp /boost/test//boost_unit_test_framework ; +run test_hyperexponential.cpp math_test ; +run test_hyperexponential_distribution.cpp math_test /boost/test//boost_unit_test_framework ; # run nondet_random_speed.cpp ; # run random_device.cpp ; @@ -150,6 +161,6 @@ explicit statistic_tests ; # # Multiprecision tests: # -run multiprecision_int_test.cpp /boost//unit_test_framework : : : [ requires cxx14_decltype_auto cxx14_generic_lambdas cxx14_return_type_deduction cxx14_variable_templates cxx14_constexpr ] ; +run multiprecision_int_test.cpp /boost/test//boost_unit_test_framework /boost/multiprecision//boost_multiprecision : : : [ requires cxx14_decltype_auto cxx14_generic_lambdas cxx14_return_type_deduction cxx14_variable_templates cxx14_constexpr ] ; # This one runs too slow in debug mode, we really need inline expansions turned on amongst other things: -run multiprecision_float_test.cpp /boost//unit_test_framework : : : [ requires cxx14_decltype_auto cxx14_generic_lambdas cxx14_return_type_deduction cxx14_variable_templates cxx14_constexpr ] release ; +run multiprecision_float_test.cpp /boost/test//boost_unit_test_framework /boost/multiprecision//boost_multiprecision : : : [ requires cxx14_decltype_auto cxx14_generic_lambdas cxx14_return_type_deduction cxx14_variable_templates cxx14_constexpr ] release ;