Centralize Shardok C++ standard settings (#8197)

This commit is contained in:
2026-06-26 07:28:26 -07:00
committed by GitHub
parent 49ff9f8b09
commit 095a29a4a0
5 changed files with 21 additions and 3 deletions
+1
View File
@@ -14,6 +14,7 @@ common --worker_sandboxing
common --local_test_jobs=64 common --local_test_jobs=64
common --jobs=64 common --jobs=64
# Keep these C++ standard flags in sync with tools/copts.bzl and scripts/shardok_cpp_config.sh.
common --cxxopt="--std=c++23" common --cxxopt="--std=c++23"
common --cxxopt="-Wno-deprecated-non-prototype" common --cxxopt="-Wno-deprecated-non-prototype"
common --per_file_copt=src/test/cpp/.*@-Wno-character-conversion common --per_file_copt=src/test/cpp/.*@-Wno-character-conversion
+2 -1
View File
@@ -7,6 +7,7 @@
set -euo pipefail set -euo pipefail
repo_root="$(git rev-parse --show-toplevel)" repo_root="$(git rev-parse --show-toplevel)"
source "$repo_root/scripts/shardok_cpp_config.sh"
files=( files=(
"src/main/cpp/net/eagle0/shardok/library/ActionCost.hpp" "src/main/cpp/net/eagle0/shardok/library/ActionCost.hpp"
@@ -15,7 +16,7 @@ files=(
compiler_args=( compiler_args=(
"-I$repo_root" "-I$repo_root"
"-std=c++23" "$SHARDOK_CXX_STANDARD_ARG"
) )
if command -v xcrun >/dev/null 2>&1; then if command -v xcrun >/dev/null 2>&1; then
+2 -1
View File
@@ -10,13 +10,14 @@ set -e
export PATH="/opt/homebrew/bin:/usr/local/bin:$PATH" export PATH="/opt/homebrew/bin:/usr/local/bin:$PATH"
repo_root="$(git rev-parse --show-toplevel)" repo_root="$(git rev-parse --show-toplevel)"
source "$repo_root/scripts/shardok_cpp_config.sh"
if [ "$#" -eq 0 ]; then if [ "$#" -eq 0 ]; then
echo "Usage: scripts/run-clang-tidy.sh [clang-tidy args] <files> [-- <compiler args>]" echo "Usage: scripts/run-clang-tidy.sh [clang-tidy args] <files> [-- <compiler args>]"
echo "" echo ""
echo "Examples:" echo "Examples:"
echo " scripts/run-clang-tidy.sh --verify-config" echo " scripts/run-clang-tidy.sh --verify-config"
echo " scripts/run-clang-tidy.sh src/main/cpp/net/eagle0/shardok/library/CombatDamage.hpp -- -I$repo_root -std=c++23" echo " scripts/run-clang-tidy.sh src/main/cpp/net/eagle0/shardok/library/CombatDamage.hpp -- -I$repo_root $SHARDOK_CXX_STANDARD_ARG"
exit 2 exit 2
fi fi
+5
View File
@@ -0,0 +1,5 @@
#!/bin/bash
# Shared C++ settings for shell scripts that invoke Shardok tooling outside Bazel.
SHARDOK_CXX_STANDARD="c++23"
SHARDOK_CXX_STANDARD_ARG="-std=${SHARDOK_CXX_STANDARD}"
+11 -1
View File
@@ -1,4 +1,14 @@
# Suppress -Wdeprecated-copy-with-dtor after -Wdeprecated due to protobuf 32.x warning # Suppress -Wdeprecated-copy-with-dtor after -Wdeprecated due to protobuf 32.x warning
COPTS = ["--std=c++23", "-Werror", "-Wall", "-Wextra", "-Wdeprecated", "-Wno-deprecated-copy-with-dtor"] CXX_STANDARD = "c++23"
CXX_STANDARD_COPT = "--std=" + CXX_STANDARD
COPTS = [
CXX_STANDARD_COPT,
"-Werror",
"-Wall",
"-Wextra",
"-Wdeprecated",
"-Wno-deprecated-copy-with-dtor",
]
TEST_COPTS = COPTS + ["-Iexternal/gtest/include"] TEST_COPTS = COPTS + ["-Iexternal/gtest/include"]