2020-04-13 09:55:49 +00:00
|
|
|
function(build_uring)
|
|
|
|
include(FindMake)
|
|
|
|
find_make("MAKE_EXECUTABLE" "make_cmd")
|
|
|
|
|
2020-11-09 05:11:06 +00:00
|
|
|
if(EXISTS "${PROJECT_SOURCE_DIR}/src/liburing/configure")
|
|
|
|
set(source_dir_args
|
|
|
|
SOURCE_DIR "${PROJECT_SOURCE_DIR}/src/liburing")
|
|
|
|
else()
|
|
|
|
set(source_dir_args
|
|
|
|
SOURCE_DIR ${CMAKE_BINARY_DIR}/src/liburing
|
2020-12-03 01:56:43 +00:00
|
|
|
GIT_REPOSITORY https://github.com/axboe/liburing.git
|
2020-11-09 05:11:06 +00:00
|
|
|
GIT_TAG "liburing-0.7"
|
|
|
|
GIT_SHALLOW TRUE
|
2020-11-24 03:24:35 +00:00
|
|
|
GIT_CONFIG advice.detachedHead=false)
|
2020-11-09 05:11:06 +00:00
|
|
|
endif()
|
|
|
|
|
2020-04-13 09:55:49 +00:00
|
|
|
include(ExternalProject)
|
|
|
|
ExternalProject_Add(liburing_ext
|
2020-11-09 05:11:06 +00:00
|
|
|
${source_dir_args}
|
2021-04-27 05:33:40 +00:00
|
|
|
CONFIGURE_COMMAND env CC=${CMAKE_C_COMPILER} CXX=${CMAKE_CXX_COMPILER} <SOURCE_DIR>/configure
|
|
|
|
BUILD_COMMAND ${make_cmd} "CFLAGS=${CMAKE_C_FLAGS} -fPIC" -C src -s
|
2020-04-13 09:55:49 +00:00
|
|
|
BUILD_IN_SOURCE 1
|
|
|
|
BUILD_BYPRODUCTS "<SOURCE_DIR>/src/liburing.a"
|
2020-11-24 03:24:35 +00:00
|
|
|
INSTALL_COMMAND ""
|
2021-08-16 10:42:18 +00:00
|
|
|
UPDATE_COMMAND ""
|
|
|
|
LOG_CONFIGURE ON
|
|
|
|
LOG_BUILD ON
|
|
|
|
LOG_MERGED_STDOUTERR ON
|
|
|
|
LOG_OUTPUT_ON_FAILURE ON)
|
2020-04-13 09:55:49 +00:00
|
|
|
unset(make_cmd)
|
|
|
|
|
|
|
|
ExternalProject_Get_Property(liburing_ext source_dir)
|
|
|
|
set(URING_INCLUDE_DIR "${source_dir}/src/include")
|
|
|
|
set(URING_LIBRARY_DIR "${source_dir}/src")
|
|
|
|
|
|
|
|
add_library(uring::uring STATIC IMPORTED GLOBAL)
|
|
|
|
add_dependencies(uring::uring liburing_ext)
|
|
|
|
file(MAKE_DIRECTORY ${URING_INCLUDE_DIR})
|
|
|
|
set_target_properties(uring::uring PROPERTIES
|
|
|
|
INTERFACE_INCLUDE_DIRECTORIES ${URING_INCLUDE_DIR}
|
|
|
|
IMPORTED_LINK_INTERFACE_LANGUAGES "C"
|
|
|
|
IMPORTED_LOCATION "${URING_LIBRARY_DIR}/liburing.a")
|
|
|
|
endfunction()
|