config.hpp 2.0 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677
  1. //
  2. // Copyright (c) 2023 Klemens Morgenstern ([email protected])
  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 defined(_MSC_VER)
  25. // msvc doesn't correctly suspend for self-deletion, hence we must workaround here
  26. #define BOOST_COBALT_NO_SELF_DELETE 1
  27. #endif
  28. #if !defined(BOOST_COBALT_USE_STD_PMR) && \
  29. !defined(BOOST_COBALT_USE_BOOST_CONTAINER_PMR) && \
  30. !defined(BOOST_COBALT_USE_CUSTOM_PMR) && \
  31. !defined(BOOST_COBALT_NO_PMR)
  32. #define BOOST_COBALT_USE_STD_PMR 1
  33. #endif
  34. #if defined(BOOST_COBALT_USE_BOOST_CONTAINER_PMR)
  35. #include <boost/container/pmr/memory_resource.hpp>
  36. #include <boost/container/pmr/unsynchronized_pool_resource.hpp>
  37. #include <boost/container/pmr/polymorphic_allocator.hpp>
  38. #include <boost/container/pmr/monotonic_buffer_resource.hpp>
  39. #include <boost/container/pmr/global_resource.hpp>
  40. #include <boost/container/pmr/vector.hpp>
  41. #endif
  42. #if defined(BOOST_COBALT_USE_STD_PMR)
  43. #include <memory_resource>
  44. #endif
  45. #if !defined(BOOST_COBALT_OP_SBO_SIZE)
  46. #define BOOST_COBALT_SBO_BUFFER_SIZE 4096
  47. #endif
  48. namespace boost::cobalt
  49. {
  50. #if defined(BOOST_COBALT_USE_IO_CONTEXT)
  51. using executor = boost::asio::io_context::executor_type;
  52. #elif !defined(BOOST_COBALT_CUSTOM_EXECUTOR)
  53. using executor = boost::asio::any_io_executor;
  54. #endif
  55. #if defined(BOOST_COBALT_USE_BOOST_CONTAINER_PMR)
  56. namespace pmr = boost::container::pmr;
  57. #endif
  58. #if defined(BOOST_COBALT_USE_STD_PMR)
  59. namespace pmr = std::pmr;
  60. #endif
  61. }
  62. #endif //BOOST_COBALT_CONFIG_HPP