Enable beast separate compilation
This commit enables separate compilation for asio and beast. Details on
how this option works are here:
https://www.boost.org/doc/libs/1_77_0/doc/html/boost_asio/using.html
This allows separating out the build of the boost components from the
rest of the components, which should decrease our intermediate build
times in the future as we start breaking things up better.
Tested:
Code builds.
Signed-off-by: Ed Tanous <edtanous@google.com>
Change-Id: I1614bb4ccddebcf1d4858112a25a870378497ecc
diff --git a/meson.build b/meson.build
index 29308f6..9618203 100644
--- a/meson.build
+++ b/meson.build
@@ -259,6 +259,8 @@
'-DBOOST_ASIO_USE_TS_EXECUTOR_AS_DEFAULT',
'-DBOOST_ASIO_DISABLE_THREADS',
'-DBOOST_BEAST_USE_STD_STRING_VIEW',
+ '-DBOOST_BEAST_SEPARATE_COMPILATION',
+ '-DBOOST_ASIO_SEPARATE_COMPILATION',
'-DBOOST_ERROR_CODE_HEADER_ONLY',
'-DBOOST_SYSTEM_NO_DEPRECATED',
'-DBOOST_ASIO_NO_DEPRECATED',
@@ -348,7 +350,10 @@
'src/webserver_main.cpp',
'redfish-core/src/error_messages.cpp',
'redfish-core/src/utils/json_utils.cpp',
- 'src/boost_url.cpp'
+ 'src/boost_url.cpp',
+ 'src/boost_beast.cpp',
+ 'src/boost_asio.cpp',
+ 'src/boost_asio_ssl.cpp',
]
srcfiles_unittest = [
@@ -423,7 +428,10 @@
testname = src_test.split('/')[-1].split('.')[0]
test(testname,executable(testname,
[src_test,
- 'src/boost_url.cpp'],
+ 'src/boost_url.cpp',
+ 'src/boost_beast.cpp',
+ 'src/boost_asio.cpp',
+ 'src/boost_asio_ssl.cpp',],
include_directories : incdir,
install_dir: bindir,
dependencies: [
diff --git a/src/boost_asio.cpp b/src/boost_asio.cpp
new file mode 100644
index 0000000..eb3b726
--- /dev/null
+++ b/src/boost_asio.cpp
@@ -0,0 +1 @@
+#include <boost/asio/impl/src.hpp>
\ No newline at end of file
diff --git a/src/boost_asio_ssl.cpp b/src/boost_asio_ssl.cpp
new file mode 100644
index 0000000..cb6377d
--- /dev/null
+++ b/src/boost_asio_ssl.cpp
@@ -0,0 +1 @@
+#include <boost/asio/ssl/impl/src.hpp>
\ No newline at end of file
diff --git a/src/boost_beast.cpp b/src/boost_beast.cpp
new file mode 100644
index 0000000..0c275a6
--- /dev/null
+++ b/src/boost_beast.cpp
@@ -0,0 +1,45 @@
+/*
+TODO(ed) This file is largely copied from boost/beast/src.hpp
+Unfortuately the test streams don't compile with -fno-rtti at the moment, so
+those files are commented out
+*/
+
+#define BOOST_BEAST_SOURCE
+
+#include <boost/beast/core/detail/config.hpp>
+
+#include <boost/beast/_experimental/test/impl/error.ipp>
+#include <boost/beast/_experimental/test/impl/fail_count.ipp>
+//#include <boost/beast/_experimental/test/impl/stream.ipp>
+//#include <boost/beast/_experimental/test/detail/stream_state.ipp>
+
+#include <boost/beast/core/detail/base64.ipp>
+#include <boost/beast/core/detail/impl/temporary_buffer.ipp>
+#include <boost/beast/core/detail/sha1.ipp>
+#include <boost/beast/core/impl/error.ipp>
+#include <boost/beast/core/impl/file_posix.ipp>
+#include <boost/beast/core/impl/file_stdio.ipp>
+#include <boost/beast/core/impl/file_win32.ipp>
+#include <boost/beast/core/impl/flat_static_buffer.ipp>
+#include <boost/beast/core/impl/saved_handler.ipp>
+#include <boost/beast/core/impl/static_buffer.ipp>
+#include <boost/beast/core/impl/string.ipp>
+#include <boost/beast/http/detail/basic_parser.ipp>
+#include <boost/beast/http/detail/rfc7230.ipp>
+#include <boost/beast/http/impl/basic_parser.ipp>
+#include <boost/beast/http/impl/error.ipp>
+#include <boost/beast/http/impl/field.ipp>
+#include <boost/beast/http/impl/fields.ipp>
+#include <boost/beast/http/impl/rfc7230.ipp>
+#include <boost/beast/http/impl/status.ipp>
+#include <boost/beast/http/impl/verb.ipp>
+#include <boost/beast/websocket/detail/hybi13.ipp>
+#include <boost/beast/websocket/detail/mask.ipp>
+#include <boost/beast/websocket/detail/pmd_extension.ipp>
+#include <boost/beast/websocket/detail/prng.ipp>
+#include <boost/beast/websocket/detail/service.ipp>
+#include <boost/beast/websocket/detail/utf8_checker.ipp>
+#include <boost/beast/websocket/impl/error.ipp>
+#include <boost/beast/zlib/detail/deflate_stream.ipp>
+#include <boost/beast/zlib/detail/inflate_stream.ipp>
+#include <boost/beast/zlib/impl/error.ipp>