diff options
author | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-04-07 18:45:59 +0000 |
---|---|---|
committer | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-04-07 18:45:59 +0000 |
commit | 19fcec84d8d7d21e796c7624e521b60d28ee21ed (patch) | |
tree | 42d26aa27d1e3f7c0b8bd3fd14e7d7082f5008dc /cmake/modules/Builduring.cmake | |
parent | Initial commit. (diff) | |
download | ceph-upstream.tar.xz ceph-upstream.zip |
Adding upstream version 16.2.11+ds.upstream/16.2.11+dsupstream
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'cmake/modules/Builduring.cmake')
-rw-r--r-- | cmake/modules/Builduring.cmake | 39 |
1 files changed, 39 insertions, 0 deletions
diff --git a/cmake/modules/Builduring.cmake b/cmake/modules/Builduring.cmake new file mode 100644 index 000000000..328aa5ac7 --- /dev/null +++ b/cmake/modules/Builduring.cmake @@ -0,0 +1,39 @@ +function(build_uring) + include(FindMake) + find_make("MAKE_EXECUTABLE" "make_cmd") + + 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 + GIT_REPOSITORY https://github.com/axboe/liburing.git + GIT_TAG "liburing-0.7" + GIT_SHALLOW TRUE + GIT_CONFIG advice.detachedHead=false) + endif() + + include(ExternalProject) + ExternalProject_Add(liburing_ext + ${source_dir_args} + CONFIGURE_COMMAND <SOURCE_DIR>/configure + BUILD_COMMAND env CC=${CMAKE_C_COMPILER} "CFLAGS=${CMAKE_C_FLAGS} -fPIC" ${make_cmd} -C src -s + BUILD_IN_SOURCE 1 + BUILD_BYPRODUCTS "<SOURCE_DIR>/src/liburing.a" + INSTALL_COMMAND "" + UPDATE_COMMAND "") + 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() |