From d224d1f22c89b7fb275d35a10c8e5bd3d5924e53 Mon Sep 17 00:00:00 2001 From: stasoid Date: Sat, 16 Nov 2024 12:44:30 +0500 Subject: [PATCH] LibCore: Fix pthread-related errors on Windows Fixes compilation error in Notifier.h and link errors in ThreadEventQueue.cpp --- Libraries/LibCore/CMakeLists.txt | 4 ++++ Libraries/LibCore/Notifier.h | 2 +- vcpkg.json | 4 ++++ 3 files changed, 9 insertions(+), 1 deletion(-) diff --git a/Libraries/LibCore/CMakeLists.txt b/Libraries/LibCore/CMakeLists.txt index 6572f9b635c..17fa0338ca1 100644 --- a/Libraries/LibCore/CMakeLists.txt +++ b/Libraries/LibCore/CMakeLists.txt @@ -116,4 +116,8 @@ endif() if (WIN32) target_include_directories(LibCore PRIVATE ${MMAN_INCLUDE_DIR}) + + find_package(pthread REQUIRED) + target_include_directories(LibCore PRIVATE ${PTHREAD_INCLUDE_DIR}) + target_link_libraries(LibCore PRIVATE ${PTHREAD_LIBRARY}) endif() diff --git a/Libraries/LibCore/Notifier.h b/Libraries/LibCore/Notifier.h index e5675b8336e..d765f86ca12 100644 --- a/Libraries/LibCore/Notifier.h +++ b/Libraries/LibCore/Notifier.h @@ -41,7 +41,7 @@ private: int m_fd { -1 }; bool m_is_enabled { false }; - pthread_t m_owner_thread { 0 }; + pthread_t m_owner_thread {}; Type m_type { Type::None }; }; diff --git a/vcpkg.json b/vcpkg.json index 86d8ab31136..e944a420302 100644 --- a/vcpkg.json +++ b/vcpkg.json @@ -75,6 +75,10 @@ "name": "mman", "platform": "windows" }, + { + "name": "pthread", + "platform": "windows" + }, "simdutf", { "name": "skia",