Skip to content

Add support for modular build structure. #401

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Draft
wants to merge 26 commits into
base: develop
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
26 commits
Select commit Hold shift + click to select a range
fa58a7d
Make the library modular usable.
grafikrobot Mar 11, 2024
558e940
Sync from upstream.
grafikrobot Apr 25, 2024
5c2aae0
Add missing build.jam.
grafikrobot Apr 25, 2024
73322d8
Sync from upstream.
grafikrobot Apr 26, 2024
6a8ded2
Add requires-b2 check to top-level build file.
grafikrobot May 5, 2024
742c1fc
Bump B2 require to 5.2
grafikrobot Jun 14, 2024
2e23333
Change all <source> references to <library>.
grafikrobot Jul 21, 2024
6fd1394
Move inter-lib dependencies to a project variable and into the build …
grafikrobot Jul 24, 2024
0215543
Update build deps.
grafikrobot Aug 3, 2024
e159009
Change math dep real target math/tr1.
grafikrobot Aug 11, 2024
de48f63
Tweak GHA CI to use default compilers.
grafikrobot Apr 7, 2025
dad84fd
Avoid another warning from math.
grafikrobot Apr 10, 2025
3d32bf8
Avoid another warning from math.
grafikrobot Apr 10, 2025
e6d9250
Move include to target.
grafikrobot Apr 17, 2025
3259c75
Update dependencies.
grafikrobot Apr 29, 2025
f3e62dc
Add command output to slow tests for debugging build problems.
grafikrobot Apr 29, 2025
90778c2
Use b2 property instead of direct flag.
grafikrobot May 9, 2025
3791d5e
Always use latest macos image.
grafikrobot May 9, 2025
31015c6
Fix dnagling reference warning/error.
grafikrobot May 9, 2025
da68b50
Revert: Fix dangling reference warning/error.
grafikrobot May 9, 2025
ee9453b
Bump cov gcc version to match what's in the OS.
grafikrobot May 9, 2025
4456293
ignores
HDembinski May 17, 2025
c713d7a
boost-serialization is optional
HDembinski May 17, 2025
daf49a6
fix
HDembinski May 17, 2025
cb08d27
attempted fix
HDembinski May 17, 2025
f695ea9
Try and force the tests to build.
grafikrobot May 18, 2025
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions .github/workflows/cov.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,16 +11,16 @@ on:
- '*.md'

env:
B2_OPTS: -q -j2 warnings-as-errors=on
GCC_VERSION: 11
B2_OPTS: -q -a warnings-as-errors=on
GCC_VERSION: 15

concurrency:
group: ${{ github.workflow }}-${{ github.head_ref }}
cancel-in-progress: true

jobs:
cov:
runs-on: macos-11
runs-on: macos-latest
steps:
- uses: actions/checkout@v4
- name: Fetch Boost superproject
Expand Down
36 changes: 6 additions & 30 deletions .github/workflows/slow.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ concurrency:
cancel-in-progress: true

env:
B2_OPTS: -q -j2 warnings-as-errors=on
B2_OPTS: -q -j2 -d+2 warnings-as-errors=on
UBSAN_OPTIONS: print_stacktrace=1
LSAN_OPTIONS: verbosity=1:log_threads=1
ASAN_OPTIONS: detect_leaks=1:detect_stack_use_after_return=1
Expand Down Expand Up @@ -46,31 +46,7 @@ jobs:
cd libs/histogram
../../b2 $B2_OPTS cxxstd=17 test//all

gcc7:
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:
gcc:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
Expand All @@ -86,12 +62,12 @@ jobs:
mv -f * $GITHUB_WORKSPACE
- name: Prepare b2
run: ./bootstrap.sh
- name: Test cxxstd=20 -O3 -funsafe-math-optimizations
- name: Test cxxstd=20 optimization=speed -funsafe-math-optimizations
run: |
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
steps:
- uses: actions/checkout@v4
Expand All @@ -109,4 +85,4 @@ jobs:
- name: Test cxxstd=17 ubsan asan
run: |
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
13 changes: 12 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -13,4 +13,15 @@ tools/codecov
coverage-report
.cache
venv
.pytest_cache
.pytest_cache
!*.jam
*.vcxproj
*.vcxproj.filters
*.sln
BoostFetch.cmake
cmake_install.cmake
CMakeCache.txt
CMakeFiles
*.cmake
DartConfiguration.tcl
_deps
2 changes: 1 addition & 1 deletion CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -16,10 +16,10 @@ target_link_libraries(boost_histogram
INTERFACE
Boost::config
Boost::core
Boost::math
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should you remove that to mirror the b2 side where math is optional?

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Maybe, but it does cause so many problems, because it is header only.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I failed to parse that sentence. :-( Just saying the it's preferred to be consistent between the two build systems.

Boost::mp11
Boost::throw_exception
Boost::variant2
Boost::math
)

target_compile_features(boost_histogram INTERFACE cxx_std_14)
Expand Down
38 changes: 0 additions & 38 deletions Jamfile

This file was deleted.

50 changes: 50 additions & 0 deletions build.jam
Original file line number Diff line number Diff line change
@@ -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 changes: 6 additions & 6 deletions doc/Jamfile
Original file line number Diff line number Diff line change
Expand Up @@ -18,12 +18,12 @@ path-constant THIS_PATH : . ;

doxygen reference
:
$(THIS_PATH)/../../../boost/histogram.hpp
[ glob $(THIS_PATH)/../../../boost/histogram/*.hpp ]
[ glob $(THIS_PATH)/../../../boost/histogram/accumulators/*.hpp ]
[ glob $(THIS_PATH)/../../../boost/histogram/algorithm/*.hpp ]
[ glob $(THIS_PATH)/../../../boost/histogram/axis/*.hpp ]
[ glob $(THIS_PATH)/../../../boost/histogram/utility/*.hpp ]
$(THIS_PATH)/../include/boost/histogram.hpp
[ glob $(THIS_PATH)/../include/boost/histogram/*.hpp ]
[ glob $(THIS_PATH)/../include/boost/histogram/accumulators/*.hpp ]
[ glob $(THIS_PATH)/../include/boost/histogram/algorithm/*.hpp ]
[ glob $(THIS_PATH)/../include/boost/histogram/axis/*.hpp ]
[ glob $(THIS_PATH)/../include/boost/histogram/utility/*.hpp ]
:
<doxygen:param>QUIET=YES
<doxygen:param>WARNINGS=YES
Expand Down
8 changes: 7 additions & 1 deletion examples/Jamfile
Original file line number Diff line number Diff line change
Expand Up @@ -5,15 +5,21 @@
# 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 testing ;
import ../../config/checks/config : requires ;
import config : requires ;

project
: requirements
<library>/boost/histogram//boost_histogram
[ requires
cxx14_constexpr cxx14_decltype_auto cxx14_generic_lambdas cxx14_return_type_deduction cxx11_user_defined_literals
# list could go on...
]
<library>/boost/format//boost_format
;

alias cxx14 :
Expand Down
2 changes: 1 addition & 1 deletion include/boost/histogram/axis/variant.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -253,7 +253,7 @@ template <class T, class... Us>
decltype(auto) get(variant<Us...>&& v) {
auto tp = get_if<T>(&v);
if (!tp) BOOST_THROW_EXCEPTION(std::runtime_error("T is not the held type"));
return std::move(*tp);
return *tp;
}

/// Return const reference to T, throws unspecified exception if type does not match.
Expand Down
19 changes: 12 additions & 7 deletions test/Jamfile
Original file line number Diff line number Diff line change
Expand Up @@ -6,11 +6,15 @@
# 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 regex ;
import testing ;
import ../../config/checks/config : requires ;
import config : requires ;

if ! [ python.configured ]
{
Expand All @@ -21,6 +25,7 @@ path-constant THIS_PATH : . ;

project
: requirements
<library>/boost/histogram//boost_histogram
[ requires
cxx14_constexpr cxx14_decltype_auto cxx14_generic_lambdas cxx14_return_type_deduction cxx11_user_defined_literals
# list could go on...
Expand Down Expand Up @@ -144,14 +149,14 @@ alias threading :

# warnings are off for these other boost libraries, which tend to be not warning-free
alias math :
[ run detail_normal_test.cpp ]
[ run utility_clopper_pearson_interval_test.cpp ]
[ run utility_jeffreys_interval_test.cpp ]
[ run detail_normal_test.cpp : : : <library>/boost/math//boost_math ]
[ run utility_clopper_pearson_interval_test.cpp : : : <library>/boost/math//boost_math ]
[ run utility_jeffreys_interval_test.cpp : : : <library>/boost/math//boost_math ]
: <warnings>off
;
alias accumulators : [ run boost_accumulators_support_test.cpp ] : <warnings>off ;
alias range : [ run boost_range_support_test.cpp ] : <warnings>off ;
alias units : [ run boost_units_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 : : : <library>/boost/range//boost_range ] : <warnings>off ;
alias units : [ run boost_units_support_test.cpp : : : <library>/boost/units//boost_units ] : <warnings>off ;
alias serialization :
[ run accumulators_serialization_test.cpp libserial : $(THIS_PATH) ]
[ run detail_array_wrapper_serialization_test.cpp libserial ]
Expand Down
Loading