Skip to content

Commit

Permalink
fix ci
Browse files Browse the repository at this point in the history
  • Loading branch information
poor-circle committed Jul 5, 2023
1 parent a80c81a commit af55d4f
Show file tree
Hide file tree
Showing 3 changed files with 30 additions and 2 deletions.
3 changes: 3 additions & 0 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,9 @@ project(yaLanTingLibs
LANGUAGES CXX
)

# load pack finder
list(APPEND CMAKE_MODULE_PATH ${PROJECT_SOURCE_DIR}/cmake/Find/)

# add include path
include_directories(include)
include_directories(include/ylt/thirdparty)
Expand Down
23 changes: 23 additions & 0 deletions cmake/Find/Finduring.cmake
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
# * Find liburing Find the liburing library and includes
#
# URING_INCLUDE_DIR - where to find liburing.h, etc. URING_LIBRARIES - List of
# libraries when using uring. URING_FOUND - True if uring found.

find_path(URING_INCLUDE_DIR liburing.h)
find_library(URING_LIBRARIES uring)

include(FindPackageHandleStandardArgs)
find_package_handle_standard_args(uring DEFAULT_MSG URING_LIBRARIES
URING_INCLUDE_DIR)

if(URING_FOUND)
if(NOT TARGET uring)
add_library(uring UNKNOWN IMPORTED)
endif()
set_target_properties(
uring
PROPERTIES INTERFACE_INCLUDE_DIRECTORIES "${URING_INCLUDE_DIR}"
IMPORTED_LINK_INTERFACE_LANGUAGES "C"
IMPORTED_LOCATION "${URING_LIBRARIES}")
mark_as_advanced(URING_LIBRARIES)
endif()
6 changes: 4 additions & 2 deletions cmake/config.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -16,17 +16,19 @@ endif ()
option(ENABLE_IO_URING "Enable io_uring" OFF)
message(STATUS "ENABLE_IO_URING: ${ENABLE_IO_URING}")
if (ENABLE_IO_URING)
find_package(uring REQUIRED)
message(STATUS "Use IO_URING for all I/O in linux")
add_compile_definitions(ASIO_HAS_IO_URING ASIO_DISABLE_EPOLL ASIO_HAS_FILE YLT_ENABLE_FILE_IO_URING)
add_link_options(-luring)
link_libraries(uring)
endif()

option(ENABLE_FILE_IO_URING "Enable file io_uring" OFF)
if (NOT ENABLE_IO_URING)
if(ENABLE_FILE_IO_URING)
find_package(uring REQUIRED)
message(STATUS "Enable io_uring for file I/O in linux")
add_compile_definitions(ASIO_HAS_IO_URING ASIO_HAS_FILE YLT_ENABLE_FILE_IO_URING)
add_link_options(-luring)
link_libraries(uring)
endif()
endif()

Expand Down

0 comments on commit af55d4f

Please sign in to comment.