From b92e4d82e4f90b20f3b3bfef84592e89531d98f5 Mon Sep 17 00:00:00 2001 From: mhucka Date: Thu, 12 Jun 2025 14:18:54 +0000 Subject: [PATCH 1/3] Set cxxopt with platform-specific syntax Attempting to use option `--copt=-std=c++17` fails on Windows because the syntax need to be slightly different: `--copt=/std:c++17`. To handle these differences between platforms, we can take advantage of Bazel's `--enable_platform_specific_config` option and define different build configs for Linux, Windows, and Mac. --- .bazelrc | 21 ++++++++++++++++++--- 1 file changed, 18 insertions(+), 3 deletions(-) diff --git a/.bazelrc b/.bazelrc index 7438b96af..c115db806 100644 --- a/.bazelrc +++ b/.bazelrc @@ -19,9 +19,24 @@ common --announce_rc common --experimental_repo_remote_exec common --verbose_failures -# Default build options -build --copt -std=c++17 -build --copt -D_GLIBCXX_USE_CXX11_ABI=1 +# C++ language selection. The variants are needed because MS Visual Studio on +# Windows uses slightly different syntax. +common --enable_platform_specific_config + +build:linux --copt=-std=c++17 +build:linux --copt=-D_GLIBCXX_USE_CXX11_ABI=1 +build:linux --cxxopt=-std=c++17 +build:linux --cxxopt=-D_GLIBCXX_USE_CXX11_ABI=1 + +build:macos --copt=-std=c++17 +build:macos --copt=-D_GLIBCXX_USE_CXX11_ABI=1 +build:macos --cxxopt=-std=c++17 +build:macos --cxxopt=-D_GLIBCXX_USE_CXX11_ABI=1 + +build:windows --copt=/std:c++17 +build:windows --copt=-D_GLIBCXX_USE_CXX11_ABI=1 +build:windows --cxxopt=/std:c++17 +build:windows --cxxopt=-D_GLIBCXX_USE_CXX11_ABI=1 # Test flags test --test_output=errors From c039cc17424220cd8b5a226498570f2523d4a203 Mon Sep 17 00:00:00 2001 From: mhucka Date: Thu, 12 Jun 2025 15:08:50 +0000 Subject: [PATCH 2/3] Simplify the platform-specific definitions It seems that `--cxxopt=-D_GLIBCXX_USE_CXX11_ABI=1` works on all platforms (possibly because the Windows compiler ignores altogether?). We may as well pull that out into a single build setting that's common for all platforms. --- .bazelrc | 9 +++------ 1 file changed, 3 insertions(+), 6 deletions(-) diff --git a/.bazelrc b/.bazelrc index c115db806..26b441fa0 100644 --- a/.bazelrc +++ b/.bazelrc @@ -24,19 +24,16 @@ common --verbose_failures common --enable_platform_specific_config build:linux --copt=-std=c++17 -build:linux --copt=-D_GLIBCXX_USE_CXX11_ABI=1 build:linux --cxxopt=-std=c++17 -build:linux --cxxopt=-D_GLIBCXX_USE_CXX11_ABI=1 build:macos --copt=-std=c++17 -build:macos --copt=-D_GLIBCXX_USE_CXX11_ABI=1 build:macos --cxxopt=-std=c++17 -build:macos --cxxopt=-D_GLIBCXX_USE_CXX11_ABI=1 build:windows --copt=/std:c++17 -build:windows --copt=-D_GLIBCXX_USE_CXX11_ABI=1 build:windows --cxxopt=/std:c++17 -build:windows --cxxopt=-D_GLIBCXX_USE_CXX11_ABI=1 + +build --copt=-D_GLIBCXX_USE_CXX11_ABI=1 +build --cxxopt=-D_GLIBCXX_USE_CXX11_ABI=1 # Test flags test --test_output=errors From 686f7863e68b1f28b66f6f32d531857ccc7bec88 Mon Sep 17 00:00:00 2001 From: mhucka Date: Thu, 12 Jun 2025 17:19:18 +0000 Subject: [PATCH 3/3] Increase test timeout On MacOS 13 runners on GitHub, some of the tests fail because they exceed the default timeout. --- .bazelrc | 1 + 1 file changed, 1 insertion(+) diff --git a/.bazelrc b/.bazelrc index 26b441fa0..13df9a666 100644 --- a/.bazelrc +++ b/.bazelrc @@ -37,6 +37,7 @@ build --cxxopt=-D_GLIBCXX_USE_CXX11_ABI=1 # Test flags test --test_output=errors +test --test_timeout=600 # CUDA options build:cuda --@local_config_cuda//:enable_cuda