Skip to content

Commit

Permalink
Add support for modular build structure. (#107)
Browse files Browse the repository at this point in the history
* 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 <matt@mattborland.com>
  • Loading branch information
grafikrobot and mborland authored Aug 19, 2024
1 parent 560acd8 commit dcaee17
Show file tree
Hide file tree
Showing 9 changed files with 179 additions and 127 deletions.
5 changes: 1 addition & 4 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down Expand Up @@ -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
Expand Down
1 change: 1 addition & 0 deletions .github/workflows/codecov.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down
36 changes: 36 additions & 0 deletions build.jam
Original file line number Diff line number Diff line change
@@ -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>include
;

explicit
[ alias boost_random : build//boost_random ]
[ alias all : boost_random example extra test ]
;

call-if : boost-library random
: install boost_random
;

9 changes: 5 additions & 4 deletions build/Jamfile.v2
Original file line number Diff line number Diff line change
Expand Up @@ -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 <library>$(boost_dependencies) ;

local SOURCES = random_device.cpp ;

Expand All @@ -29,7 +31,6 @@ lib boost_random

# usage-requirements
: <link>shared:<define>BOOST_RANDOM_DYN_LINK=1
<define>BOOST_RANDOM_NO_LIB=1

;

boost-install boost_random ;
4 changes: 2 additions & 2 deletions doc/Jamfile.v2
Original file line number Diff line number Diff line change
Expand Up @@ -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
:
<doxygen:param>EXPAND_ONLY_PREDEF=YES
<doxygen:param>"ALIASES= \\
Expand Down
6 changes: 4 additions & 2 deletions example/Jamfile.v2
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,9 @@
# accompanying file LICENSE_1_0.txt or copy at
# http://www.boost.org/LICENSE_1_0.txt)

project : requirements <library>/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 ;
4 changes: 3 additions & 1 deletion extra/Jamfile.v2
Original file line number Diff line number Diff line change
Expand Up @@ -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 <library>/boost/random//boost_random ;

run test_haertel.cpp /boost/format//boost_format /boost/test//included ;
6 changes: 4 additions & 2 deletions performance/Jamfile.v2
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
project : requirements <library>/boost/random//boost_random ;

mt19937ar-files = [ glob mt19937ar.c ] ;

if $(mt19937ar-files)
Expand All @@ -10,8 +12,8 @@ else
}

exe random_speed.exe : random_speed.cpp mt19937ar : release ;
exe generate_table.exe : generate_table.cpp /boost//regex : <link>static ;
exe nondet_random_speed.exe : nondet_random_speed.cpp /boost//random : release <link>static ;
exe generate_table.exe : generate_table.cpp /boost/regex//boost_regex : <link>static ;
exe nondet_random_speed.exe : nondet_random_speed.cpp /boost/random//boost_random : release <link>static ;

install random_speed : random_speed.exe : <install-type>EXE <location>. ;
install nondet_random_speed : nondet_random_speed.exe : <install-type>EXE <location>. ;
Expand Down
235 changes: 123 additions & 112 deletions test/Jamfile.v2
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand All @@ -16,56 +19,56 @@ project /boost/random/test : requirements
<toolset>msvc:<define>_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 : : : <link>static : test_random_device ;
run test_random_device.cpp /boost//random : : : <link>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 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 test_random_device.cpp /boost/random//boost_random /boost/test//included : : : <link>static : test_random_device ;
run test_random_device.cpp /boost/random//boost_random /boost/test//included : : : <link>shared : test_random_device_dll ;

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/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.
Expand All @@ -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 ;

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 ;
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_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 ;
Expand All @@ -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 ;

0 comments on commit dcaee17

Please sign in to comment.