1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63
|
#
# A macro to build the bundled libev
macro(libev_build)
set(ev_compile_flags)
set(ev_link_libraries)
# There are warnings in libev code which are impossible to selectively
# turn off, see
# http://gcc.gnu.org/bugzilla/show_bug.cgi?id=45977
# http://pod.tst.eu/http://cvs.schmorp.de/libev/ev.pod#COMPILER_WARNINGS
# while this stand off is going on, the world is not a very happy
# place:
set(ev_compile_flags "${ev_compile_flags} -w")
# if (CC_HAS_WNO_UNUSED_RESULT)
# set(ev_compile_flags "${ev_compile_flags} -Wno-unused-value")
# endif()
# if (CC_HAS_WNO_COMMENT)
# set(ev_compile_flags "${ev_compile_flags} -Wno-comment")
# endif()
# if (CC_HAS_FNO_STRICT_ALIASING)
# set(ev_compile_flags "${ev_compile_flags} -fno-strict-aliasing")
# endif()
# if (CC_HAS_WNO_PARENTHESES)
# set(ev_compile_flags "${ev_compile_flags} -Wno-parentheses")
# endif()
set(ev_compile_flags "${ev_compile_flags} -DENABLE_BUNDLED_LIBEV=1")
if (TARGET_OS_LINUX)
#
# Enable Linux-specific event notification API (man inotify)
set(ev_compile_flags "${ev_compile_flags} -DEV_USE_INOTIFY")
set(ev_compile_flags "${ev_compile_flags} -DEV_USE_EVENTFD")
set(ev_compile_flags "${ev_compile_flags} -DEV_USE_SIGNALFD")
elseif (TARGET_OS_FREEBSD OR TARGET_OS_DARWIN)
#
# On FreeBSD build libev loop on top of
set(ev_compile_flags "${ev_compile_flags} -DEV_USE_KQUEUE")
endif()
list(APPEND ev_link_libraries "m")
if (TARGET_OS_DEBIAN_FREEBSD)
# libev depends on librt under kFreeBSD
list(APPEND ev_link_libraries "rt")
else()
endif()
set(libev_src
${PROJECT_SOURCE_DIR}/third_party/tarantool_ev.c
)
add_library(ev STATIC ${libev_src})
set_target_properties(ev PROPERTIES COMPILE_FLAGS "${ev_compile_flags}")
target_link_libraries(ev ${ev_link_libraries})
set(LIBEV_INCLUDE_DIR ${PROJECT_BINARY_DIR}/third_party)
set(LIBEV_LIBRARIES ev)
unset(ev_src)
unset(ev_compile_flags)
unset(ev_link_libraries)
endmacro(libev_build)
|