mirror of
https://github.com/boostorg/histogram.git
synced 2026-01-19 04:12:12 +00:00
Add support for modular build structure. (#401)
* Make the library modular usable * Move inter-lib dependencies to a project variable and into the build targets * Bump B2 require to 5.2 * Update dependencies used in CI: compiler versions, tools, etc. --------- Co-authored-by: Hans Dembinski <hans.dembinski@gmail.com>
This commit is contained in:
committed by
GitHub
parent
66842660c0
commit
b5cce2833b
14
.github/workflows/cov.yml
vendored
14
.github/workflows/cov.yml
vendored
@@ -12,7 +12,7 @@ on:
|
|||||||
|
|
||||||
env:
|
env:
|
||||||
B2_OPTS: -q -j2 warnings-as-errors=on
|
B2_OPTS: -q -j2 warnings-as-errors=on
|
||||||
GCC_VERSION: 11
|
GCC_VERSION: 13
|
||||||
|
|
||||||
concurrency:
|
concurrency:
|
||||||
group: ${{ github.workflow }}-${{ github.head_ref }}
|
group: ${{ github.workflow }}-${{ github.head_ref }}
|
||||||
@@ -20,7 +20,7 @@ concurrency:
|
|||||||
|
|
||||||
jobs:
|
jobs:
|
||||||
cov:
|
cov:
|
||||||
runs-on: macos-11
|
runs-on: ubuntu-24.04
|
||||||
steps:
|
steps:
|
||||||
- uses: actions/checkout@v4
|
- uses: actions/checkout@v4
|
||||||
- name: Fetch Boost superproject
|
- name: Fetch Boost superproject
|
||||||
@@ -34,13 +34,7 @@ jobs:
|
|||||||
mv -f * $GITHUB_WORKSPACE
|
mv -f * $GITHUB_WORKSPACE
|
||||||
|
|
||||||
- name: Prepare b2
|
- name: Prepare b2
|
||||||
run: |
|
run: ./bootstrap.sh
|
||||||
./bootstrap.sh
|
|
||||||
./b2 headers
|
|
||||||
|
|
||||||
# simulate bundled boost by moving the headers instead of symlinking
|
|
||||||
rm -rf boost/histogram*
|
|
||||||
mv -f libs/histogram/include/boost/* boost
|
|
||||||
|
|
||||||
- name: Test cxxstd=latest coverage=on
|
- name: Test cxxstd=latest coverage=on
|
||||||
run: |
|
run: |
|
||||||
@@ -54,7 +48,7 @@ jobs:
|
|||||||
cd libs/histogram
|
cd libs/histogram
|
||||||
GCOV=gcov-${GCC_VERSION} tools/cov.py
|
GCOV=gcov-${GCC_VERSION} tools/cov.py
|
||||||
|
|
||||||
- uses: coverallsapp/github-action@v1.1.2
|
- uses: coverallsapp/github-action@v2
|
||||||
with:
|
with:
|
||||||
github-token: ${{ secrets.GITHUB_TOKEN }}
|
github-token: ${{ secrets.GITHUB_TOKEN }}
|
||||||
path-to-lcov: libs/histogram/coverage.info
|
path-to-lcov: libs/histogram/coverage.info
|
||||||
|
|||||||
34
.github/workflows/slow.yml
vendored
34
.github/workflows/slow.yml
vendored
@@ -46,31 +46,7 @@ jobs:
|
|||||||
cd libs/histogram
|
cd libs/histogram
|
||||||
../../b2 $B2_OPTS cxxstd=17 test//all
|
../../b2 $B2_OPTS cxxstd=17 test//all
|
||||||
|
|
||||||
gcc7:
|
gcc:
|
||||||
runs-on: ubuntu-20.04
|
|
||||||
steps:
|
|
||||||
- uses: actions/checkout@v4
|
|
||||||
- uses: egor-tensin/setup-gcc@v1
|
|
||||||
with:
|
|
||||||
version: 7
|
|
||||||
- name: Fetch Boost superproject
|
|
||||||
run: |
|
|
||||||
cd ..
|
|
||||||
git clone -b $GITHUB_BASE_REF --depth 5 https://github.com/boostorg/boost.git
|
|
||||||
cd boost
|
|
||||||
mv -f $GITHUB_WORKSPACE/* libs/histogram
|
|
||||||
git submodule update --init --depth 5 tools/build tools/boostdep
|
|
||||||
git submodule update --init --depth 5 libs/format
|
|
||||||
python tools/boostdep/depinst/depinst.py --git_args "--depth 5 --jobs 3" histogram
|
|
||||||
mv -f * $GITHUB_WORKSPACE
|
|
||||||
- name: Prepare b2
|
|
||||||
run: ./bootstrap.sh
|
|
||||||
- name: Test cxxstd=14 (warnings ignored)
|
|
||||||
run: |
|
|
||||||
cd libs/histogram
|
|
||||||
../../b2 -q -j2 toolset=gcc-7 cxxstd=14 test//all examples
|
|
||||||
|
|
||||||
gcc10:
|
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
steps:
|
steps:
|
||||||
- uses: actions/checkout@v4
|
- uses: actions/checkout@v4
|
||||||
@@ -86,12 +62,12 @@ jobs:
|
|||||||
mv -f * $GITHUB_WORKSPACE
|
mv -f * $GITHUB_WORKSPACE
|
||||||
- name: Prepare b2
|
- name: Prepare b2
|
||||||
run: ./bootstrap.sh
|
run: ./bootstrap.sh
|
||||||
- name: Test cxxstd=20 -O3 -funsafe-math-optimizations
|
- name: Test cxxstd=20 optimization=speed -funsafe-math-optimizations
|
||||||
run: |
|
run: |
|
||||||
cd libs/histogram
|
cd libs/histogram
|
||||||
../../b2 $B2_OPTS toolset=gcc-10 cxxstd=20 cxxflags="-O3 -funsafe-math-optimizations" test//all examples
|
../../b2 $B2_OPTS toolset=gcc cxxstd=20 optimization=speed cxxflags="-funsafe-math-optimizations" test//all examples
|
||||||
|
|
||||||
clang14:
|
clang:
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
steps:
|
steps:
|
||||||
- uses: actions/checkout@v4
|
- uses: actions/checkout@v4
|
||||||
@@ -109,4 +85,4 @@ jobs:
|
|||||||
- name: Test cxxstd=17 ubsan asan
|
- name: Test cxxstd=17 ubsan asan
|
||||||
run: |
|
run: |
|
||||||
cd libs/histogram
|
cd libs/histogram
|
||||||
../../b2 $B2_OPTS toolset=clang-14 cxxstd=17 variant=histogram_ubasan test//all
|
../../b2 $B2_OPTS toolset=clang cxxstd=17 variant=histogram_ubasan test//all
|
||||||
|
|||||||
22
.gitignore
vendored
22
.gitignore
vendored
@@ -13,4 +13,24 @@ tools/codecov
|
|||||||
coverage-report
|
coverage-report
|
||||||
.cache
|
.cache
|
||||||
venv
|
venv
|
||||||
.pytest_cache
|
.pytest_cache
|
||||||
|
!*.jam
|
||||||
|
*.vcxproj
|
||||||
|
*.vcxproj.filters
|
||||||
|
*.sln
|
||||||
|
BoostFetch.cmake
|
||||||
|
cmake_install.cmake
|
||||||
|
CMakeCache.txt
|
||||||
|
CMakeFiles
|
||||||
|
*.cmake
|
||||||
|
DartConfiguration.tcl
|
||||||
|
_deps
|
||||||
|
*.obj
|
||||||
|
*.recipe
|
||||||
|
*.ilk
|
||||||
|
*.pdb
|
||||||
|
*.lastbuildstate
|
||||||
|
*.tlog
|
||||||
|
*.exe
|
||||||
|
CTestCostData.txt
|
||||||
|
LastTest.log
|
||||||
@@ -19,7 +19,6 @@ target_link_libraries(boost_histogram
|
|||||||
Boost::mp11
|
Boost::mp11
|
||||||
Boost::throw_exception
|
Boost::throw_exception
|
||||||
Boost::variant2
|
Boost::variant2
|
||||||
Boost::math
|
|
||||||
)
|
)
|
||||||
|
|
||||||
target_compile_features(boost_histogram INTERFACE cxx_std_14)
|
target_compile_features(boost_histogram INTERFACE cxx_std_14)
|
||||||
|
|||||||
38
Jamfile
38
Jamfile
@@ -1,38 +0,0 @@
|
|||||||
# Copyright Mateusz Loskot 2018 <mateusz@loskot.net>
|
|
||||||
# Copyright Klemens David Morgenstern, Hans P. Dembinski 2016-2017
|
|
||||||
#
|
|
||||||
# Use, modification and distribution is subject to 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)
|
|
||||||
|
|
||||||
# Special builds for Boost Histogram:
|
|
||||||
#
|
|
||||||
# Generate coverage data: b2 cxxstd=latest coverage=on test//all
|
|
||||||
# Test without exceptions and rtti: b2 cxxstd=latest exception-handling=off rtti=off test//minimal
|
|
||||||
# Test with sanitizers: b2 toolset=clang cxxstd=latest histogram_ubasan test
|
|
||||||
|
|
||||||
import common ;
|
|
||||||
|
|
||||||
project
|
|
||||||
: requirements
|
|
||||||
<implicit-dependency>/boost//headers
|
|
||||||
<include>$(BOOST_ROOT)
|
|
||||||
<toolset>clang:<cxxflags>"-pedantic -Wextra -Wsign-compare -Wstrict-aliasing -fstrict-aliasing -Wvexing-parse -Wfloat-conversion -fvisibility=hidden -fvisibility-inlines-hidden"
|
|
||||||
<toolset>darwin:<cxxflags>"-pedantic -Wextra -Wsign-compare -Wstrict-aliasing -fstrict-aliasing -Wvexing-parse -Wfloat-conversion -fvisibility=hidden -fvisibility-inlines-hidden"
|
|
||||||
<toolset>gcc:<cxxflags>"-pedantic -Wextra -Wsign-compare -Wstrict-aliasing -fstrict-aliasing -Wfloat-conversion -fvisibility=hidden -fvisibility-inlines-hidden"
|
|
||||||
<toolset>msvc:<cxxflags>"/bigobj"
|
|
||||||
<toolset>intel-win:<cxxflags>"/bigobj"
|
|
||||||
: default-build
|
|
||||||
<warnings>all
|
|
||||||
;
|
|
||||||
|
|
||||||
path-constant THIS_PATH : . ;
|
|
||||||
|
|
||||||
# only works with clang because of -fsanitize-blacklist
|
|
||||||
variant histogram_ubasan : debug :
|
|
||||||
<cxxflags>"-fno-omit-frame-pointer -O0 -fno-inline -fsanitize=address,leak,undefined -fno-sanitize-recover=all -fsanitize-blacklist=$(THIS_PATH)/tools/blacklist.supp"
|
|
||||||
<linkflags>"-fsanitize=address,leak,undefined"
|
|
||||||
;
|
|
||||||
|
|
||||||
build-project test ;
|
|
||||||
build-project examples ;
|
|
||||||
50
build.jam
Normal file
50
build.jam
Normal file
@@ -0,0 +1,50 @@
|
|||||||
|
# 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)
|
||||||
|
|
||||||
|
require-b2 5.2 ;
|
||||||
|
|
||||||
|
# Special builds for Boost Histogram:
|
||||||
|
#
|
||||||
|
# Generate coverage data: b2 cxxstd=latest coverage=on test//all
|
||||||
|
# Test without exceptions and rtti: b2 cxxstd=latest exception-handling=off rtti=off test//minimal
|
||||||
|
# Test with sanitizers: b2 toolset=clang cxxstd=latest histogram_ubasan test
|
||||||
|
|
||||||
|
# boost/serialization and boost/math must not be included here, they are optional dependencies
|
||||||
|
constant boost_dependencies :
|
||||||
|
/boost/config//boost_config
|
||||||
|
/boost/core//boost_core
|
||||||
|
/boost/mp11//boost_mp11
|
||||||
|
/boost/throw_exception//boost_throw_exception
|
||||||
|
/boost/variant2//boost_variant2 ;
|
||||||
|
|
||||||
|
project /boost/histogram
|
||||||
|
: requirements
|
||||||
|
<toolset>clang:<cxxflags>"-Wsign-compare -Wstrict-aliasing -fstrict-aliasing -Wvexing-parse -Wfloat-conversion"
|
||||||
|
<toolset>darwin:<cxxflags>"-Wsign-compare -Wstrict-aliasing -fstrict-aliasing -Wvexing-parse -Wfloat-conversion"
|
||||||
|
<toolset>gcc:<cxxflags>"-Wsign-compare -Wstrict-aliasing -fstrict-aliasing -Wfloat-conversion"
|
||||||
|
<toolset>msvc:<cxxflags>"/bigobj"
|
||||||
|
<toolset>intel-win:<cxxflags>"/bigobj"
|
||||||
|
<local-visibility>hidden
|
||||||
|
: default-build
|
||||||
|
<warnings>extra
|
||||||
|
;
|
||||||
|
|
||||||
|
explicit
|
||||||
|
[ alias boost_histogram : : :
|
||||||
|
: <include>include <library>$(boost_dependencies) ]
|
||||||
|
[ alias all : boost_histogram test examples ]
|
||||||
|
;
|
||||||
|
|
||||||
|
call-if : boost-library histogram
|
||||||
|
;
|
||||||
|
|
||||||
|
path-constant THIS_PATH : . ;
|
||||||
|
|
||||||
|
# only works with clang because of -fsanitize-blacklist
|
||||||
|
variant histogram_ubasan : debug :
|
||||||
|
<cxxflags>"-fno-omit-frame-pointer -O0 -fno-inline -fsanitize=address,leak,undefined -fno-sanitize-recover=all -fsanitize-blacklist=$(THIS_PATH)/tools/blacklist.supp"
|
||||||
|
<linkflags>"-fsanitize=address,leak,undefined"
|
||||||
|
;
|
||||||
|
|
||||||
12
doc/Jamfile
12
doc/Jamfile
@@ -18,12 +18,12 @@ path-constant THIS_PATH : . ;
|
|||||||
|
|
||||||
doxygen reference
|
doxygen reference
|
||||||
:
|
:
|
||||||
$(THIS_PATH)/../../../boost/histogram.hpp
|
$(THIS_PATH)/../include/boost/histogram.hpp
|
||||||
[ glob $(THIS_PATH)/../../../boost/histogram/*.hpp ]
|
[ glob $(THIS_PATH)/../include/boost/histogram/*.hpp ]
|
||||||
[ glob $(THIS_PATH)/../../../boost/histogram/accumulators/*.hpp ]
|
[ glob $(THIS_PATH)/../include/boost/histogram/accumulators/*.hpp ]
|
||||||
[ glob $(THIS_PATH)/../../../boost/histogram/algorithm/*.hpp ]
|
[ glob $(THIS_PATH)/../include/boost/histogram/algorithm/*.hpp ]
|
||||||
[ glob $(THIS_PATH)/../../../boost/histogram/axis/*.hpp ]
|
[ glob $(THIS_PATH)/../include/boost/histogram/axis/*.hpp ]
|
||||||
[ glob $(THIS_PATH)/../../../boost/histogram/utility/*.hpp ]
|
[ glob $(THIS_PATH)/../include/boost/histogram/utility/*.hpp ]
|
||||||
:
|
:
|
||||||
<doxygen:param>QUIET=YES
|
<doxygen:param>QUIET=YES
|
||||||
<doxygen:param>WARNINGS=YES
|
<doxygen:param>WARNINGS=YES
|
||||||
|
|||||||
@@ -5,15 +5,21 @@
|
|||||||
# Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at
|
# Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at
|
||||||
# http://www.boost.org/LICENSE_1_0.txt)
|
# http://www.boost.org/LICENSE_1_0.txt)
|
||||||
|
|
||||||
|
require-b2 5.0.1 ;
|
||||||
|
|
||||||
|
import-search /boost/config/checks ;
|
||||||
|
|
||||||
import testing ;
|
import testing ;
|
||||||
import ../../config/checks/config : requires ;
|
import config : requires ;
|
||||||
|
|
||||||
project
|
project
|
||||||
: requirements
|
: requirements
|
||||||
|
<library>/boost/histogram//boost_histogram
|
||||||
[ requires
|
[ requires
|
||||||
cxx14_constexpr cxx14_decltype_auto cxx14_generic_lambdas cxx14_return_type_deduction cxx11_user_defined_literals
|
cxx14_constexpr cxx14_decltype_auto cxx14_generic_lambdas cxx14_return_type_deduction cxx11_user_defined_literals
|
||||||
# list could go on...
|
# list could go on...
|
||||||
]
|
]
|
||||||
|
<library>/boost/format//boost_format
|
||||||
;
|
;
|
||||||
|
|
||||||
alias cxx14 :
|
alias cxx14 :
|
||||||
|
|||||||
19
test/Jamfile
19
test/Jamfile
@@ -6,11 +6,15 @@
|
|||||||
# Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at
|
# Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at
|
||||||
# http://www.boost.org/LICENSE_1_0.txt)
|
# http://www.boost.org/LICENSE_1_0.txt)
|
||||||
|
|
||||||
|
require-b2 5.0.1 ;
|
||||||
|
|
||||||
|
import-search /boost/config/checks ;
|
||||||
|
|
||||||
import python ;
|
import python ;
|
||||||
import os ;
|
import os ;
|
||||||
import regex ;
|
import regex ;
|
||||||
import testing ;
|
import testing ;
|
||||||
import ../../config/checks/config : requires ;
|
import config : requires ;
|
||||||
|
|
||||||
if ! [ python.configured ]
|
if ! [ python.configured ]
|
||||||
{
|
{
|
||||||
@@ -21,6 +25,7 @@ path-constant THIS_PATH : . ;
|
|||||||
|
|
||||||
project
|
project
|
||||||
: requirements
|
: requirements
|
||||||
|
<library>/boost/histogram//boost_histogram
|
||||||
[ requires
|
[ requires
|
||||||
cxx14_constexpr cxx14_decltype_auto cxx14_generic_lambdas cxx14_return_type_deduction cxx11_user_defined_literals
|
cxx14_constexpr cxx14_decltype_auto cxx14_generic_lambdas cxx14_return_type_deduction cxx11_user_defined_literals
|
||||||
# list could go on...
|
# list could go on...
|
||||||
@@ -144,14 +149,14 @@ alias threading :
|
|||||||
|
|
||||||
# warnings are off for these other boost libraries, which tend to be not warning-free
|
# warnings are off for these other boost libraries, which tend to be not warning-free
|
||||||
alias math :
|
alias math :
|
||||||
[ run detail_normal_test.cpp ]
|
[ run detail_normal_test.cpp : : : <library>/boost/math//boost_math ]
|
||||||
[ run utility_clopper_pearson_interval_test.cpp ]
|
[ run utility_clopper_pearson_interval_test.cpp : : : <library>/boost/math//boost_math ]
|
||||||
[ run utility_jeffreys_interval_test.cpp ]
|
[ run utility_jeffreys_interval_test.cpp : : : <library>/boost/math//boost_math ]
|
||||||
: <warnings>off
|
: <warnings>off
|
||||||
;
|
;
|
||||||
alias accumulators : [ run boost_accumulators_support_test.cpp ] : <warnings>off ;
|
alias accumulators : [ run boost_accumulators_support_test.cpp : : : <library>/boost/accumulators//boost_accumulators ] : <warnings>off ;
|
||||||
alias range : [ run boost_range_support_test.cpp ] : <warnings>off ;
|
alias range : [ run boost_range_support_test.cpp : : : <library>/boost/range//boost_range ] : <warnings>off ;
|
||||||
alias units : [ run boost_units_support_test.cpp ] : <warnings>off ;
|
alias units : [ run boost_units_support_test.cpp : : : <library>/boost/units//boost_units ] : <warnings>off ;
|
||||||
alias serialization :
|
alias serialization :
|
||||||
[ run accumulators_serialization_test.cpp libserial : $(THIS_PATH) ]
|
[ run accumulators_serialization_test.cpp libserial : $(THIS_PATH) ]
|
||||||
[ run detail_array_wrapper_serialization_test.cpp libserial ]
|
[ run detail_array_wrapper_serialization_test.cpp libserial ]
|
||||||
|
|||||||
@@ -148,7 +148,17 @@ void run_tests() {
|
|||||||
// need to cast here for this to work with Tag == dynamic_tag, too
|
// need to cast here for this to work with Tag == dynamic_tag, too
|
||||||
const auto& ca = axis::get<axis::category<>>(c.axis());
|
const auto& ca = axis::get<axis::category<>>(c.axis());
|
||||||
BOOST_TEST_EQ(ca.bin(0), 1);
|
BOOST_TEST_EQ(ca.bin(0), 1);
|
||||||
|
// gcc-13 warns here, that a reference to a temporary is created, but the
|
||||||
|
// return object has the same lifetime as the histogram, and the pointer address
|
||||||
|
// is also correct (proving no copies are made), so we can ignore this warning
|
||||||
|
#if BOOST_WORKAROUND(BOOST_GCC, >= 13)
|
||||||
|
#pragma GCC diagnostic push
|
||||||
|
#pragma GCC diagnostic ignored "-Wdangling-reference"
|
||||||
|
#endif
|
||||||
const auto& ca2 = axis::get<axis::category<>>(c.axis(0));
|
const auto& ca2 = axis::get<axis::category<>>(c.axis(0));
|
||||||
|
#if BOOST_WORKAROUND(BOOST_GCC, >= 13)
|
||||||
|
#pragma GCC diagnostic pop
|
||||||
|
#endif
|
||||||
BOOST_TEST_EQ(&ca2, &ca);
|
BOOST_TEST_EQ(&ca2, &ca);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -6,8 +6,8 @@
|
|||||||
|
|
||||||
# script must be executed in project root folder
|
# script must be executed in project root folder
|
||||||
|
|
||||||
# NOTE: compute coverage with b2 toolset=gcc-8 cxxstd=latest coverage=on test//all
|
# NOTE: computing coverage only works properly with some gcc versions
|
||||||
# - computing coverage only works properly with gcc-8 right now
|
# - gcc-13 works ok
|
||||||
# - gcc-9 and gcc-10 are extremely slow
|
# - gcc-9 and gcc-10 are extremely slow
|
||||||
# - clang-10 works and is fast but misses a lot of unmissable lines
|
# - clang-10 works and is fast but misses a lot of unmissable lines
|
||||||
|
|
||||||
@@ -17,6 +17,9 @@ import os
|
|||||||
import sys
|
import sys
|
||||||
|
|
||||||
LCOV_VERSION = "1.16"
|
LCOV_VERSION = "1.16"
|
||||||
|
# lcov-2.x requires installing extra perl packages on Ubuntu-22
|
||||||
|
# apt install libcapture-tiny-perl libdatetime-perl libdatetime-format-dateparse-perl
|
||||||
|
# LCOV_VERSION = "2.3.1"
|
||||||
|
|
||||||
gcov = os.environ.get("GCOV", "gcov")
|
gcov = os.environ.get("GCOV", "gcov")
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user