Skip to content

Commit

Permalink
[DEPRECATION] Drop C++11 support (#2146)
Browse files Browse the repository at this point in the history
  • Loading branch information
marcalff authored and cngzhnp committed Jul 4, 2023
1 parent ebbcd48 commit 9e0ddaf
Show file tree
Hide file tree
Showing 8 changed files with 64 additions and 33 deletions.
6 changes: 4 additions & 2 deletions .github/workflows/benchmark.yml
Original file line number Diff line number Diff line change
Expand Up @@ -24,9 +24,11 @@ jobs:
path: /home/runner/.cache/bazel
key: bazel_benchmark
- name: setup
env:
GOOGLETEST_VERSION: 1.13.0
run: |
sudo ./ci/setup_cmake.sh
sudo ./ci/setup_ci_environment.sh
sudo -E ./ci/setup_cmake.sh
sudo -E ./ci/setup_ci_environment.sh
- name: Run benchmark
id: run_benchmarks
run: |
Expand Down
53 changes: 34 additions & 19 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ jobs:
env:
CC: /usr/bin/gcc-10
CXX: /usr/bin/g++-10
GOOGLETEST_VERSION: 1.13.0
run: |
sudo -E ./ci/setup_cmake.sh
sudo -E ./ci/setup_ci_environment.sh
Expand Down Expand Up @@ -76,7 +77,7 @@ jobs:
env:
CC: /usr/bin/gcc-12
CXX: /usr/bin/g++-12
GOOGLETEST_VERSION: 1.12.1
GOOGLETEST_VERSION: 1.13.0
PROTOBUF_VERSION: 21.12
run: |
sudo -E ./ci/setup_cmake.sh
Expand Down Expand Up @@ -109,7 +110,7 @@ jobs:
env:
CC: /usr/bin/gcc-12
CXX: /usr/bin/g++-12
GOOGLETEST_VERSION: 1.12.1
GOOGLETEST_VERSION: 1.13.0
PROTOBUF_VERSION: 21.12
run: |
sudo -E ./ci/setup_cmake.sh
Expand Down Expand Up @@ -142,7 +143,7 @@ jobs:
env:
CC: /usr/bin/clang-14
CXX: /usr/bin/clang++-14
GOOGLETEST_VERSION: 1.12.1
GOOGLETEST_VERSION: 1.13.0
PROTOBUF_VERSION: 21.12
run: |
sudo -E ./ci/setup_cmake.sh
Expand Down Expand Up @@ -175,7 +176,7 @@ jobs:
env:
CC: /usr/bin/clang-14
CXX: /usr/bin/clang++-14
GOOGLETEST_VERSION: 1.12.1
GOOGLETEST_VERSION: 1.13.0
PROTOBUF_VERSION: 21.12
run: |
sudo -E ./ci/setup_cmake.sh
Expand Down Expand Up @@ -222,6 +223,7 @@ jobs:
env:
CC: /usr/bin/gcc-10
CXX: /usr/bin/g++-10
GOOGLETEST_VERSION: 1.13.0
run: |
sudo -E ./ci/setup_cmake.sh
sudo -E ./ci/setup_ci_environment.sh
Expand All @@ -240,9 +242,11 @@ jobs:
with:
submodules: 'recursive'
- name: setup
env:
GOOGLETEST_VERSION: 1.13.0
run: |
sudo ./ci/setup_cmake.sh
sudo ./ci/setup_ci_environment.sh
sudo -E ./ci/setup_cmake.sh
sudo -E ./ci/setup_ci_environment.sh
- name: run cmake tests (enable abseil-cpp)
run: |
sudo ./ci/install_abseil.sh
Expand All @@ -256,9 +260,11 @@ jobs:
with:
submodules: 'recursive'
- name: setup
env:
GOOGLETEST_VERSION: 1.13.0
run: |
sudo ./ci/setup_cmake.sh
sudo ./ci/setup_ci_environment.sh
sudo -E ./ci/setup_cmake.sh
sudo -E ./ci/setup_ci_environment.sh
- name: run cmake tests (enable opentracing-shim)
run: ./ci/do_ci.sh cmake.opentracing_shim.test

Expand All @@ -281,8 +287,8 @@ jobs:
env:
CC: /usr/bin/gcc-4.8
CXX: /usr/bin/g++-4.8
GOOGLETEST_VERSION: "1.10.0"
run: sudo -E ./ci/setup_cmake.sh
run: |
sudo -E ./ci/setup_cmake.sh
- name: run tests
env:
CC: /usr/bin/gcc-4.8
Expand All @@ -308,7 +314,6 @@ jobs:
env:
CC: /usr/bin/gcc-4.8
CXX: /usr/bin/g++-4.8
GOOGLETEST_VERSION: "1.10.0"
run: |
sudo -E ./ci/setup_cmake.sh
sudo -E ./ci/setup_grpc.sh -v 4.8
Expand All @@ -327,7 +332,8 @@ jobs:
submodules: 'recursive'
- name: setup
env:
CMAKE_VERSION: "3.20.6"
CMAKE_VERSION: 3.20.6
GOOGLETEST_VERSION: 1.13.0
run: |
sudo -E ./ci/setup_ci_environment.sh
sudo -E ./ci/setup_cmake.sh
Expand All @@ -348,7 +354,8 @@ jobs:
CC: /usr/bin/clang
CXX: /usr/bin/clang++
CXXFLAGS: "-stdlib=libc++"
CMAKE_VERSION: "3.20.6"
CMAKE_VERSION: 3.20.6
GOOGLETEST_VERSION: 1.13.0
run: |
sudo -E ./ci/setup_ci_environment.sh
sudo -E ./ci/setup_cmake.sh
Expand All @@ -373,9 +380,11 @@ jobs:
with:
submodules: 'recursive'
- name: setup
env:
GOOGLETEST_VERSION: 1.13.0
run: |
sudo ./ci/setup_cmake.sh
sudo ./ci/setup_ci_environment.sh
sudo -E ./ci/setup_cmake.sh
sudo -E ./ci/setup_ci_environment.sh
- name: run otlp exporter tests
run: |
sudo ./ci/setup_grpc.sh
Expand All @@ -389,9 +398,11 @@ jobs:
with:
submodules: 'recursive'
- name: setup
env:
GOOGLETEST_VERSION: 1.13.0
run: |
sudo ./ci/setup_cmake.sh
sudo ./ci/setup_ci_environment.sh
sudo -E ./ci/setup_cmake.sh
sudo -E ./ci/setup_ci_environment.sh
- name: run otlp exporter tests
run: |
sudo ./ci/setup_grpc.sh
Expand All @@ -405,9 +416,11 @@ jobs:
with:
submodules: 'recursive'
- name: setup
env:
GOOGLETEST_VERSION: 1.13.0
run: |
sudo ./ci/setup_cmake.sh
sudo ./ci/setup_ci_environment.sh
sudo -E ./ci/setup_cmake.sh
sudo -E ./ci/setup_ci_environment.sh
- name: run otlp exporter tests
run: |
sudo ./ci/setup_grpc.sh -T
Expand All @@ -424,6 +437,7 @@ jobs:
env:
CC: /usr/bin/gcc-10
CXX: /usr/bin/g++-10
GOOGLETEST_VERSION: 1.13.0
run: |
sudo -E ./ci/setup_cmake.sh
sudo -E ./ci/setup_ci_environment.sh
Expand Down Expand Up @@ -753,6 +767,7 @@ jobs:
env:
CC: /usr/bin/gcc-10
CXX: /usr/bin/g++-10
GOOGLETEST_VERSION: 1.13.0
run: |
sudo -E ./ci/setup_cmake.sh
sudo -E ./ci/setup_ci_environment.sh
Expand Down
8 changes: 6 additions & 2 deletions .github/workflows/codeql-analysis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -19,9 +19,13 @@ jobs:
run: |
rm -rf third_party
- name: Setup
env:
CC: /usr/bin/gcc-10
CXX: /usr/bin/g++-10
GOOGLETEST_VERSION: 1.13.0
run: |
sudo CC=/usr/bin/gcc-10 CXX=/usr/bin/g++-10 ./ci/setup_cmake.sh
sudo CC=/usr/bin/gcc-10 CXX=/usr/bin/g++-10 ./ci/setup_ci_environment.sh
sudo -E ./ci/setup_cmake.sh
sudo -E ./ci/setup_ci_environment.sh
- name: Initialize CodeQL
uses: github/codeql-action/init@v2
with:
Expand Down
5 changes: 3 additions & 2 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -208,8 +208,8 @@ set(OTELCPP_PROTO_PATH
if(WIN32)
if(BUILD_TESTING)
if(MSVC)
# GTest bug: https://github.com/google/googletest/issues/860
add_compile_options(/wd4275)
# Warning as error: warning STL4036: <ciso646> is removed in C++20
add_compile_options(/wd4996)
endif()
endif()
option(WITH_ETW "Whether to include the ETW Exporter in the SDK" ON)
Expand Down Expand Up @@ -512,6 +512,7 @@ list(APPEND CMAKE_PREFIX_PATH "${CMAKE_BINARY_DIR}")

include(CTest)
if(BUILD_TESTING)
set(CMAKE_CXX_STANDARD 20)
add_definitions(-DENABLE_TEST)
if(EXISTS ${CMAKE_BINARY_DIR}/lib/libgtest.a)
# Prefer GTest from build tree. GTest is not always working with
Expand Down
6 changes: 3 additions & 3 deletions bazel/repository.bzl
Original file line number Diff line number Diff line change
Expand Up @@ -46,10 +46,10 @@ def opentelemetry_cpp_deps():
maybe(
http_archive,
name = "com_google_googletest",
sha256 = "81964fe578e9bd7c94dfdb09c8e4d6e6759e19967e397dbea48d1c10e45d0df2",
strip_prefix = "googletest-release-1.12.1",
sha256 = "ad7fdba11ea011c1d925b3289cf4af2c66a352e18d4c7264392fead75e919363",
strip_prefix = "googletest-1.13.0",
urls = [
"https://github.com/google/googletest/archive/release-1.12.1.tar.gz",
"https://github.com/google/googletest/archive/v1.13.0.tar.gz",
],
)

Expand Down
1 change: 1 addition & 0 deletions ci/do_ci.sh
Original file line number Diff line number Diff line change
Expand Up @@ -213,6 +213,7 @@ elif [[ "$1" == "cmake.c++20.stl.test" ]]; then
-DWITH_LOGS_PREVIEW=ON \
-DCMAKE_CXX_FLAGS="-Werror $CXXFLAGS" \
-DWITH_ASYNC_EXPORT_PREVIEW=ON \
-DCMAKE_CXX_STANDARD=20 \
-DWITH_STL=ON \
"${SRC_DIR}"
make -j $(nproc)
Expand Down
16 changes: 12 additions & 4 deletions ci/setup_cmake.sh
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,16 @@ if [ "x$CMAKE_VERSION" = "x" ]; then
export CMAKE_VERSION=3.15.2
fi

# This variable not set on CI pipeline for only legacy environment(GCC 4.8).
# With 1.13.0 version, C++14 must be set which does not supported by legacy environment anymore.
# Also with this version, release version path needs to be adapted.
if [ "x$GOOGLETEST_VERSION" = "x" ]; then
export GOOGLETEST_VERSION=1.12.1
export GOOGLETEST_VERSION=1.10.0
GOOGLETEST_VERSION_PATH="release-${GOOGLETEST_VERSION}"
GOOGLETEST_FOLDER_PATH="googletest-release-${GOOGLETEST_VERSION}"
else
GOOGLETEST_VERSION_PATH="v${GOOGLETEST_VERSION}"
GOOGLETEST_FOLDER_PATH="googletest-${GOOGLETEST_VERSION}"
fi

cmake_install() {
Expand All @@ -31,9 +39,9 @@ googletest_install() {
# https://gist.github.com/dlime/313f74fd23e4267c4a915086b84c7d3d
tmp_dir=$(mktemp -d)
pushd $tmp_dir
wget https://github.com/google/googletest/archive/release-${GOOGLETEST_VERSION}.tar.gz
tar -xf release-${GOOGLETEST_VERSION}.tar.gz
cd googletest-release-${GOOGLETEST_VERSION}/
wget https://github.com/google/googletest/archive/${GOOGLETEST_VERSION_PATH}.tar.gz
tar -xf ${GOOGLETEST_VERSION_PATH}.tar.gz
cd ${GOOGLETEST_FOLDER_PATH}/
mkdir build && cd build
cmake .. -DBUILD_SHARED_LIBS=ON -DINSTALL_GTEST=ON -DCMAKE_INSTALL_PREFIX:PATH=/usr
make -j $(nproc)
Expand Down
2 changes: 1 addition & 1 deletion third_party_release
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
gRPC=v1.49.2
abseil=20220623.1
benchmark=v1.7.1
googletest=release-1.12.1
googletest=release-1.13.0
ms-gsl=v3.1.0-67-g6f45293
nlohmann-json=v3.11.2
opentelemetry-proto=v0.20.0
Expand Down

0 comments on commit 9e0ddaf

Please sign in to comment.