Skip to content

Commit

Permalink
Add liburing 2.2
Browse files Browse the repository at this point in the history
  • Loading branch information
kononovk committed Apr 1, 2023
1 parent 85ca9b0 commit ad7ef37
Show file tree
Hide file tree
Showing 3 changed files with 38 additions and 7 deletions.
2 changes: 1 addition & 1 deletion CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
cmake_minimum_required(VERSION 3.3)
cmake_minimum_required(VERSION 3.10)

project(ione
LANGUAGES CXX
Expand Down
40 changes: 34 additions & 6 deletions src/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -21,15 +21,43 @@ configure_file(config.hpp.in ${IONE_BINARY_DIR}/include/ione/config.hpp)

add_library(ione STATIC)

include(FetchContent)
FetchContent_Declare(yaclib
GIT_REPOSITORY https://github.com/YACLib/YACLib.git
GIT_TAG main
# yaclib
if (NOT TARGET yaclib)
include(FetchContent)
FetchContent_Declare(yaclib
GIT_REPOSITORY https://github.com/YACLib/YACLib.git
GIT_TAG main
)
set(YACLIB_FLAGS "CORO")
FetchContent_MakeAvailable(yaclib)
set(YACLIB_FLAGS "CORO")
FetchContent_MakeAvailable(yaclib)
endif()
target_link_libraries(ione PUBLIC yaclib)


# liburing based on this
# https://github.com/questdb/questdb/blob/master/core/CMakeLists.txt#L186
if (UNIX AND NOT APPLE AND CMAKE_SYSTEM_NAME MATCHES "Linux")
include(ExternalProject)
ExternalProject_Add(
liburing_git
GIT_REPOSITORY http://github.com/axboe/liburing.git
GIT_TAG liburing-2.2
BUILD_IN_SOURCE 1
BUILD_BYPRODUCTS "<SOURCE_DIR>/src/liburing.a"
BUILD_COMMAND make "CC=${CMAKE_C_COMPILER}" "CXX=${CMAKE_CXX_COMPILER}" "AR=${CMAKE_AR}" "RANLIB=${CMAKE_RANLIB}"
CONFIGURE_COMMAND ""
INSTALL_COMMAND ""
TEST_COMMAND ""
LOG_BUILD ON
)
ExternalProject_Get_Property(liburing_git SOURCE_DIR)
add_library(liburing INTERFACE)
add_dependencies(liburing liburing_git)
target_include_directories(liburing INTERFACE ${SOURCE_DIR}/src/include)
target_link_libraries(liburing INTERFACE ${SOURCE_DIR}/src/liburing.a)
target_link_libraries(ione PUBLIC liburing)
endif ()

target_sources(ione
PUBLIC ${IONE_INCLUDES}
PRIVATE ${IONE_HEADERS}
Expand Down
3 changes: 3 additions & 0 deletions test/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -74,3 +74,6 @@ else ()
endif ()

unset(IONE_TEST_SOURCES)

add_executable(cat_example cat_example.cpp)
target_link_libraries(cat_example PRIVATE ione)

0 comments on commit ad7ef37

Please sign in to comment.