From b00b849d3f845ec57b64e09e7840e3888276945f Mon Sep 17 00:00:00 2001 From: georgemoralis Date: Thu, 9 May 2024 23:45:09 +0300 Subject: [PATCH] use winpthreads from mingw64 --- .gitmodules | 7 +++---- CMakeLists.txt | 8 +------- externals/CMakeLists.txt | 6 ++++++ externals/winpthreads | 1 + src/core/libraries/kernel/thread_management.cpp | 3 +++ third-party/CMakeLists.txt | 6 ------ third-party/winpthread | 1 - 7 files changed, 14 insertions(+), 18 deletions(-) create mode 160000 externals/winpthreads delete mode 160000 third-party/winpthread diff --git a/.gitmodules b/.gitmodules index ff226e83..d93a1447 100644 --- a/.gitmodules +++ b/.gitmodules @@ -6,10 +6,6 @@ path = third-party/zydis url = https://github.com/zyantific/zydis.git shallow = true -[submodule "third-party/winpthread"] - path = third-party/winpthread - url = https://github.com/shadps4/winpthread.git - branch = main [submodule "third-party/toml11"] path = third-party/toml11 url = https://github.com/ToruNiina/toml11 @@ -64,3 +60,6 @@ [submodule "externals/xbyak"] path = externals/xbyak url = https://github.com/herumi/xbyak +[submodule "externals/winpthreads"] + path = externals/winpthreads + url = https://github.com/shadps4-emu/winpthreads.git diff --git a/CMakeLists.txt b/CMakeLists.txt index d64c6b81..c1a9e29a 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -403,7 +403,7 @@ if (ENABLE_QT_GUI) endif() if (WIN32) - target_link_libraries(shadps4 PRIVATE mincore winpthread clang_rt.builtins-x86_64.lib) + target_link_libraries(shadps4 PRIVATE mincore winpthreads clang_rt.builtins-x86_64.lib) add_definitions(-D_CRT_SECURE_NO_WARNINGS -D_CRT_NONSTDC_NO_DEPRECATE -D_SCL_SECURE_NO_WARNINGS) add_definitions(-DNOMINMAX -DWIN32_LEAN_AND_MEAN) if (MSVC) @@ -438,9 +438,3 @@ add_custom_command(TARGET shadps4 POST_BUILD COMMAND ${CMAKE_COMMAND} -E copy_if_different $ $) - -if (WIN32) - add_custom_command(TARGET shadps4 POST_BUILD - COMMAND ${CMAKE_COMMAND} -E copy_if_different - "${PROJECT_SOURCE_DIR}/third-party/winpthread/bin/libwinpthread-1.dll" $) -endif() diff --git a/externals/CMakeLists.txt b/externals/CMakeLists.txt index f59aa645..bf8eaf89 100644 --- a/externals/CMakeLists.txt +++ b/externals/CMakeLists.txt @@ -66,3 +66,9 @@ add_subdirectory(robin-map EXCLUDE_FROM_ALL) # Xbyak add_subdirectory(xbyak EXCLUDE_FROM_ALL) + +# Winpthreads +if (WIN32) + add_subdirectory(winpthreads EXCLUDE_FROM_ALL) + target_include_directories(winpthreads INTERFACE winpthreads/include) +endif() diff --git a/externals/winpthreads b/externals/winpthreads new file mode 160000 index 00000000..d937b600 --- /dev/null +++ b/externals/winpthreads @@ -0,0 +1 @@ +Subproject commit d937b60055aaea313422672ebd5cc8bfa87a1682 diff --git a/src/core/libraries/kernel/thread_management.cpp b/src/core/libraries/kernel/thread_management.cpp index b4422679..882fc975 100644 --- a/src/core/libraries/kernel/thread_management.cpp +++ b/src/core/libraries/kernel/thread_management.cpp @@ -8,6 +8,9 @@ #include "core/libraries/error_codes.h" #include "core/libraries/kernel/thread_management.h" #include "core/libraries/libs.h" +#ifdef _WIN64 +#include +#endif namespace Libraries::Kernel { diff --git a/third-party/CMakeLists.txt b/third-party/CMakeLists.txt index 012b8bbc..0509c821 100644 --- a/third-party/CMakeLists.txt +++ b/third-party/CMakeLists.txt @@ -15,12 +15,6 @@ add_subdirectory(toml11 EXCLUDE_FROM_ALL) # Vulkan add_subdirectory(vulkan EXCLUDE_FROM_ALL) -# Winpthreads -if (WIN32) - add_subdirectory(winpthread EXCLUDE_FROM_ALL) - target_include_directories(winpthread INTERFACE winpthread/include) -endif() - # xxHash add_library(xxhash INTERFACE) target_include_directories(xxhash INTERFACE xxhash) diff --git a/third-party/winpthread b/third-party/winpthread deleted file mode 160000 index 918de958..00000000 --- a/third-party/winpthread +++ /dev/null @@ -1 +0,0 @@ -Subproject commit 918de958b720c3ba7bc47f4988609c0109a0f75b