mariadb/tpool/CMakeLists.txt

44 lines
1.2 KiB
Text
Raw Normal View History

INCLUDE_DIRECTORIES(${CMAKE_CURRENT_SOURCE_DIR} ${PROJECT_SOURCE_DIR}/include)
IF(WIN32)
SET(EXTRA_SOURCES tpool_win.cc aio_win.cc)
ELSEIF(CMAKE_SYSTEM_NAME STREQUAL "Linux")
OPTION(WITH_URING "Require that io_uring be used" OFF)
FIND_PACKAGE(URING)
IF(URING_FOUND)
SET(URING_FOUND ${URING_FOUND} PARENT_SCOPE)
SET(TPOOL_DEFINES "-DHAVE_URING" PARENT_SCOPE)
ADD_DEFINITIONS(-DHAVE_URING)
LINK_LIBRARIES(${LIBURING_LIBRARIES})
INCLUDE_DIRECTORIES(${LIBURING_INCLUDE_DIR})
SET(EXTRA_SOURCES aio_liburing.cc)
ELSE()
IF(WITH_URING)
MESSAGE(FATAL_ERROR "WITH_URING=ON cannot be satisfied")
ENDIF()
CHECK_INCLUDE_FILES (libaio.h HAVE_LIBAIO_H)
CHECK_LIBRARY_EXISTS(aio io_queue_init "" HAVE_LIBAIO)
IF(HAVE_LIBAIO_H AND HAVE_LIBAIO)
SET(TPOOL_DEFINES "-DLINUX_NATIVE_AIO" PARENT_SCOPE)
ADD_DEFINITIONS(-DLINUX_NATIVE_AIO)
LINK_LIBRARIES(aio)
SET(EXTRA_SOURCES aio_linux.cc)
ENDIF()
ENDIF()
ENDIF()
ADD_LIBRARY(tpool STATIC
aio_simulated.cc
tpool_structs.h
CMakeLists.txt
tpool.h
tpool_generic.cc
task_group.cc
task.cc
wait_notification.cc
${EXTRA_SOURCES}
)
IF(URING_FOUND)
ADD_DEPENDENCIES(tpool GenError)
ENDIF()