From 58f623036f428710f8f58d9adfa40dade43445f4 Mon Sep 17 00:00:00 2001 From: Orgad Shaneh Date: Thu, 18 Aug 2022 20:15:37 +0300 Subject: [PATCH] fix: Fix Clang/Windows build (#1132) --- CMakeLists.txt | 12 +++++++----- src/util/LockFile.cpp | 2 ++ 2 files changed, 9 insertions(+), 5 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 8c7b45839..30b18a513 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -99,11 +99,13 @@ if(STATIC_LINK) if(MSVC) set(CMAKE_MSVC_RUNTIME_LIBRARY "MultiThreaded$<$:Debug>") # Link MINGW runtime statically. - elseif(WIN32 AND CMAKE_CXX_COMPILER_ID STREQUAL GNU) - list(APPEND CCACHE_EXTRA_LIBS -static-libgcc -static-libstdc++ -static -lwinpthread -dynamic) - # Link WIN32 clang libs statically. - elseif(WIN32 AND CMAKE_CXX_COMPILER_ID STREQUAL Clang) - list(APPEND CCACHE_EXTRA_LIBS -Wl,-Bstatic -lc++ -lunwind -Wl,-Bdynamic) + elseif(WIN32) + if((CMAKE_CXX_COMPILER_ID STREQUAL GNU) OR (CMAKE_CXX_COMPILER_ID STREQUAL Clang)) + list(APPEND CCACHE_EXTRA_LIBS -static-libgcc -static-libstdc++ -static -lwinpthread -dynamic) + endif() + if(CMAKE_CXX_COMPILER_ID STREQUAL Clang) + list(APPEND CCACHE_EXTRA_LIBS -fuse-ld=lld) + endif() endif() endif() diff --git a/src/util/LockFile.cpp b/src/util/LockFile.cpp index 7dee3c9ea..3a0bd7978 100644 --- a/src/util/LockFile.cpp +++ b/src/util/LockFile.cpp @@ -43,10 +43,12 @@ // Seconds. const double k_min_sleep_time = 0.010; const double k_max_sleep_time = 0.050; +#ifndef _WIN32 const double k_staleness_limit = 2; const double k_keep_alive_interval = k_staleness_limit / 4; const auto k_keep_alive_interval_ms = std::chrono::milliseconds{ static_cast(k_keep_alive_interval * 1000)}; +#endif namespace { -- 2.47.2