From 9969db0fd9af4ee59d5636a8d46b3334c33ab397 Mon Sep 17 00:00:00 2001 From: Earle Lowe Date: Tue, 10 Sep 2024 13:12:06 -0700 Subject: [PATCH 1/2] Set _DISABLE_CONSTEXPR_MUTEX_CONSTRUCTOR when building --- CMakeLists.txt | 3 +++ 1 file changed, 3 insertions(+) diff --git a/CMakeLists.txt b/CMakeLists.txt index f66687fde..2eee8d560 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -199,6 +199,9 @@ target_include_directories(uint128 PUBLIC uint128_t) target_compile_features(fse PUBLIC cxx_std_17) target_compile_features(chiapos PUBLIC cxx_std_17) +if (WIN32) + target_compile_definitions(chiapos PUBLIC _DISABLE_CONSTEXPR_MUTEX_CONSTRUCTOR) +endif() # target_compile_features(RunTests PUBLIC cxx_std_17) target_link_libraries(chiapos PRIVATE fse Threads::Threads From 09197e151987d4c524afa85be56452bdba7e2114 Mon Sep 17 00:00:00 2001 From: Earle Lowe Date: Tue, 10 Sep 2024 13:15:03 -0700 Subject: [PATCH 2/2] Add some comments --- CMakeLists.txt | 2 ++ 1 file changed, 2 insertions(+) diff --git a/CMakeLists.txt b/CMakeLists.txt index 2eee8d560..c4406780f 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -200,6 +200,8 @@ target_include_directories(uint128 PUBLIC uint128_t) target_compile_features(fse PUBLIC cxx_std_17) target_compile_features(chiapos PUBLIC cxx_std_17) if (WIN32) + # workaround for constexpr mutex constructor change in MSVC 2022 + # https://stackoverflow.com/questions/78598141/first-stdmutexlock-crashes-in-application-built-with-latest-visual-studio target_compile_definitions(chiapos PUBLIC _DISABLE_CONSTEXPR_MUTEX_CONSTRUCTOR) endif() # target_compile_features(RunTests PUBLIC cxx_std_17)