config.hpp 2.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081
  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. #include <boost/config.hpp>
  8. #ifndef BOOST_COBALT_CONFIG_HPP
  9. #define BOOST_COBALT_CONFIG_HPP
  10. #if defined(BOOST_ALL_DYN_LINK) || defined(BOOST_COBALT_DYN_LINK)
  11. #if defined(BOOST_COBALT_SOURCE)
  12. #define BOOST_COBALT_DECL BOOST_SYMBOL_EXPORT
  13. #else
  14. #define BOOST_COBALT_DECL BOOST_SYMBOL_IMPORT
  15. #endif
  16. #else
  17. #define BOOST_COBALT_DECL
  18. #endif
  19. #if defined(BOOST_COBALT_USE_IO_CONTEXT)
  20. # include <boost/asio/io_context.hpp>
  21. #elif !defined(BOOST_COBALT_CUSTOM_EXECUTOR)
  22. # include <boost/asio/any_io_executor.hpp>
  23. #endif
  24. #if BOOST_VERSION < 108200
  25. #error "Boost.Async needs Boost v1.82 or later otherwise the Boost.ASIO is missing needed support"
  26. #endif
  27. #if defined(_MSC_VER)
  28. // msvc doesn't correctly suspend for self-deletion, hence we must workaround here
  29. #define BOOST_COBALT_NO_SELF_DELETE 1
  30. #endif
  31. #if !defined(BOOST_COBALT_USE_STD_PMR) && \
  32. !defined(BOOST_COBALT_USE_BOOST_CONTAINER_PMR) && \
  33. !defined(BOOST_COBALT_USE_CUSTOM_PMR) && \
  34. !defined(BOOST_COBALT_NO_PMR)
  35. #define BOOST_COBALT_USE_STD_PMR 1
  36. #endif
  37. #if defined(BOOST_COBALT_USE_BOOST_CONTAINER_PMR)
  38. #include <boost/container/pmr/memory_resource.hpp>
  39. #include <boost/container/pmr/unsynchronized_pool_resource.hpp>
  40. #include <boost/container/pmr/polymorphic_allocator.hpp>
  41. #include <boost/container/pmr/monotonic_buffer_resource.hpp>
  42. #include <boost/container/pmr/global_resource.hpp>
  43. #include <boost/container/pmr/vector.hpp>
  44. #endif
  45. #if defined(BOOST_COBALT_USE_STD_PMR)
  46. #include <memory_resource>
  47. #endif
  48. #if !defined(BOOST_COBALT_OP_SBO_SIZE)
  49. #define BOOST_COBALT_SBO_BUFFER_SIZE 4096
  50. #endif
  51. namespace boost::cobalt
  52. {
  53. #if defined(BOOST_COBALT_USE_IO_CONTEXT)
  54. using executor = boost::asio::io_context::executor_type;
  55. #elif !defined(BOOST_COBALT_CUSTOM_EXECUTOR)
  56. using executor = boost::asio::any_io_executor;
  57. #endif
  58. #if defined(BOOST_COBALT_USE_BOOST_CONTAINER_PMR)
  59. namespace pmr = boost::container::pmr;
  60. #endif
  61. #if defined(BOOST_COBALT_USE_STD_PMR)
  62. namespace pmr = std::pmr;
  63. #endif
  64. }
  65. #endif //BOOST_COBALT_CONFIG_HPP