| 1 | // |
| 2 | // Copyright (c) 2023 Klemens Morgenstern (klemens.morgenstern@gmx.net) |
| 3 | // |
| 4 | // Distributed under the Boost Software License, Version 1.0. (See accompanying |
| 5 | // file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt) |
| 6 | // |
| 7 | |
| 8 | #include <boost/config.hpp> |
| 9 | |
| 10 | #ifndef BOOST_COBALT_CONFIG_HPP |
| 11 | #define BOOST_COBALT_CONFIG_HPP |
| 12 | |
| 13 | #if defined(BOOST_ALL_DYN_LINK) || defined(BOOST_COBALT_DYN_LINK) |
| 14 | #if defined(BOOST_COBALT_SOURCE) |
| 15 | #define BOOST_COBALT_DECL BOOST_SYMBOL_EXPORT |
| 16 | #else |
| 17 | #define BOOST_COBALT_DECL BOOST_SYMBOL_IMPORT |
| 18 | #endif |
| 19 | #else |
| 20 | #define BOOST_COBALT_DECL |
| 21 | #endif |
| 22 | |
| 23 | #if defined(BOOST_COBALT_USE_IO_CONTEXT) |
| 24 | # include <boost/asio/io_context.hpp> |
| 25 | #elif !defined(BOOST_COBALT_CUSTOM_EXECUTOR) |
| 26 | # include <boost/asio/any_io_executor.hpp> |
| 27 | #endif |
| 28 | |
| 29 | #if defined(_MSC_VER) |
| 30 | // msvc doesn't correctly suspend for self-deletion, hence we must workaround here |
| 31 | #define BOOST_COBALT_NO_SELF_DELETE 1 |
| 32 | #endif |
| 33 | |
| 34 | #if !defined(BOOST_COBALT_USE_STD_PMR) && \ |
| 35 | !defined(BOOST_COBALT_USE_BOOST_CONTAINER_PMR) && \ |
| 36 | !defined(BOOST_COBALT_USE_CUSTOM_PMR) && \ |
| 37 | !defined(BOOST_COBALT_NO_PMR) |
| 38 | #define BOOST_COBALT_USE_STD_PMR 1 |
| 39 | #endif |
| 40 | |
| 41 | #if defined(BOOST_COBALT_USE_BOOST_CONTAINER_PMR) |
| 42 | #include <boost/container/pmr/memory_resource.hpp> |
| 43 | #include <boost/container/pmr/unsynchronized_pool_resource.hpp> |
| 44 | #include <boost/container/pmr/polymorphic_allocator.hpp> |
| 45 | #include <boost/container/pmr/monotonic_buffer_resource.hpp> |
| 46 | #include <boost/container/pmr/global_resource.hpp> |
| 47 | #include <boost/container/pmr/vector.hpp> |
| 48 | #endif |
| 49 | |
| 50 | #if defined(BOOST_COBALT_USE_STD_PMR) |
| 51 | #include <memory_resource> |
| 52 | #endif |
| 53 | |
| 54 | #if !defined(BOOST_COBALT_OP_SBO_SIZE) |
| 55 | #define BOOST_COBALT_SBO_BUFFER_SIZE 4096 |
| 56 | #endif |
| 57 | |
| 58 | namespace boost::cobalt |
| 59 | { |
| 60 | |
| 61 | #if defined(BOOST_COBALT_USE_IO_CONTEXT) |
| 62 | using executor = boost::asio::io_context::executor_type; |
| 63 | #elif !defined(BOOST_COBALT_CUSTOM_EXECUTOR) |
| 64 | using executor = boost::asio::any_io_executor; |
| 65 | #endif |
| 66 | |
| 67 | #if defined(BOOST_COBALT_USE_BOOST_CONTAINER_PMR) |
| 68 | namespace pmr = boost::container::pmr; |
| 69 | #endif |
| 70 | |
| 71 | #if defined(BOOST_COBALT_USE_STD_PMR) |
| 72 | namespace pmr = std::pmr; |
| 73 | #endif |
| 74 | |
| 75 | } |
| 76 | |
| 77 | #endif //BOOST_COBALT_CONFIG_HPP |
| 78 | |