microsoft / vcpkg

C++ Library Manager for Windows, Linux, and MacOS
MIT License
22.75k stars 6.29k forks source link

[boost-asio] Add package option to enable io_uring support #22064

Open gracicot opened 2 years ago

gracicot commented 2 years ago

Is your feature request related to a problem? Please describe.

The next boost asio (version 1.78) has an option for enabling io_uring. It must be compiled with BOOST_ASIO_HAS_IO_URING and BOOST_ASIO_DISABLE_EPOLL

Proposed solution An installation option to enable uring

Describe alternatives you've considered The two options could also be enabled/disabled to selectively enable uring, epoll, or both.

Additional context Boost 1.78 is out: https://www.boost.org/doc/libs/1_78_0/doc/html/boost_asio/history.html

yurybura commented 2 years ago

Boost.Asio is header only library. You can add these defines in your application.

gracicot commented 2 years ago

@yurybura As far as I know changing options would change the interface requirement for boost asio, which would apply to all packages using it. Simply using a define because it's header only don't cut it. If you have a dependency that use boost asio and you define those keyword in your project, you'll have ODR violation. The package manager should take care of that.

yurybura commented 2 years ago

The Boost packages are compatible with built-in CMake targets:

find_package(Boost REQUIRED [COMPONENTS <libs>...])
target_link_libraries(main PRIVATE Boost::boost Boost::<lib1> Boost::<lib2> ...)

vcpkg doesn't provide any other exported CMake target.

Due to boost-asio doesn't have binary files I think you can simply build your own application like this:

 find_package(Boost REQUIRED)
 target_link_libraries(main PRIVATE Boost::boost)
 target_compile_definitions(main 
    PRIVATE
        BOOST_ASIO_HAS_IO_URING=1
        BOOST_ASIO_DISABLE_EPOLL=1
 )

If another vcpkg port will use io_uring at build time, that package should have similar CMake code in portfile.cmake.

github-actions[bot] commented 1 month ago

This is an automated message. Per our repo policy, stale issues get closed if there has been no activity in the past 180 days. The issue will be automatically closed in 14 days. If you wish to keep this issue open, please add a new comment.

gracicot commented 1 month ago

I don't think this issue should be closed simply because there was no comments. I think it would be valuable to have a port feature for boost asio to enable io_uring. It is a header only library yes, but I don't think it's really relevant for this issue. If consistency, avoiding ODR violations and one day enable C++20 module builds is something vcpkg users want, it should be port feature.