From 15a96e841b0f8bde567d5fbdc03603886578f1b7 Mon Sep 17 00:00:00 2001 From: stasoid Date: Wed, 18 Dec 2024 06:36:28 +0500 Subject: [PATCH] Meta: Make pthread and mman available for all libraries on Windows by default --- Libraries/LibCore/CMakeLists.txt | 10 ---------- Libraries/LibGC/CMakeLists.txt | 6 ------ Libraries/LibRequests/CMakeLists.txt | 5 ----- Libraries/LibTLS/CMakeLists.txt | 5 ----- Libraries/LibThreading/CMakeLists.txt | 2 -- Meta/Lagom/CMakeLists.txt | 10 ++++++++++ 6 files changed, 10 insertions(+), 28 deletions(-) diff --git a/Libraries/LibCore/CMakeLists.txt b/Libraries/LibCore/CMakeLists.txt index 6b9427d3d0f..c54c02166c3 100644 --- a/Libraries/LibCore/CMakeLists.txt +++ b/Libraries/LibCore/CMakeLists.txt @@ -22,10 +22,6 @@ serenity_lib(LibCoreMinimal coreminimal) if (WIN32) find_path(DIRENT_INCLUDE_DIR dirent.h REQUIRED) target_include_directories(LibCoreMinimal PRIVATE ${DIRENT_INCLUDE_DIR}) - - find_package(mman REQUIRED) - target_include_directories(LibCoreMinimal PRIVATE ${MMAN_INCLUDE_DIR}) - target_link_libraries(LibCoreMinimal PRIVATE ${MMAN_LIBRARY}) endif() if (LAGOM_TOOLS_ONLY) @@ -116,11 +112,5 @@ if (ANDROID) 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}) - target_link_libraries(LibCore PRIVATE ws2_32.lib) endif() diff --git a/Libraries/LibGC/CMakeLists.txt b/Libraries/LibGC/CMakeLists.txt index 805c7461146..7d93203ab70 100644 --- a/Libraries/LibGC/CMakeLists.txt +++ b/Libraries/LibGC/CMakeLists.txt @@ -22,9 +22,3 @@ if (ENABLE_SWIFT) target_link_libraries(LibGC PRIVATE AK) add_swift_target_properties(LibGC LAGOM_LIBRARIES AK) endif() - -if (WIN32) - find_package(mman REQUIRED) - target_include_directories(LibGC PRIVATE ${MMAN_INCLUDE_DIR}) - target_link_libraries(LibGC PRIVATE ${MMAN_LIBRARY}) -endif() diff --git a/Libraries/LibRequests/CMakeLists.txt b/Libraries/LibRequests/CMakeLists.txt index 835b0c233c8..65f71ca4230 100644 --- a/Libraries/LibRequests/CMakeLists.txt +++ b/Libraries/LibRequests/CMakeLists.txt @@ -12,8 +12,3 @@ set(GENERATED_SOURCES serenity_lib(LibRequests requests) target_link_libraries(LibRequests PRIVATE LibCore LibIPC) - -if (WIN32) - find_package(pthread REQUIRED) - target_include_directories(LibRequests PRIVATE ${PTHREAD_INCLUDE_DIR}) -endif() diff --git a/Libraries/LibTLS/CMakeLists.txt b/Libraries/LibTLS/CMakeLists.txt index c9883dc92dc..f21dc89a922 100644 --- a/Libraries/LibTLS/CMakeLists.txt +++ b/Libraries/LibTLS/CMakeLists.txt @@ -14,8 +14,3 @@ serenity_lib(LibTLS tls) target_link_libraries(LibTLS PRIVATE LibCore LibCrypto LibFileSystem) include(ca_certificates_data) - -if (WIN32) - find_package(pthread REQUIRED) - target_include_directories(LibTLS PRIVATE ${PTHREAD_INCLUDE_DIR}) -endif() diff --git a/Libraries/LibThreading/CMakeLists.txt b/Libraries/LibThreading/CMakeLists.txt index 6b3307687c1..2e9b204089c 100644 --- a/Libraries/LibThreading/CMakeLists.txt +++ b/Libraries/LibThreading/CMakeLists.txt @@ -7,7 +7,5 @@ serenity_lib(LibThreading threading) target_link_libraries(LibThreading PRIVATE LibCore) if (WIN32) - find_package(pthread REQUIRED) - target_include_directories(LibThreading PRIVATE ${PTHREAD_INCLUDE_DIR}) target_link_libraries(LibThreading PUBLIC ${PTHREAD_LIBRARY}) endif() diff --git a/Meta/Lagom/CMakeLists.txt b/Meta/Lagom/CMakeLists.txt index a156a3e07fa..4085e934f5c 100644 --- a/Meta/Lagom/CMakeLists.txt +++ b/Meta/Lagom/CMakeLists.txt @@ -228,6 +228,16 @@ function(lagom_lib target_name fs_name) target_link_libraries(${target_name} PRIVATE AK) endif() + if (WIN32) + find_package(pthread REQUIRED) + target_include_directories(${target_name} PRIVATE ${PTHREAD_INCLUDE_DIR}) + target_link_libraries(${target_name} PRIVATE ${PTHREAD_LIBRARY}) + + find_package(mman REQUIRED) + target_include_directories(${target_name} PRIVATE ${MMAN_INCLUDE_DIR}) + target_link_libraries(${target_name} PRIVATE ${MMAN_LIBRARY}) + endif() + # FIXME: Clean these up so that we don't need so many include dirs if (ENABLE_INSTALL_HEADERS) target_include_directories(${target_name} INTERFACE