Commit b7290854 authored by louiz’'s avatar louiz’

Let the user choose the poller to use through cmake POLLER option

Use ccmake, or cmake -i, or cmake -DPOLLER=EPOLL, for example
parent b569240a
...@@ -24,6 +24,12 @@ include_directories(${ICONV_INCLUDE_DIR}) ...@@ -24,6 +24,12 @@ include_directories(${ICONV_INCLUDE_DIR})
# coming from these headers. # coming from these headers.
include_directories(SYSTEM ${CRYPTO++_INCLUDE_DIR}) include_directories(SYSTEM ${CRYPTO++_INCLUDE_DIR})
set(POLLER "POLL" CACHE STRING
"Choose the poller between POLL and EPOLL (Linux-only)")
if((NOT ${POLLER} MATCHES "POLL") AND
(NOT ${POLLER} MATCHES "EPOLL"))
message(FATAL_ERROR "POLLER must be either POLL or EPOLL")
endif()
# #
## utils ## utils
# #
...@@ -95,4 +101,4 @@ target_link_libraries(test ...@@ -95,4 +101,4 @@ target_link_libraries(test
utils utils
config) config)
CONFIGURE_FILE(config.h.cmake src/config.h @ONLY) configure_file(config.h.cmake src/config.h)
#cmakedefine ICONV_SECOND_ARGUMENT_IS_CONST #cmakedefine ICONV_SECOND_ARGUMENT_IS_CONST
#cmakedefine POLLER ${POLLER}
...@@ -9,11 +9,9 @@ ...@@ -9,11 +9,9 @@
#define POLL 1 #define POLL 1
#define EPOLL 2 #define EPOLL 2
#define KQUEUE 3 #define KQUEUE 3
#include <config.h> #include <config.h>
#ifndef POLLER #ifndef POLLER
// Default standard poller #define POLLER POLL
#define POLLER EPOLL
#endif #endif
#if POLLER == POLL #if POLLER == POLL
...@@ -21,6 +19,8 @@ ...@@ -21,6 +19,8 @@
#define MAX_POLL_FD_NUMBER 4096 #define MAX_POLL_FD_NUMBER 4096
#elif POLLER == EPOLL #elif POLLER == EPOLL
#include <sys/epoll.h> #include <sys/epoll.h>
#else
#error Invalid POLLER value
#endif #endif
/** /**
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment