From a50355cbaa236b4e02ebc64e8db5d53125c8527d Mon Sep 17 00:00:00 2001
From: Constantin Papizh <p.const@bk.ru>
Date: Thu, 28 Nov 2019 22:21:10 +0300
Subject: [PATCH] wepoll issues

---
 CMakeLists.txt              | 8 ++++----
 include/dap_events_socket.h | 2 ++
 src/dap_client_remote.c     | 1 -
 src/dap_events.c            | 4 ----
 src/dap_events_socket.c     | 4 +---
 src/dap_memcached.c         | 3 ---
 src/dap_server.c            | 3 ---
 src/dap_traffic_track.c     | 3 ---
 8 files changed, 7 insertions(+), 21 deletions(-)

diff --git a/CMakeLists.txt b/CMakeLists.txt
index 670ec86..51540d7 100755
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -17,14 +17,14 @@ if(NOT (${SUBMODULES_NO_BUILD} MATCHES ON))
 
 endif()
 
-file(GLOB DAP_SERVER_CORE_SOURCES src/*.c)
-file(GLOB DAP_SERVER_CORE_HEADERS include/*.h)
+file(GLOB DAP_SERVER_CORE_SOURCES src/*.c ../sources/wepoll/*.c)
+file(GLOB DAP_SERVER_CORE_HEADERS include/*.h ../sources/wepoll/*.h)
 
 if(WIN32)
   include_directories(../libdap/src/win32/)
+  #include_directories(../sources/wepoll/)
   include_directories(../3rdparty/libmemcached/)
   include_directories(../3rdparty/libmemcached/win32/)
-  include_directories(../3rdparty/wepoll/include/)
   include_directories(../3rdparty/uthash/src/)
   include_directories(../3rdparty/libjson-c/)
   include_directories(../3rdparty/curl/include/)
@@ -33,7 +33,7 @@ endif()
 add_library(${PROJECT_NAME} STATIC ${DAP_SERVER_CORE_HEADERS} ${DAP_SERVER_CORE_SOURCES})
 
 if(WIN32)
-  target_link_libraries(${PROJECT_NAME} dap_core dap_crypto ${CMAKE_CURRENT_SOURCE_DIR}/../lib/[x86_64CLANG]/wepoll[x86_64CLANG].a)
+  target_link_libraries(${PROJECT_NAME} dap_core dap_crypto)
 endif()
 
 if(UNIX)
diff --git a/include/dap_events_socket.h b/include/dap_events_socket.h
index cdd7d7b..1e87bee 100755
--- a/include/dap_events_socket.h
+++ b/include/dap_events_socket.h
@@ -29,6 +29,8 @@
 #include "uthash.h"
 #ifndef _WIN32
 #include <sys/epoll.h>
+#else
+#include "wepoll.h"
 #endif
 
 struct dap_events;
diff --git a/src/dap_client_remote.c b/src/dap_client_remote.c
index 0ed0956..bedf026 100755
--- a/src/dap_client_remote.c
+++ b/src/dap_client_remote.c
@@ -37,7 +37,6 @@
 #include <ws2tcpip.h>
 #include <io.h>
 //#include "wrappers.h"
-#include <wepoll.h>
 #include <pthread.h>
 #endif
 
diff --git a/src/dap_events.c b/src/dap_events.c
index 4de70b8..34a268b 100755
--- a/src/dap_events.c
+++ b/src/dap_events.c
@@ -54,16 +54,12 @@
 #endif
 
 #else
-
-#undef _WIN32_WINNT
-#define _WIN32_WINNT 0x0600
 #include <winsock2.h>
 #include <windows.h>
 #include <mswsock.h>
 #include <ws2tcpip.h>
 #include <io.h>
 #include "wrappers.h"
-#include <wepoll.h>
 #include <pthread.h>
 #endif
 
diff --git a/src/dap_events_socket.c b/src/dap_events_socket.c
index 75c9ae2..2f431a0 100755
--- a/src/dap_events_socket.c
+++ b/src/dap_events_socket.c
@@ -33,14 +33,12 @@
 #include <unistd.h>
 #include <fcntl.h>
 #else
-#undef _WIN32_WINNT
-#define _WIN32_WINNT 0x0600
 #include <winsock2.h>
 #include <windows.h>
 #include <mswsock.h>
 #include <ws2tcpip.h>
 #include <io.h>
-#include <wepoll.h>
+#include "wepoll.h"
 #include <pthread.h>
 #endif
 
diff --git a/src/dap_memcached.c b/src/dap_memcached.c
index 746d63a..3b41bd6 100755
--- a/src/dap_memcached.c
+++ b/src/dap_memcached.c
@@ -1,13 +1,10 @@
 
 #ifdef _WIN32
-#undef _WIN32_WINNT
-#define _WIN32_WINNT 0x0600
 #include <winsock2.h>
 #include <windows.h>
 #include <mswsock.h>
 #include <ws2tcpip.h>
 #include <io.h>
-#include <wepoll.h>
 #include <pthread.h>
 
 #endif
diff --git a/src/dap_server.c b/src/dap_server.c
index eb9321f..4133562 100755
--- a/src/dap_server.c
+++ b/src/dap_server.c
@@ -46,15 +46,12 @@
 #include <sys/epoll.h>
 #include <sys/timerfd.h>
 #else
-#undef _WIN32_WINNT
-#define _WIN32_WINNT 0x0600
 #include <winsock2.h>
 #include <windows.h>
 #include <mswsock.h>
 #include <ws2tcpip.h>
 #include "wrappers.h"
 #include <io.h>
-#include <wepoll.h>
 #include <pthread.h>
 #endif
 
diff --git a/src/dap_traffic_track.c b/src/dap_traffic_track.c
index 872e361..7b7ccb7 100755
--- a/src/dap_traffic_track.c
+++ b/src/dap_traffic_track.c
@@ -32,14 +32,11 @@
 #include <pthread.h>
 #include <ev.h>
 #else
-#undef _WIN32_WINNT
-#define _WIN32_WINNT 0x0600
 #include <winsock2.h>
 #include <windows.h>
 #include <mswsock.h>
 #include <ws2tcpip.h>
 #include <io.h>
-#include <wepoll.h>
 #include <pthread.h>
 #endif
 
-- 
GitLab