Skip to content

Commit

Permalink
Add C++20 testing, remove C++14 testing.
Browse files Browse the repository at this point in the history
Secondary changes:

* pybind11 needs to be pinned to a version right before pybind/pybind11#4786 was merged, to avoid `ctest` `permission denied` errors (to be debugged separately).

* `find_package(PythonLibs REQUIRED)` is removed. It is deprecated (https://github.com/pybind/pybind11/blob/master/docs/faq.rst) and evidently not needed.

* More complete logging.

PiperOrigin-RevId: 595435856
  • Loading branch information
Ralf W. Grosse-Kunstleve authored and copybara-github committed Jan 3, 2024
1 parent 67491a4 commit fc75e83
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 12 deletions.
4 changes: 1 addition & 3 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,6 @@ set(BUILD_TESTING OFF)
set(CMAKE_POSITION_INDEPENDENT_CODE TRUE)
set(CMAKE_INTERPROCEDURAL_OPTIMIZATION FALSE)

find_package(PythonLibs REQUIRED)

FetchContent_Declare(
abseil-cpp
URL https://github.com/abseil/abseil-cpp/archive/refs/tags/20230802.0.tar.gz
Expand All @@ -22,7 +20,7 @@ FetchContent_Declare(

FetchContent_Declare(
pybind11
URL https://github.com/pybind/pybind11/archive/refs/heads/master.tar.gz)
URL https://github.com/pybind/pybind11/archive/7d538a42750c8580eeaac10e505840a3694b04c8.tar.gz)

FetchContent_MakeAvailable(abseil-cpp pybind11)

Expand Down
4 changes: 2 additions & 2 deletions scripts/build_and_run_tests_bazel.sh
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
# - builds and runs tests

set -e # exit when any command fails
# set -x # Prints all executed command
set -x # Prints all executed commands

MYDIR="$(dirname "$(realpath "$0")")"

Expand Down Expand Up @@ -80,5 +80,5 @@ export PYTHON_LIB_PATH=`python3 -c "import sysconfig; print(sysconfig.get_path('
echo "Using PYTHON_BIN_PATH: $PYTHON_BIN_PATH"
echo "Using PYTHON_LIB_PATH: $PYTHON_LIB_PATH"

BAZEL_CXXOPTS="-std=c++14" bazel test ... --test_output=errors "$@"
BAZEL_CXXOPTS="-std=c++17" bazel test ... --test_output=errors "$@"
BAZEL_CXXOPTS="-std=c++20" bazel test ... --test_output=errors "$@"
14 changes: 7 additions & 7 deletions scripts/build_and_run_tests_cmake.sh
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
# - builds and runs tests

set -e # exit when any command fails
# set -x # Prints all executed command
set -x # Prints all executed commands

MYDIR="$(dirname "$(realpath "$0")")"

Expand Down Expand Up @@ -87,17 +87,17 @@ fi
mkdir tmp_build
cd tmp_build

# C++14
cmake ../ -DCMAKE_CXX_STANDARD=14 -DCMAKE_VERBOSE_MAKEFILE=ON
# C++17
cmake ../ -DCMAKE_CXX_STANDARD=17 -DCMAKE_VERBOSE_MAKEFILE=ON
make "$@"
ctest --output-on-failure
ctest --output-on-failure --extra-verbose

rm -r ./*

# C++17
cmake ../ -DCMAKE_CXX_STANDARD=17 -DCMAKE_VERBOSE_MAKEFILE=ON
# C++20
cmake ../ -DCMAKE_CXX_STANDARD=20 -DCMAKE_VERBOSE_MAKEFILE=ON
make "$@"
ctest --output-on-failure
ctest --output-on-failure --extra-verbose

cd ../
rm -r tmp_build

0 comments on commit fc75e83

Please sign in to comment.