diff options
author | Florent Le Coz <louiz@louiz.org> | 2013-11-21 00:21:32 +0100 |
---|---|---|
committer | Florent Le Coz <louiz@louiz.org> | 2013-11-21 00:35:15 +0100 |
commit | b72908548dc841de65dc9288a96c1abe648acc46 (patch) | |
tree | 860fe7bc4f54ff89d36c3f3e5b0f0c6622bc6240 | |
parent | b569240a55a0df3a78d3cb3e1e673e9347e531c0 (diff) | |
download | biboumi-b72908548dc841de65dc9288a96c1abe648acc46.tar.gz biboumi-b72908548dc841de65dc9288a96c1abe648acc46.tar.bz2 biboumi-b72908548dc841de65dc9288a96c1abe648acc46.tar.xz biboumi-b72908548dc841de65dc9288a96c1abe648acc46.zip |
Let the user choose the poller to use through cmake POLLER option
Use ccmake, or cmake -i, or cmake -DPOLLER=EPOLL, for example
-rw-r--r-- | CMakeLists.txt | 8 | ||||
-rw-r--r-- | config.h.cmake | 1 | ||||
-rw-r--r-- | src/network/poller.hpp | 6 |
3 files changed, 11 insertions, 4 deletions
diff --git a/CMakeLists.txt b/CMakeLists.txt index 21e82b4..2c01ee3 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -24,6 +24,12 @@ include_directories(${ICONV_INCLUDE_DIR}) # coming from these headers. 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 # @@ -95,4 +101,4 @@ target_link_libraries(test utils config) -CONFIGURE_FILE(config.h.cmake src/config.h @ONLY) +configure_file(config.h.cmake src/config.h) diff --git a/config.h.cmake b/config.h.cmake index 5f0a3cb..e17cc80 100644 --- a/config.h.cmake +++ b/config.h.cmake @@ -1 +1,2 @@ #cmakedefine ICONV_SECOND_ARGUMENT_IS_CONST +#cmakedefine POLLER ${POLLER} diff --git a/src/network/poller.hpp b/src/network/poller.hpp index e6ce7f2..fe52fda 100644 --- a/src/network/poller.hpp +++ b/src/network/poller.hpp @@ -9,11 +9,9 @@ #define POLL 1 #define EPOLL 2 #define KQUEUE 3 - #include <config.h> #ifndef POLLER - // Default standard poller - #define POLLER EPOLL + #define POLLER POLL #endif #if POLLER == POLL @@ -21,6 +19,8 @@ #define MAX_POLL_FD_NUMBER 4096 #elif POLLER == EPOLL #include <sys/epoll.h> +#else + #error Invalid POLLER value #endif /** |