Compare commits

...

43 Commits

Author SHA1 Message Date
9a6a86efc8 Merge pull request #17 from grafikrobot/modular
Add support for modular build structure.
2025-04-15 18:33:22 +01:00
82e8219497 Set a less likely to comflict cmake build dir. 2025-04-09 21:48:37 -05:00
b78ae8e44c Set testing to special value to get ignored tests. 2025-04-09 21:23:50 -05:00
4df5eb93a3 Set the correct cmake dir to work in. 2025-04-09 21:02:58 -05:00
acbd163624 Tell ctest to ignore not having tests. 2025-04-09 20:31:48 -05:00
28277d9854 Need to condition cmake tests on having tests. 2025-04-09 18:54:18 -05:00
91ddf94f3c CMake 3.5 fails to run. 2025-04-09 18:43:27 -05:00
223997c70c Fix cmake build target, test minor msvc version, and specify the correct min cmake. 2025-04-09 18:32:25 -05:00
e74f1d4f6e Workaround not having cmake tests. 2025-04-09 18:24:10 -05:00
bccba72bff Fix library name in GHA CI. 2025-04-07 09:07:01 -05:00
140907f843 Replace GHA CI with simpler working one based on alandefreitas/cpp-actions utilities. 2025-04-07 08:58:35 -05:00
aa4e60bd88 Move inter-lib dependencies to a project variable and into the build targets. 2024-07-23 22:34:23 -05:00
54412f7937 Update copyright dates. 2024-07-20 22:52:04 -05:00
c65f0cd147 Change all <source> references to <library>. 2024-07-20 21:26:14 -05:00
18ab3e9250 Bump B2 require to 5.2 2024-06-14 11:33:56 -05:00
13690ce9b5 Add requires-b2 check to top-level build file. 2024-05-05 09:00:01 -05:00
8df439fa03 Switch to library requirements instead of source. As source puts extra source in install targets. 2024-03-29 21:15:59 -05:00
9519349ab9 Make the library modular usable. 2024-03-11 08:38:17 -05:00
45eec41c29 Merge pull request #15 from sdarwin/githubactions
GitHub Actions config
2022-03-08 09:35:50 +00:00
a1abfec1ef Update GitHub Actions CI file 2022-03-07 20:16:18 +00:00
ba72d3340f Merge pull request #16 from igaztanaga/patch-1
Small fix for Wsign-conversion
2021-10-13 16:03:23 +01:00
803b983da7 Small fix for Wsign-conversion 2021-10-13 15:10:36 +02:00
392199f6b1 Fix CMake tests in .travis.yml 2021-06-10 16:34:02 +03:00
482e81cddd Update CMakeLists.txt 2021-06-10 02:06:15 +03:00
6ec69e506c Add GitHub Actions config [ci skip] 2021-03-04 18:23:07 +00:00
66db74297a Merge pull request #13 from eldiener/develop
[skip ci] Add "cxxstd" json field
2021-01-21 18:01:26 +00:00
e9ab97859d [skip ci] Add "cxxstd" json field. The "cxxstd" json field is being added to each Boost library's meta json information for libraries in order to specify the minumum C++ standard compilation level. The value of this field matches one of the values for 'cxxstd' in Boost.Build. The purpose of doing this is to provide information for the Boost website documentation for each library which will specify the minimum C++ standard compilation that an end-user must employ in order to use the particular library. This will aid end-users who want to know if they can successfully use a Boost library based on their C++ compiler's compilation level, without having to search the library's documentation to find this out. 2021-01-21 11:09:31 -05:00
073c482606 Merge pull request #11 from eldiener/develop
Changes for Embarcadero C++ clang-based compilers, targeting Boost 1.74. Use BOOST_BORLANDC for bcc32 compiler
2020-05-06 17:34:09 +01:00
8ab850a342 Use BOOST_BORLANDC for bcc32 compiler 2020-03-21 22:24:50 -04:00
9102d74933 Merge branch 'develop' into feature/add-cmake-tests 2020-01-06 20:11:01 +02:00
317f01fc58 Merge branch 'develop' into feature/add-cmake-tests 2019-12-29 20:06:15 +02:00
b57860c33f Use -DBOOST_INCLUDE_LIBRARIES=static_assert 2019-12-29 19:34:08 +02:00
ca94dbbc1a Use Boost_VERBOSE instead of Boost_DEBUG 2019-12-29 18:52:09 +02:00
0a775cf1c5 Untabify 2019-12-29 18:47:06 +02:00
944702b862 Add comment 2019-12-27 06:04:16 +02:00
1aaabeb02b Fix indentation 2019-12-27 04:28:29 +02:00
9064caf95f Merge branch 'pr/add-cmake-install' into feature/add-cmake-tests 2019-12-27 04:24:37 +02:00
ad48daf3b2 Change LIBRARIES to LINK_LIBRARIES 2019-12-27 04:20:36 +02:00
c6b558f1f2 Fix branch handling; add -j3 to b2 test 2019-12-27 03:32:34 +02:00
00724b8429 Fix .travis.yml typos; enable feature/* testing 2019-12-27 03:29:28 +02:00
00a741184c Add cmake_install_test, cmake_subdir_test 2019-12-26 19:05:07 +02:00
f000d27cb2 Add CMake testing job to Travis 2019-12-26 19:00:25 +02:00
a8597c46d5 Add CMake testing support 2019-12-26 18:58:11 +02:00
15 changed files with 313 additions and 54 deletions

152
.github/workflows/ci.yml vendored Normal file
View File

@ -0,0 +1,152 @@
name: GitHub Actions CI
on:
pull_request:
push:
branches:
- master
- develop
- githubactions*
- feature/**
- fix/**
- pr/**
jobs:
cpp-matrix:
runs-on: ubuntu-latest
name: Generate Test Matrix
outputs:
matrix: ${{ steps.cpp-matrix.outputs.matrix }}
steps:
- name: Generate Test Matrix
uses: alandefreitas/cpp-actions/cpp-matrix@master
id: cpp-matrix
with:
extra-values: |
boost-lib: static_assert
scan-dirs: test
compilers: |
gcc >= 4.8
clang >= 3.5
msvc >= 14.0
apple-clang *
mingw *
clang-cl *
subrange-policy: |
msvc: one-per-minor
standards: ">=11"
latest-factors: |
gcc Asan TSan UBSan
clang BoundsSan IntSan
factors: |
gcc Shared
msvc Shared x86
mingw Shared
trace-commands: true
build:
needs: cpp-matrix
strategy:
fail-fast: false
matrix:
include: ${{ fromJSON(needs.cpp-matrix.outputs.matrix) }}
# use matrix entries
name: ${{ matrix.name }}
runs-on: ${{ matrix.runs-on }}
container: ${{ matrix.container }}
steps:
# GitHub Actions no longer support older containers.
# The workaround is to install our own Node.js for the actions.
- name: Patch Node
# The containers that need Node.js 20 will have volumes set up so that
# the Node.js 20 installation can go there.
if: ${{ matrix.container.volumes }}
run: |
set -x
apt-get update
apt-get install -y curl xz-utils
curl -LO https://archives.boost.io/misc/node/node-v20.9.0-linux-x64-glibc-217.tar.xz
tar -xf node-v20.9.0-linux-x64-glibc-217.tar.xz --strip-components 1 -C /node20217
ldd /__e/node20/bin/node
- name: Setup C++ Compiler
uses: alandefreitas/cpp-actions/setup-cpp@master
id: setup-cpp
with:
compiler: ${{ matrix.compiler }}
version: ${{ matrix.version }}
- name: Install Packages
if: matrix.install != ''
uses: alandefreitas/cpp-actions/package-install@master
id: package-install
with:
apt-get: ${{ matrix.install }}
- name: Clone Library
uses: actions/checkout@v4
- name: Clone Boost
uses: alandefreitas/cpp-actions/boost-clone@master
id: boost-clone
with:
branch: ${{ (github.ref_name == 'master' && github.ref_name) || 'develop' }}
boost-dir: ../boost-root
scan-modules-dir: .
scan-modules-ignore: ${{ matrix.boost-lib }}
modules-scan-paths: ${{ matrix.scan-dirs }}
cache: false
- name: Copy Library
shell: bash
run: |
workspace_root=$(echo "$GITHUB_WORKSPACE" | sed 's/\\/\//g')
cd ../boost-root
rm -rf "libs/${{ matrix.boost-lib }}"
mkdir "libs/${{ matrix.boost-lib }}"
cp -r "$workspace_root"/* "libs/${{ matrix.boost-lib }}"
- name: B2 Workflow
uses: alandefreitas/cpp-actions/b2-workflow@master
with:
source-dir: ${{ steps.boost-clone.outputs.boost-dir }}
modules: ${{ matrix.boost-lib }}
toolset: ${{ matrix.b2-toolset }}
build-variant: ${{ matrix.build-type }}
cxx: ${{ steps.setup-cpp.outputs.cxx || '' }}
cxxstd: ${{ matrix.cxxstd }}
address-model: ${{ matrix.address-model }}
asan: ${{ matrix.asan }}
ubsan: ${{ matrix.ubsan }}
tsan: ${{ matrix.tsan }}
shared: ${{ matrix.shared }}
abbreviate-paths: false
hash: true
debug-configuration: true
trace-commands: true
- name: CMake Workflow
uses: alandefreitas/cpp-actions/cmake-workflow@master
with:
source-dir: ${{ steps.boost-clone.outputs.boost-dir }}/libs/${{ matrix.boost-lib }}
build-dir: _build_dir_
run-tests: ignore
install: true
cmake-version: ">=3.31"
generator: ${{ matrix.generator }}
generator-toolset: ${{ matrix.generator-toolset }}
toolchain: ${{ steps.package-install.outputs.vcpkg-toolchain }}
build-type: ${{ matrix.build-type }}
install-prefix: .local
cxxstd: ${{ matrix.cxxstd }}
cc: ${{ steps.setup-cpp.outputs.cc }}
ccflags: ${{ matrix.ccflags }}
cxx: ${{ steps.setup-cpp.outputs.cxx }}
cxxflags: ${{ matrix.cxxflags }}
shared: ${{ matrix.shared }}
extra-args:
"${{ ( !matrix.no-deps && format('-D BOOST_SRC_DIR=\"{0}\"', steps.boost-clone.outputs.boost-dir)\
\ ) || '' }} \n${{ ( matrix.no-deps && '-D CPP_ACTIONS_NO_DEPS=ON' ) || '' }}\n"
export-compile-commands: ${{ matrix.time-trace }}
trace-commands: true

View File

@ -271,6 +271,37 @@ matrix:
packages:
- libc++-dev
- os: linux
env: CMAKE=1
script:
- mkdir __build__ && cd __build__
- cmake -DBUILD_TESTING=ON -DBOOST_INCLUDE_LIBRARIES=static_assert ..
- cmake --build . --target tests
- ctest --output-on-failure
- os: linux
env: CMAKE_SUBDIR=1
install:
- BOOST_BRANCH=develop && [ "$TRAVIS_BRANCH" == "master" ] && BOOST_BRANCH=master || true
- git clone -b $BOOST_BRANCH https://github.com/boostorg/config.git ../config
script:
- cd test/cmake_subdir_test && mkdir __build__ && cd __build__
- cmake ..
- cmake --build .
- cmake --build . --target check
- os: linux
env: CMAKE_INSTALL=1
script:
- pip install --user cmake
- mkdir __build__ && cd __build__
- cmake -DBOOST_INCLUDE_LIBRARIES=static_assert -DCMAKE_INSTALL_PREFIX=~/.local ..
- cmake --build . --target install
- cd ../libs/static_assert/test/cmake_install_test && mkdir __build__ && cd __build__
- cmake -DCMAKE_INSTALL_PREFIX=~/.local ..
- cmake --build .
- cmake --build . --target check
- os: osx
compiler: clang++
env: TOOLSET=clang COMPILER=clang++ CXXSTD=03,11,14,1z

View File

@ -14,16 +14,15 @@ add_library(Boost::static_assert ALIAS boost_static_assert)
target_include_directories(boost_static_assert INTERFACE include)
target_link_libraries(boost_static_assert
INTERFACE
Boost::config
INTERFACE
Boost::config
)
# boost_install requires PROJECT_VERSION
# Without the superproject, we don't have any, so skip installation
# BUILD_TESTING is the standard CTest variable that enables testing
if(BOOST_SUPERPROJECT_VERSION)
if(BUILD_TESTING)
include(BoostInstall)
boost_install(TARGETS boost_static_assert HEADER_DIRECTORY include/)
add_subdirectory(test)
add_subdirectory(example)
endif()

View File

@ -1,9 +0,0 @@
# copyright John Maddock 2003
# Use, modification and distribution are 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)
# bring in the rules for testing
import testing ;
build-project test ;

23
build.jam Normal file
View File

@ -0,0 +1,23 @@
# 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/config//boost_config ;
project /boost/static_assert
: common-requirements
<include>include
;
explicit
[ alias boost_static_assert : : : : <library>$(boost_dependencies) ]
[ alias all : boost_static_assert example test ]
;
call-if : boost-library static_assert
;

11
example/CMakeLists.txt Normal file
View File

@ -0,0 +1,11 @@
# Copyright 2018, 2019 Peter Dimov
# 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
include(BoostTestJamfile OPTIONAL RESULT_VARIABLE HAVE_BOOST_TEST)
if(HAVE_BOOST_TEST)
boost_test_jamfile(FILE Jamfile.v2 LINK_LIBRARIES Boost::static_assert Boost::type_traits)
endif()

View File

@ -1,20 +1,15 @@
# copyright John Maddock 2003
# Use, modification and distribution are subject to the
# Boost Software License, Version 1.0. (See accompanying file
# Use, modification and distribution are 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)
# bring in the rules for testing
import testing ;
test-suite static_assert :
# [ run static_assert_example_1.cpp ]
[ run static_assert_example_2.cpp ]
[ run static_assert_example_3.cpp ]
;
project : requirements
<library>/boost/type_traits//boost_type_traits
;
#run static_assert_example_1.cpp ;
run static_assert_example_2.cpp ;
run static_assert_example_3.cpp ;

View File

@ -16,6 +16,7 @@
#include <boost/config.hpp>
#include <boost/detail/workaround.hpp>
#include <cstddef> //for std::size_t
#if defined(__GNUC__) && !defined(__GXX_EXPERIMENTAL_CXX0X__)
//
@ -36,7 +37,7 @@
# define BOOST_STATIC_ASSERT_MSG( B, Msg ) BOOST_STATIC_ASSERT( B )
#endif
#ifdef __BORLANDC__
#ifdef BOOST_BORLANDC
//
// workaround for buggy integral-constant expression support:
#define BOOST_BUGGY_INTEGRAL_CONSTANT_EXPRESSIONS
@ -81,7 +82,7 @@ template <bool x> struct STATIC_ASSERTION_FAILURE;
template <> struct STATIC_ASSERTION_FAILURE<true> { enum { value = 1 }; };
// HP aCC cannot deal with missing names for template value parameters
template<int x> struct static_assert_test{};
template<std::size_t x> struct static_assert_test{};
}

View File

@ -12,5 +12,6 @@
],
"maintainers": [
"John Maddock <john -at- johnmaddock.co.uk>"
]
],
"cxxstd": "03"
}

11
test/CMakeLists.txt Normal file
View File

@ -0,0 +1,11 @@
# Copyright 2018, 2019 Peter Dimov
# 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
include(BoostTestJamfile OPTIONAL RESULT_VARIABLE HAVE_BOOST_TEST)
if(HAVE_BOOST_TEST)
boost_test_jamfile(FILE Jamfile.v2 LINK_LIBRARIES Boost::static_assert)
endif()

View File

@ -1,30 +1,25 @@
# copyright John Maddock 2003
# Use, modification and distribution are subject to the
# Boost Software License, Version 1.0. (See accompanying file
# Use, modification and distribution are 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)
# bring in the rules for testing
import testing ;
test-suite static_assert :
[ run static_assert_test.cpp ]
[ compile-fail static_assert_test_fail_1.cpp ]
[ compile-fail static_assert_test_fail_2.cpp ]
[ compile-fail static_assert_test_fail_3.cpp ]
[ compile-fail static_assert_test_fail_4.cpp ]
[ compile-fail static_assert_test_fail_5.cpp ]
[ compile-fail static_assert_test_fail_6.cpp ]
[ compile-fail static_assert_test_fail_7.cpp ]
[ compile-fail static_assert_test_fail_8.cpp ]
[ compile-fail static_assert_test_fail_9.cpp ]
[ compile-fail static_assert_test_fail_10.cpp ]
;
project : requirements
<library>/boost/type_traits//boost_type_traits
;
run static_assert_test.cpp ;
compile-fail static_assert_test_fail_1.cpp ;
compile-fail static_assert_test_fail_2.cpp ;
compile-fail static_assert_test_fail_3.cpp ;
compile-fail static_assert_test_fail_4.cpp ;
compile-fail static_assert_test_fail_5.cpp ;
compile-fail static_assert_test_fail_6.cpp ;
compile-fail static_assert_test_fail_7.cpp ;
compile-fail static_assert_test_fail_8.cpp ;
compile-fail static_assert_test_fail_9.cpp ;
compile-fail static_assert_test_fail_10.cpp ;
build-project ../example ;

View File

@ -0,0 +1,17 @@
# Copyright 2018, 2019 Peter Dimov
# 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
cmake_minimum_required(VERSION 3.5...3.16)
project(cmake_install_test LANGUAGES CXX)
find_package(boost_static_assert REQUIRED)
add_executable(main main.cpp)
target_link_libraries(main Boost::static_assert)
enable_testing()
add_test(NAME main COMMAND main)
add_custom_target(check COMMAND ${CMAKE_CTEST_COMMAND} --output-on-failure -C $<CONFIG>)

View File

@ -0,0 +1,7 @@
#include <boost/static_assert.hpp>
int main()
{
int const x = 5;
BOOST_STATIC_ASSERT( x > 4 );
}

View File

@ -0,0 +1,18 @@
# Copyright 2018, 2019 Peter Dimov
# 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
cmake_minimum_required(VERSION 3.5...3.16)
project(cmake_subdir_test LANGUAGES CXX)
add_subdirectory(../../../static_assert boostorg/static_assert)
add_subdirectory(../../../config boostorg/config)
add_executable(main main.cpp)
target_link_libraries(main Boost::static_assert)
enable_testing()
add_test(NAME main COMMAND main)
add_custom_target(check COMMAND ${CMAKE_CTEST_COMMAND} --output-on-failure -C $<CONFIG>)

View File

@ -0,0 +1,7 @@
#include <boost/static_assert.hpp>
int main()
{
int const x = 5;
BOOST_STATIC_ASSERT( x > 4 );
}