From 636450ab7b0b19d7531b2d30726ce583beb10cfe Mon Sep 17 00:00:00 2001 From: Ryan Blue Date: Mon, 15 Jul 2024 20:19:07 -0400 Subject: [PATCH] [build] Disable std::mutex constexpr constructor on Windows (#6791) We will plan to re-enable this after we release an installer with an updated runtime. --- cmake/modules/CompileWarnings.cmake | 5 +++++ shared/config.gradle | 5 +++++ 2 files changed, 10 insertions(+) diff --git a/cmake/modules/CompileWarnings.cmake b/cmake/modules/CompileWarnings.cmake index 94d952ce5d..432c810ca9 100644 --- a/cmake/modules/CompileWarnings.cmake +++ b/cmake/modules/CompileWarnings.cmake @@ -54,4 +54,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/config.gradle b/shared/config.gradle index 6c4f3942b4..1d184295af 100644 --- a/shared/config.gradle +++ b/shared/config.gradle @@ -41,6 +41,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") model {