2021-03-20 16:23:47 +02:00
|
|
|
INCLUDE_DIRECTORIES(${CMAKE_CURRENT_SOURCE_DIR} ${PROJECT_SOURCE_DIR}/include)
|
2019-10-29 18:17:24 +01:00
|
|
|
IF(WIN32)
|
|
|
|
SET(EXTRA_SOURCES tpool_win.cc aio_win.cc)
|
2021-03-20 16:23:47 +02:00
|
|
|
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()
|
2019-10-29 18:17:24 +01:00
|
|
|
ENDIF()
|
|
|
|
|
|
|
|
ADD_LIBRARY(tpool STATIC
|
|
|
|
aio_simulated.cc
|
|
|
|
tpool_structs.h
|
|
|
|
CMakeLists.txt
|
|
|
|
tpool.h
|
|
|
|
tpool_generic.cc
|
|
|
|
task_group.cc
|
|
|
|
task.cc
|
2019-11-29 22:26:04 +00:00
|
|
|
wait_notification.cc
|
2019-10-29 18:17:24 +01:00
|
|
|
${EXTRA_SOURCES}
|
|
|
|
)
|
|
|
|
|
2021-03-20 16:23:47 +02:00
|
|
|
IF(URING_FOUND)
|
2021-03-15 12:11:29 +02:00
|
|
|
ADD_DEPENDENCIES(tpool GenError)
|
|
|
|
ENDIF()
|