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"]
path = externals/wepoll
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)
if (APPLE)
find_package(date 3.0.1 CONFIG)
find_package(epoll-shim 3.14 CONFIG)
endif()
list(POP_BACK CMAKE_MODULE_PATH)
@ -1175,7 +1176,7 @@ if (APPLE)
endif()
# 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()
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>
#endif
#ifdef __linux__
#if defined(__linux__) || defined(__APPLE__)
#include <sys/epoll.h>
#define epoll_close close
#endif
namespace Libraries::Net {
#ifdef _WIN32
using epoll_handle = HANDLE;
#elif defined(__linux__)
#else
using epoll_handle = int;
#endif
@ -42,7 +41,11 @@ struct Epoll {
void Destroy() noexcept {
events.clear();
#ifdef _WIN32
epoll_close(epoll_fd);
#else
close(epoll_fd);
#endif
epoll_fd = -1;
name = nullptr;
destroyed = true;