diff options
Diffstat (limited to 'contrib/libev/CMakeLists.txt')
-rw-r--r-- | contrib/libev/CMakeLists.txt | 68 |
1 files changed, 68 insertions, 0 deletions
diff --git a/contrib/libev/CMakeLists.txt b/contrib/libev/CMakeLists.txt new file mode 100644 index 000000000..ca216d180 --- /dev/null +++ b/contrib/libev/CMakeLists.txt @@ -0,0 +1,68 @@ +SET(LIBEVSRC ev.c) + +CHECK_INCLUDE_FILES(sys/types.h HAVE_SYS_TYPES_H) +CHECK_INCLUDE_FILES(sys/inotify.h HAVE_SYS_INOTIFY_H) +CHECK_INCLUDE_FILES(sys/epoll.h HAVE_SYS_EPOLL_H) +CHECK_INCLUDE_FILES(sys/event.h HAVE_SYS_EVENT_H) +CHECK_INCLUDE_FILES(sys/queue.h HAVE_SYS_QUEUE_H) +CHECK_INCLUDE_FILES(sys/stat.h HAVE_SYS_STAT_H) +CHECK_INCLUDE_FILES(sys/signalfd.h HAVE_SYS_SIGNALFD_H) +CHECK_INCLUDE_FILES(port.h HAVE_PORT_H) +CHECK_INCLUDE_FILES(poll.h HAVE_POLL_H) +CHECK_INCLUDE_FILES(sys/select.h HAVE_SYS_SELECT_H) +CHECK_INCLUDE_FILES(sys/eventfd.h HAVE_SYS_EVENTFD_H) + +IF(HAVE_SYS_INOTIFY_H) + CHECK_SYMBOL_EXISTS(inotify_init "sys/types.h;sys/inotify.h" HAVE_INOTIFY_INIT) +ENDIF() +IF(HAVE_SYS_EPOLL_H) + CHECK_SYMBOL_EXISTS(epoll_ctl "sys/types.h;sys/epoll.h" HAVE_EPOLL_CTL) +ENDIF() +IF(HAVE_SYS_EVENT_H) + CHECK_SYMBOL_EXISTS(kqueue "sys/types.h;sys/event.h;sys/time.h" HAVE_KQUEUE) +ENDIF() +IF(HAVE_PORT_H) + CHECK_SYMBOL_EXISTS(port_create port.h HAVE_PORT_CREATE) +ENDIF() +IF(HAVE_POLL_H) + CHECK_SYMBOL_EXISTS(poll poll.h HAVE_POLL) +ENDIF() +IF(HAVE_SYS_SELECT_H) + CHECK_SYMBOL_EXISTS(select sys/select.h HAVE_SELECT) +ENDIF() +IF(HAVE_SYS_EVENTFD_H) + CHECK_SYMBOL_EXISTS(eventfd sys/eventfd.h HAVE_EVENTFD) +ENDIF() +IF(HAVE_SYS_SIGNALFD_H) + CHECK_SYMBOL_EXISTS(signalfd sys/signalfd.h HAVE_EVENTFD) +ENDIF() + +CHECK_SYMBOL_EXISTS(time.h nanosleep HAVE_NANOSLEEP) + +# check first without rt +CHECK_FUNCTION_EXISTS(clock_gettime HAVE_CLOCK_GETTIME) + +CHECK_LIBRARY_EXISTS(rt clock_gettime "" HAVE_LIBRT) +# then check with rt +CHECK_LIBRARY_EXISTS(rt clock_gettime "" HAVE_CLOCK_GETTIME) +CHECK_LIBRARY_EXISTS(m ceil "" HAVE_LIBM) + +IF(ENABLE_FULL_DEBUG MATCHES "OFF") +if ("${CMAKE_C_COMPILER_ID}" STREQUAL "Clang" OR "${CMAKE_C_COMPILER_ID}" STREQUAL "GNU") + SET(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -O3") +endif () +ENDIF() + +CONFIGURE_FILE(config.h.in libev-config.h) + +ADD_LIBRARY(rspamd-libev STATIC ${LIBEVSRC}) +ADD_DEFINITIONS("-DEV_CONFIG_H=\"${CMAKE_CURRENT_BINARY_DIR}/libev-config.h\"" + -DEV_MULTIPLICITY=1 + -DEV_USE_FLOOR=1 + -DEV_USE_MONOTONIC=1 + -DEV_NO_THREADS=1 # We do not have threads in Rspamd! + -DEV_FEATURES=127 # Enable all features + ) +IF(HAVE_EVENTFD) + ADD_DEFINITIONS(-DEV_USE_EVENTFD=1) +ENDIF()
\ No newline at end of file |