Include epoll-shim library

This commit is contained in:
Marcin Mikołajczyk 2025-07-14 21:00:03 +01:00
parent caa38af40b
commit c8885471f4
4 changed files with 12 additions and 4 deletions

3
.gitmodules vendored
View File

@ -109,3 +109,6 @@
[submodule "externals/wepoll"] [submodule "externals/wepoll"]
path = externals/wepoll path = externals/wepoll
url = https://github.com/piscisaureus/wepoll.git url = https://github.com/piscisaureus/wepoll.git
[submodule "externals/epoll-shim"]
path = externals/epoll-shim
url = https://github.com/jiixyj/epoll-shim.git

View File

@ -246,6 +246,7 @@ find_package(pugixml 1.14 CONFIG)
find_package(libusb 1.0.27 MODULE) find_package(libusb 1.0.27 MODULE)
if (APPLE) if (APPLE)
find_package(date 3.0.1 CONFIG) find_package(date 3.0.1 CONFIG)
find_package(epoll-shim 3.14 CONFIG)
endif() endif()
list(POP_BACK CMAKE_MODULE_PATH) list(POP_BACK CMAKE_MODULE_PATH)
@ -1175,7 +1176,7 @@ if (APPLE)
endif() endif()
# Replacement for std::chrono::time_zone # Replacement for std::chrono::time_zone
target_link_libraries(shadps4 PRIVATE date::date-tz) target_link_libraries(shadps4 PRIVATE date::date-tz epoll-shim)
endif() endif()
if (ENABLE_QT_GUI) if (ENABLE_QT_GUI)

1
externals/epoll-shim vendored Submodule

@ -0,0 +1 @@
Subproject commit 18159584bb3d17e601b9315a7398ace018251bdc

View File

@ -14,16 +14,15 @@
#include <wepoll/wepoll.h> #include <wepoll/wepoll.h>
#endif #endif
#ifdef __linux__ #if defined(__linux__) || defined(__APPLE__)
#include <sys/epoll.h> #include <sys/epoll.h>
#define epoll_close close
#endif #endif
namespace Libraries::Net { namespace Libraries::Net {
#ifdef _WIN32 #ifdef _WIN32
using epoll_handle = HANDLE; using epoll_handle = HANDLE;
#elif defined(__linux__) #else
using epoll_handle = int; using epoll_handle = int;
#endif #endif
@ -42,7 +41,11 @@ struct Epoll {
void Destroy() noexcept { void Destroy() noexcept {
events.clear(); events.clear();
#ifdef _WIN32
epoll_close(epoll_fd); epoll_close(epoll_fd);
#else
close(epoll_fd);
#endif
epoll_fd = -1; epoll_fd = -1;
name = nullptr; name = nullptr;
destroyed = true; destroyed = true;