Skip to content

Commit a35c0a9

Browse files
committed
Implement reusable Boost.CI workflow for GHA
Also added a cmake test script.
1 parent 565d0d7 commit a35c0a9

File tree

9 files changed

+212
-442
lines changed

9 files changed

+212
-442
lines changed

.github/workflows/ci.yml

Lines changed: 26 additions & 420 deletions
Large diffs are not rendered by default.

test/CMakeLists.txt

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
# Copyright 2018, 2019 Peter Dimov
2+
# Copyright 2025 James E. King III
3+
# Distributed under the Boost Software License, Version 1.0.
4+
# See accompanying file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt
5+
6+
include(BoostTestJamfile OPTIONAL RESULT_VARIABLE HAVE_BOOST_TEST)
7+
8+
if(HAVE_BOOST_TEST)
9+
10+
boost_test_jamfile(FILE Jamfile.v2 LINK_LIBRARIES Boost::numeric_interval Boost::core Boost::logic)
11+
12+
endif()
Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
# Copyright 2018, 2019, 2021 Peter Dimov
2+
# Distributed under the Boost Software License, Version 1.0.
3+
# See accompanying file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt
4+
5+
cmake_minimum_required(VERSION 3.5...3.20)
6+
7+
project(cmake_install_test LANGUAGES CXX)
8+
9+
find_package(boost_numeric_interval REQUIRED)
10+
11+
add_executable(main main.cpp)
12+
target_link_libraries(main Boost::numeric_interval)
13+
14+
enable_testing()
15+
add_test(main main)
16+
17+
add_custom_target(check VERBATIM COMMAND ${CMAKE_CTEST_COMMAND} --output-on-failure -C $<CONFIG>)

test/cmake_install_test/bugs.hpp

Lines changed: 43 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,43 @@
1+
/* Boost test/bugs.hpp
2+
* Handles namespace resolution quirks in older compilers and braindead
3+
* warnings [Herve, June 3rd 2003]
4+
*
5+
* Copyright 2002-2003 Hervé Brönnimann
6+
*
7+
* Distributed under the Boost Software License, Version 1.0.
8+
* (See accompanying file LICENSE_1_0.txt or
9+
* copy at http://www.boost.org/LICENSE_1_0.txt)
10+
*/
11+
12+
#include <boost/config.hpp>
13+
14+
// Borland compiler complains about unused variables a bit easily and
15+
// incorrectly
16+
17+
#ifdef BOOST_BORLANDC
18+
namespace detail {
19+
20+
template <class T> inline void ignore_unused_variable_warning(const T&) { }
21+
22+
inline void ignore_warnings() {
23+
# ifdef BOOST_NUMERIC_INTERVAL_CONSTANTS_HPP
24+
using namespace boost::numeric::interval_lib::constants;
25+
ignore_unused_variable_warning( pi_f_l );
26+
ignore_unused_variable_warning( pi_f_u );
27+
ignore_unused_variable_warning( pi_d_l );
28+
ignore_unused_variable_warning( pi_d_u );
29+
# endif
30+
}
31+
32+
}
33+
#endif
34+
35+
// Some compilers are broken with respect to name resolution
36+
37+
#if defined(BOOST_NO_ARGUMENT_DEPENDENT_LOOKUP) || defined( BOOST_BORLANDC)
38+
39+
using namespace boost;
40+
using namespace numeric;
41+
using namespace interval_lib;
42+
43+
#endif

test/cmake_test/main.cpp renamed to test/cmake_install_test/main.cpp

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,9 @@
1010

1111
#include <boost/numeric/interval.hpp>
1212
#include <boost/numeric/interval/ext/integer.hpp>
13+
#ifdef BOOST_BORLANDC
1314
#include "bugs.hpp"
15+
#endif
1416

1517
typedef boost::numeric::interval<float> I;
1618

test/cmake_subdir_test/CMakeLists.txt

Lines changed: 43 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,43 @@
1+
# Copyright 2018, 2019, 2021 Peter Dimov
2+
# Distributed under the Boost Software License, Version 1.0.
3+
# See accompanying file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt
4+
5+
cmake_minimum_required(VERSION 3.5...3.20)
6+
7+
project(cmake_subdir_test LANGUAGES CXX)
8+
9+
add_subdirectory(../.. boostorg/numeric/interval)
10+
11+
# `boostdep --brief numeric~interval`
12+
13+
set(deps
14+
15+
# Primary dependencies
16+
17+
config
18+
detail
19+
logic
20+
21+
# Secondary dependencies
22+
23+
core
24+
preprocessor
25+
static_assert
26+
type_traits
27+
assert
28+
throw_exception
29+
)
30+
31+
foreach(dep IN LISTS deps)
32+
33+
add_subdirectory(../../../../${dep} boostorg/${dep})
34+
35+
endforeach()
36+
37+
add_executable(main main.cpp)
38+
target_link_libraries(main Boost::numeric_interval)
39+
40+
enable_testing()
41+
add_test(main main)
42+
43+
add_custom_target(check VERBATIM COMMAND ${CMAKE_CTEST_COMMAND} --output-on-failure -C $<CONFIG>)

test/cmake_subdir_test/bugs.hpp

Lines changed: 43 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,43 @@
1+
/* Boost test/bugs.hpp
2+
* Handles namespace resolution quirks in older compilers and braindead
3+
* warnings [Herve, June 3rd 2003]
4+
*
5+
* Copyright 2002-2003 Hervé Brönnimann
6+
*
7+
* Distributed under the Boost Software License, Version 1.0.
8+
* (See accompanying file LICENSE_1_0.txt or
9+
* copy at http://www.boost.org/LICENSE_1_0.txt)
10+
*/
11+
12+
#include <boost/config.hpp>
13+
14+
// Borland compiler complains about unused variables a bit easily and
15+
// incorrectly
16+
17+
#ifdef BOOST_BORLANDC
18+
namespace detail {
19+
20+
template <class T> inline void ignore_unused_variable_warning(const T&) { }
21+
22+
inline void ignore_warnings() {
23+
# ifdef BOOST_NUMERIC_INTERVAL_CONSTANTS_HPP
24+
using namespace boost::numeric::interval_lib::constants;
25+
ignore_unused_variable_warning( pi_f_l );
26+
ignore_unused_variable_warning( pi_f_u );
27+
ignore_unused_variable_warning( pi_d_l );
28+
ignore_unused_variable_warning( pi_d_u );
29+
# endif
30+
}
31+
32+
}
33+
#endif
34+
35+
// Some compilers are broken with respect to name resolution
36+
37+
#if defined(BOOST_NO_ARGUMENT_DEPENDENT_LOOKUP) || defined( BOOST_BORLANDC)
38+
39+
using namespace boost;
40+
using namespace numeric;
41+
using namespace interval_lib;
42+
43+
#endif

test/cmake_subdir_test/main.cpp

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
/* Boost test/integer.cpp
2+
* test int extension
3+
*
4+
* Copyright 2003 Guillaume Melquiond
5+
*
6+
* Distributed under the Boost Software License, Version 1.0.
7+
* (See accompanying file LICENSE_1_0.txt or
8+
* copy at http://www.boost.org/LICENSE_1_0.txt)
9+
*/
10+
11+
#include <boost/numeric/interval.hpp>
12+
#include <boost/numeric/interval/ext/integer.hpp>
13+
#ifdef BOOST_BORLANDC
14+
#include "bugs.hpp"
15+
#endif
16+
17+
typedef boost::numeric::interval<float> I;
18+
19+
int main() {
20+
I x, y;
21+
x = 4 - (2 * y + 1) / 3;
22+
# ifdef BOOST_BORLANDC
23+
::detail::ignore_warnings();
24+
# endif
25+
return 0;
26+
}

test/cmake_test/CMakeLists.txt

Lines changed: 0 additions & 22 deletions
This file was deleted.

0 commit comments

Comments
 (0)