From 37c8f24f13d34204d00651f8c3773096c073a476 Mon Sep 17 00:00:00 2001 From: Peter Johnson Date: Fri, 6 Dec 2024 21:58:10 -0800 Subject: [PATCH] Revert "[build] Remove Windows constexpr mutex define (#7375)" This reverts commit 91142ba5fe6b7ee11ead8b39e7140bd814497f2c. --- cmake/modules/CompileWarnings.cmake | 5 +++++ shared/bazel/compiler_flags/windows_flags.rc | 3 +++ shared/config.gradle | 5 +++++ 3 files changed, 13 insertions(+) diff --git a/cmake/modules/CompileWarnings.cmake b/cmake/modules/CompileWarnings.cmake index b56c175a9b3..7439333bad7 100644 --- a/cmake/modules/CompileWarnings.cmake +++ b/cmake/modules/CompileWarnings.cmake @@ -55,4 +55,9 @@ macro(wpilib_target_warnings target) ) target_compile_options(${target} PRIVATE -gz=zlib) endif() + + # Disable std::mutex constexpr constructor on MSVC + if(MSVC) + target_compile_options(${target} PRIVATE /D_DISABLE_CONSTEXPR_MUTEX_CONSTRUCTOR) + endif() endmacro() diff --git a/shared/bazel/compiler_flags/windows_flags.rc b/shared/bazel/compiler_flags/windows_flags.rc index 54fbebb4924..7e604e43c9f 100644 --- a/shared/bazel/compiler_flags/windows_flags.rc +++ b/shared/bazel/compiler_flags/windows_flags.rc @@ -40,6 +40,9 @@ build:windows --config=windows_common build:windows --linkopt=/DEPENDENTLOADFLAG:0x1100 +# TODO +build:windows --copt=/D_DISABLE_CONSTEXPR_MUTEX_CONSTRUCTOR + ################################ # ARM Windows Flags ################################ diff --git a/shared/config.gradle b/shared/config.gradle index e15a80c35ac..97d711f904c 100644 --- a/shared/config.gradle +++ b/shared/config.gradle @@ -39,6 +39,11 @@ nativeUtils.platformConfigs.each { } } +// Disable std::mutex constexpr constructor on MSVC +nativeUtils.platformConfigs.named(nativeUtils.wpi.platforms.windowsx64).configure { + it.cppCompiler.args.add("/D_DISABLE_CONSTEXPR_MUTEX_CONSTRUCTOR") +} + nativeUtils.platformConfigs.linuxathena.linker.args.add("-Wl,--fatal-warnings") if (project.hasProperty('ntcoreffibuild')) {