From 3f8d95446843d6b456b51207036a693349c5d6cc Mon Sep 17 00:00:00 2001 From: Keith Smiley Date: Thu, 21 Mar 2024 12:33:11 -0700 Subject: [PATCH] [bazel] Move -std=c++14 to .bazelrc (#2600) This way it applies to local builds as well as CI builds --- .bazelrc | 4 +++- ci/do_ci.sh | 6 +++--- 2 files changed, 6 insertions(+), 4 deletions(-) diff --git a/.bazelrc b/.bazelrc index 4e87c7c9e0..5f9e1c0ad5 100644 --- a/.bazelrc +++ b/.bazelrc @@ -7,6 +7,9 @@ # Needed by gRPC to build on some platforms. build --copt -DGRPC_BAZEL_BUILD +# Set minimum supported C++ version +build --host_cxxopt=-std=c++14 --cxxopt=-std=c++14 + # --config=asan : Address Sanitizer. common:asan --copt -DADDRESS_SANITIZER common:asan --copt -fsanitize=address,bool,float-cast-overflow,integer-divide-by-zero,null,return,returns-nonnull-attribute,shift-exponent,signed-integer-overflow,unreachable,vla-bound @@ -25,4 +28,3 @@ common:tsan --cc_output_directory_tag=tsan # This is needed to address false positive problem with abseil.The same setting as gRPC # https://github.com/google/sanitizers/issues/953 common:tsan --test_env=TSAN_OPTIONS=report_atomic_races=0 - diff --git a/ci/do_ci.sh b/ci/do_ci.sh index 9ea7ac6bc3..3da87e587d 100755 --- a/ci/do_ci.sh +++ b/ci/do_ci.sh @@ -25,7 +25,7 @@ function run_benchmarks [ -z "${BENCHMARK_DIR}" ] && export BENCHMARK_DIR=$HOME/benchmark mkdir -p $BENCHMARK_DIR - bazel $BAZEL_STARTUP_OPTIONS build --host_cxxopt=-std=c++14 --cxxopt=-std=c++14 $BAZEL_OPTIONS_ASYNC -c opt -- \ + bazel $BAZEL_STARTUP_OPTIONS build $BAZEL_OPTIONS_ASYNC -c opt -- \ $(bazel query 'attr("tags", "benchmark_result", ...)') echo "" echo "Benchmark results in $BENCHMARK_DIR:" @@ -70,7 +70,7 @@ echo "make command: ${MAKE_COMMAND}" echo "IWYU option: ${IWYU}" BAZEL_OPTIONS_DEFAULT="--copt=-DENABLE_METRICS_EXEMPLAR_PREVIEW" -BAZEL_OPTIONS="--cxxopt=-std=c++14 $BAZEL_OPTIONS_DEFAULT" +BAZEL_OPTIONS="$BAZEL_OPTIONS_DEFAULT" BAZEL_TEST_OPTIONS="$BAZEL_OPTIONS --test_output=errors" @@ -493,7 +493,7 @@ elif [[ "$1" == "bazel.e2e" ]]; then exit 0 elif [[ "$1" == "benchmark" ]]; then [ -z "${BENCHMARK_DIR}" ] && export BENCHMARK_DIR=$HOME/benchmark - bazel $BAZEL_STARTUP_OPTIONS build --host_cxxopt=-std=c++14 --cxxopt=-std=c++14 $BAZEL_OPTIONS_ASYNC -c opt -- \ + bazel $BAZEL_STARTUP_OPTIONS build $BAZEL_OPTIONS_ASYNC -c opt -- \ $(bazel query 'attr("tags", "benchmark_result", ...)') echo "" echo "Benchmark results in $BENCHMARK_DIR:"