From 80cfed38a1c04e19c62efdbab3e2d165615d7654 Mon Sep 17 00:00:00 2001 From: Adrien Beraud Date: Tue, 17 Dec 2024 16:03:15 -0500 Subject: [PATCH] build/cmake: make using io_uring optional --- CMakeLists.txt | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 947ace4f7..960e0a3c2 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -33,6 +33,7 @@ option (OPENDHT_PROXY_CLIENT "Enable DHT proxy client, use Restinio and jsoncpp" option (OPENDHT_PROXY_OPENSSL "Build DHT proxy with OpenSSL" ON) CMAKE_DEPENDENT_OPTION(OPENDHT_HTTP "Build embedded http(s) client" OFF "NOT OPENDHT_PROXY_SERVER;NOT OPENDHT_PROXY_CLIENT" ON) option (OPENDHT_PEER_DISCOVERY "Enable multicast peer discovery" ON) +option (OPENDHT_IO_URING "Use io_uring if available on the system (Linux only)" OFF) option (OPENDHT_INDEX "Build DHT indexation feature" OFF) option (OPENDHT_TESTS_NETWORK "Enable unit tests that require network access" ON) option (OPENDHT_C "Build C bindings" OFF) @@ -107,7 +108,7 @@ if (NOT MSVC) ) set(llhttp_target llhttp_static) else() - FetchContent_Declare(llhttp-local URL "https://github.com/nodejs/llhttp/archive/refs/tags/release/v9.2.0.tar.gz") + FetchContent_Declare(llhttp-local URL "https://github.com/nodejs/llhttp/archive/refs/tags/release/v9.2.1.tar.gz") if (BUILD_SHARED_LIBS) set(BUILD_SHARED_LIBS ON CACHE INTERNAL "") else() @@ -163,7 +164,7 @@ endif () if (OPENDHT_HTTP OR OPENDHT_PEER_DISCOVERY) add_definitions(-DASIO_STANDALONE) - if (UNIX AND NOT APPLE) + if (OPENDHT_IO_URING AND UNIX AND NOT APPLE) pkg_search_module(liburing IMPORTED_TARGET liburing) endif () endif() @@ -407,7 +408,7 @@ else() if (OPENDHT_PROXY_OPENSSL) target_link_libraries(opendht PUBLIC PkgConfig::OPENSSL) endif() - if (liburing_FOUND) + if (OPENDHT_IO_URING AND liburing_FOUND) set(iouring_lib ", liburing") target_link_libraries(opendht PUBLIC PkgConfig::liburing) target_compile_definitions(opendht PUBLIC ASIO_HAS_IO_URING ASIO_DISABLE_EPOLL)