mirror of
https://github.com/rspamd/rspamd.git
synced 2024-08-18 14:10:22 +02:00
73 lines
2.3 KiB
CMake
73 lines
2.3 KiB
CMake
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/types.h;sys/event.h;sys/time.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-ev SHARED ${LIBEVSRC})
|
|
ADD_DEFINITIONS("-DEV_CONFIG_H=\"${CMAKE_CURRENT_BINARY_DIR}/libev-config.h\""
|
|
-DEV_MULTIPLICITY=1
|
|
-DEV_USE_FLOOR=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()
|
|
|
|
IF(ENABLE_FULL_DEBUG MATCHES "ON")
|
|
ADD_DEFINITIONS(-DEV_VERIFY=3)
|
|
ENDIF()
|
|
|
|
INSTALL(TARGETS rspamd-ev LIBRARY DESTINATION ${RSPAMD_LIBDIR}) |