boost

Standalone Boost.Asio + Boost.Beast


I am learning boost and want to make a http server using Beast and Asio, but i don't want to drag the whole boost library within my project.

What i did so far: added Boost.Beast and Boost.Asio as submodules from github repos, include them into my project and define BOOST_ASIO_STANDALONE.

Of course it doesn't build and missing a lot of files.

So my question is: can it be done? what parts of boost must be included to make this work?


Solution

  • Beast does not have a standalone mode: you need boost. As with any boost library you can try to excise the subset using the BCP tool.

    However, depending on the task you will end up dragging in a lot of dependencies. The only positive part here is that Beast is header-only, so any savings actually reduce the size of the dependency.

    I'd suggest BCP is rarely worth it, except for very isolated things. Say, if you want to have just boost::container::flat_map or just boost::core::string_view.