2021-03-20 15:23:47 +01: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 15:23:47 +01:00
|
|
|
ELSEIF(CMAKE_SYSTEM_NAME STREQUAL "Linux")
|
|
|
|
OPTION(WITH_URING "Require that io_uring be used" OFF)
|
CMake cleanup
- use FIND_PACKAGE(LIBAIO) to find libaio
- Use standard CMake conventions in Find{PMEM,URING}.cmake
- Drop the LIB from LIB{PMEM,URING}_{INCLUDE_DIR,LIBRARIES}
It is cleaner, and consistent with how other packages are handled in CMake.
e.g successful FIND_PACKAGE(PMEM) now sets PMEM_FOUND, PMEM_LIBRARIES,
PMEM_INCLUDE_DIR, not LIBPMEM_{FOUND,LIBRARIES,INCLUDE_DIR}.
- Decrease the output. use FIND_PACKAGE with QUIET argument.
- for Linux packages, either liburing, or libaio is required
If liburing is installed, libaio does not need to be present .
Use FIND_PACKAGE([LIBAIO|URING] REQUIRED) if either library is required.
2021-03-23 09:41:50 +01:00
|
|
|
OPTION(WITH_LIBAIO "Require that libaio is used, unless uring is there" OFF)
|
|
|
|
IF(WITH_URING)
|
|
|
|
SET(URING_REQUIRED REQUIRED)
|
|
|
|
ELSEIF(WITH_LIBAIO)
|
|
|
|
SET(LIBAIO_REQIRED REQUIRED)
|
|
|
|
ENDIF()
|
|
|
|
FIND_PACKAGE(URING QUIET ${URING_REQUIRED})
|
2021-03-20 15:23:47 +01:00
|
|
|
IF(URING_FOUND)
|
|
|
|
SET(URING_FOUND ${URING_FOUND} PARENT_SCOPE)
|
|
|
|
SET(TPOOL_DEFINES "-DHAVE_URING" PARENT_SCOPE)
|
|
|
|
ADD_DEFINITIONS(-DHAVE_URING)
|
CMake cleanup
- use FIND_PACKAGE(LIBAIO) to find libaio
- Use standard CMake conventions in Find{PMEM,URING}.cmake
- Drop the LIB from LIB{PMEM,URING}_{INCLUDE_DIR,LIBRARIES}
It is cleaner, and consistent with how other packages are handled in CMake.
e.g successful FIND_PACKAGE(PMEM) now sets PMEM_FOUND, PMEM_LIBRARIES,
PMEM_INCLUDE_DIR, not LIBPMEM_{FOUND,LIBRARIES,INCLUDE_DIR}.
- Decrease the output. use FIND_PACKAGE with QUIET argument.
- for Linux packages, either liburing, or libaio is required
If liburing is installed, libaio does not need to be present .
Use FIND_PACKAGE([LIBAIO|URING] REQUIRED) if either library is required.
2021-03-23 09:41:50 +01:00
|
|
|
LINK_LIBRARIES(${URING_LIBRARIES})
|
|
|
|
INCLUDE_DIRECTORIES(${URING_INCLUDE_DIR})
|
2021-03-20 15:23:47 +01:00
|
|
|
SET(EXTRA_SOURCES aio_liburing.cc)
|
2021-04-13 12:54:37 +02:00
|
|
|
SET(CMAKE_REQUIRED_INCLUDES_SAVE ${CMAKE_REQUIRED_INCLUDES})
|
|
|
|
SET(CMAKE_REQUIRED_LIBRARIES_SAVE ${CMAKE_REQUIRED_LIBRARIES})
|
|
|
|
SET(CMAKE_REQUIRED_INCLUDES ${URING_INCLUDE_DIR})
|
|
|
|
SET(CMAKE_REQUIRED_LIBRARIES ${URING_LIBRARIES})
|
|
|
|
CHECK_SYMBOL_EXISTS(io_uring_mlock_size "liburing.h" HAVE_IO_URING_MLOCK_SIZE)
|
|
|
|
SET(CMAKE_REQUIRED_INCLUDES ${CMAKE_REQUIRED_INCLUDES_SAVE})
|
|
|
|
SET(CMAKE_REQUIRED_LIBRARIES ${CMAKE_REQUIRED_LIBRARIES_SAVE})
|
|
|
|
IF(HAVE_IO_URING_MLOCK_SIZE)
|
|
|
|
SET_SOURCE_FILES_PROPERTIES(aio_liburing.cc PROPERTIES COMPILE_FLAGS "-DHAVE_IO_URING_MLOCK_SIZE")
|
|
|
|
ENDIF()
|
2021-03-20 15:23:47 +01:00
|
|
|
ELSE()
|
CMake cleanup
- use FIND_PACKAGE(LIBAIO) to find libaio
- Use standard CMake conventions in Find{PMEM,URING}.cmake
- Drop the LIB from LIB{PMEM,URING}_{INCLUDE_DIR,LIBRARIES}
It is cleaner, and consistent with how other packages are handled in CMake.
e.g successful FIND_PACKAGE(PMEM) now sets PMEM_FOUND, PMEM_LIBRARIES,
PMEM_INCLUDE_DIR, not LIBPMEM_{FOUND,LIBRARIES,INCLUDE_DIR}.
- Decrease the output. use FIND_PACKAGE with QUIET argument.
- for Linux packages, either liburing, or libaio is required
If liburing is installed, libaio does not need to be present .
Use FIND_PACKAGE([LIBAIO|URING] REQUIRED) if either library is required.
2021-03-23 09:41:50 +01:00
|
|
|
FIND_PACKAGE(LIBAIO QUIET ${LIBAIO_REQUIRED})
|
|
|
|
IF(LIBAIO_FOUND)
|
2021-03-20 15:23:47 +01:00
|
|
|
SET(TPOOL_DEFINES "-DLINUX_NATIVE_AIO" PARENT_SCOPE)
|
|
|
|
ADD_DEFINITIONS(-DLINUX_NATIVE_AIO)
|
CMake cleanup
- use FIND_PACKAGE(LIBAIO) to find libaio
- Use standard CMake conventions in Find{PMEM,URING}.cmake
- Drop the LIB from LIB{PMEM,URING}_{INCLUDE_DIR,LIBRARIES}
It is cleaner, and consistent with how other packages are handled in CMake.
e.g successful FIND_PACKAGE(PMEM) now sets PMEM_FOUND, PMEM_LIBRARIES,
PMEM_INCLUDE_DIR, not LIBPMEM_{FOUND,LIBRARIES,INCLUDE_DIR}.
- Decrease the output. use FIND_PACKAGE with QUIET argument.
- for Linux packages, either liburing, or libaio is required
If liburing is installed, libaio does not need to be present .
Use FIND_PACKAGE([LIBAIO|URING] REQUIRED) if either library is required.
2021-03-23 09:41:50 +01:00
|
|
|
INCLUDE_DIRECTORIES(${LIBAIO_INCLUDE_DIR})
|
|
|
|
LINK_LIBRARIES(${LIBAIO_LIBRARIES})
|
2021-03-20 15:23:47 +01:00
|
|
|
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 23:26:04 +01:00
|
|
|
wait_notification.cc
|
2019-10-29 18:17:24 +01:00
|
|
|
${EXTRA_SOURCES}
|
|
|
|
)
|
|
|
|
|
2021-03-20 15:23:47 +01:00
|
|
|
IF(URING_FOUND)
|
2021-03-15 11:11:29 +01:00
|
|
|
ADD_DEPENDENCIES(tpool GenError)
|
|
|
|
ENDIF()
|