Skip to content

Commit a6f99e5

Browse files
committed
Add cmake tests on github actions and add cmake scripts for index
1 parent 7fa4bf7 commit a6f99e5

File tree

6 files changed

+166
-5
lines changed

6 files changed

+166
-5
lines changed

.github/workflows/cmake.yml

+104
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,104 @@
1+
##############################################################################
2+
# GitHub Actions Workflow for Boost.Geometry to build tests with cmake
3+
#
4+
# Copyright (c) 2024 Oracle and/or its affiliates.
5+
# Contributed and/or modified by Vissarion Fysikopoulos, on behalf of Oracle
6+
#
7+
# Use, modification and distribution is subject to the Boost Software License,
8+
# Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at
9+
# http://www.boost.org/LICENSE_1_0.txt)
10+
##############################################################################
11+
name: cmake
12+
13+
on: [push]
14+
15+
jobs:
16+
##############################################################################
17+
clang:
18+
name: ${{ matrix.b2_toolset }}
19+
runs-on: ${{ matrix.os }}
20+
21+
strategy:
22+
fail-fast: false
23+
matrix:
24+
b2_toolset: [
25+
clang-14
26+
]
27+
28+
include:
29+
- b2_toolset: clang-14
30+
b2_cxxstd: 14,17,2a
31+
version: "14"
32+
os: ubuntu-22.04
33+
steps:
34+
- name: Set up environment
35+
id: setenv
36+
run: |
37+
if [[ "$GITHUB_REF" == *master ]]; then
38+
echo "BOOST_BRANCH=master" >> $GITHUB_ENV
39+
else
40+
echo "BOOST_BRANCH=develop" >> $GITHUB_ENV
41+
fi
42+
echo "BOOST_SELF=$(basename $GITHUB_WORKSPACE)" >> $GITHUB_ENV
43+
echo "BOOST_ROOT=$GITHUB_WORKSPACE/boost-root" >> $GITHUB_ENV
44+
echo "boost_self=$(basename $GITHUB_WORKSPACE)" >> "$GITHUB_OUTPUT"
45+
echo "boost_root=$GITHUB_WORKSPACE/boost-root" >> "$GITHUB_OUTPUT"
46+
47+
- name: Clone boostorg/boost
48+
run: |
49+
git clone -b $BOOST_BRANCH --depth 1 https://github.com/boostorg/boost.git $BOOST_ROOT
50+
cd $BOOST_ROOT
51+
git submodule update -q --init libs/headers
52+
git submodule update -q --init tools/boost_install
53+
git submodule update -q --init tools/boostdep
54+
git submodule update -q --init tools/build
55+
mkdir -p libs/$BOOST_SELF
56+
57+
- uses: actions/checkout@v2
58+
with:
59+
path: ${{ steps.setenv.outputs.boost_root }}/libs/${{ steps.setenv.outputs.boost_self }}
60+
61+
- name: Run tools/boostdep/depinst/depinst.py
62+
run: |
63+
cd $BOOST_ROOT
64+
python tools/boostdep/depinst/depinst.py --include benchmark --include example --include examples --include tools $BOOST_SELF
65+
66+
- name: Bootstrap boostorg/boost
67+
run: |
68+
gcc --version
69+
cd $BOOST_ROOT
70+
./bootstrap.sh --with-toolset=gcc
71+
./b2 headers
72+
test -f /usr/local/bin/b2 && rm -rf /usr/local/bin/b2
73+
test -f /usr/local/bin/bjam && rm -rf /usr/local/bin/bjam
74+
sudo cp $BOOST_ROOT/b2 /usr/local/bin/
75+
ls -l /usr/local/bin/b2
76+
b2 -v
77+
78+
- name: Set up clang toolset in ~/user-config.jam
79+
run: |
80+
export CXX_NAME=clang++-${{ matrix.version }}
81+
echo ${CXX_NAME}
82+
echo "# $HOME/user-config.jam" > $HOME/user-config.jam
83+
echo "using clang : : $(which clang++-${{ matrix.version }}) ;" > ${HOME}/user-config.jam
84+
test -f $HOME/user-config.jam && cat $HOME/user-config.jam
85+
86+
- name: Build tests with cmake (c++17)
87+
run: |
88+
cd $BOOST_ROOT/libs/geometry
89+
mkdir __build
90+
cd __build
91+
cmake -DCMAKE_CXX_STANDARD=17 -DBUILD_TESTING=ON ..
92+
cmake --build . --target tests
93+
94+
- name: Build tests with cmake
95+
run: |
96+
cd $BOOST_ROOT/libs/geometry/__build
97+
rm -rf *
98+
cmake -DBUILD_TESTING=ON ..
99+
cmake --build . --target tests
100+
101+
- name: Run tests
102+
run: |
103+
cd $BOOST_ROOT/libs/geometry/__build
104+
ctest --output-on-failure --no-tests=error

CMakeLists.txt

+1
Original file line numberDiff line numberDiff line change
@@ -124,6 +124,7 @@ if(BUILD_TESTING AND EXISTS "${CMAKE_CURRENT_SOURCE_DIR}/test/CMakeLists.txt")
124124

125125
enable_testing()
126126
add_subdirectory(test EXCLUDE_FROM_ALL)
127+
add_subdirectory(index/test EXCLUDE_FROM_ALL)
127128

128129
endif()
129130

index/test/CMakeLists.txt

+17
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
# Boost.Geometry
2+
# Copyright (c) 2024, Oracle and/or its affiliates.
3+
# Contributed and/or modified by Vissarion Fysikopoulos, on behalf of Oracle
4+
# Use, modification and distribution is subject to the Boost Software License,
5+
# Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at
6+
# http://www.boost.org/LICENSE_1_0.txt)
7+
8+
foreach(item IN ITEMS
9+
minmax_heap
10+
varray_old
11+
varray
12+
)
13+
boost_geometry_add_unit_test("index" ${item})
14+
endforeach()
15+
16+
add_subdirectory(algorithms)
17+
add_subdirectory(rtree)

index/test/algorithms/CMakeLists.txt

+19
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
# Boost.Geometry
2+
# Copyright (c) 2024, Oracle and/or its affiliates.
3+
# Contributed and/or modified by Vissarion Fysikopoulos, on behalf of Oracle
4+
# Use, modification and distribution is subject to the Boost Software License,
5+
# Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at
6+
# http://www.boost.org/LICENSE_1_0.txt)
7+
8+
foreach(item IN ITEMS
9+
content
10+
intersection_content # this tests overlap() too
11+
is_valid
12+
margin
13+
#minmaxdist
14+
union_content
15+
segment_intersection
16+
path_intersection
17+
)
18+
boost_geometry_add_unit_test("index" ${item})
19+
endforeach()

index/test/rtree/CMakeLists.txt

+19
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
# Boost.Geometry
2+
# Copyright (c) 2024, Oracle and/or its affiliates.
3+
# Contributed and/or modified by Vissarion Fysikopoulos, on behalf of Oracle
4+
# Use, modification and distribution is subject to the Boost Software License,
5+
# Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at
6+
# http://www.boost.org/LICENSE_1_0.txt)
7+
8+
foreach(item IN ITEMS
9+
rtree_contains_point
10+
rtree_epsilon
11+
rtree_insert_remove
12+
rtree_intersects_geom
13+
rtree_move_pack
14+
rtree_non_cartesian
15+
rtree_values
16+
#compile-fail rtree_values_invalid
17+
)
18+
boost_geometry_add_unit_test("index" ${item})
19+
endforeach()

test/CMakeLists.txt

+6-5
Original file line numberDiff line numberDiff line change
@@ -8,26 +8,27 @@
88
# It also lets running the tests much faster.
99
if (APPLE)
1010
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -ffp-contract=fast")
11-
endif()
11+
endif()
1212

1313
function(boost_geometry_add_unit_test prefix item)
1414
set(unit_test_name "boost_geometry_${prefix}_${item}")
1515
add_executable(${unit_test_name} ${item}.cpp)
1616

1717
# Add a dependendcy to Boost.Geometry
18-
target_link_libraries(${unit_test_name}
18+
target_link_libraries(${unit_test_name}
1919
PRIVATE
2020
Boost::geometry)
2121

2222
# For unit tests, add a dependency to the unit test framework (in header only mode)
23-
target_link_libraries(${unit_test_name}
23+
target_link_libraries(${unit_test_name}
2424
PRIVATE
2525
Boost::included_unit_test_framework)
26-
26+
2727
# Include the main Geometry test folder and the current folder
2828
target_include_directories(${unit_test_name}
2929
PRIVATE
30-
"${PROJECT_SOURCE_DIR}/test"
30+
"${PROJECT_SOURCE_DIR}/test"
31+
"${PROJECT_SOURCE_DIR}/index/test"
3132
.)
3233

3334
# To compile with C++14

0 commit comments

Comments
 (0)