config.hpp 2.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104
  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. #if defined(BOOST_COBALT_IO_SOURCE)
  17. #define BOOST_COBALT_IO_DECL BOOST_SYMBOL_EXPORT
  18. #else
  19. #define BOOST_COBALT_IO_DECL BOOST_SYMBOL_IMPORT
  20. #endif
  21. #if defined(BOOST_COBALT_SSL_SOURCE)
  22. #define BOOST_COBALT_SSL_DECL BOOST_SYMBOL_EXPORT
  23. #else
  24. #define BOOST_COBALT_SSL_DECL BOOST_SYMBOL_IMPORT
  25. #endif
  26. #else
  27. #define BOOST_COBALT_SSL_DECL
  28. #define BOOST_COBALT_DECL
  29. #define BOOST_COBALT_IO_DECL
  30. #endif
  31. #if _MSC_VER
  32. #define BOOST_COBALT_MSVC_NOINLINE BOOST_NOINLINE
  33. #else
  34. #define BOOST_COBALT_MSVC_NOINLINE
  35. #endif
  36. #if defined(BOOST_COBALT_USE_IO_CONTEXT)
  37. # include <boost/asio/io_context.hpp>
  38. #elif !defined(BOOST_COBALT_CUSTOM_EXECUTOR)
  39. # include <boost/asio/any_io_executor.hpp>
  40. #endif
  41. #if defined(_MSC_VER)
  42. // msvc doesn't correctly suspend for self-deletion, hence we must workaround here
  43. #define BOOST_COBALT_NO_SELF_DELETE 1
  44. #endif
  45. #if !defined(BOOST_COBALT_USE_STD_PMR) && \
  46. !defined(BOOST_COBALT_USE_BOOST_CONTAINER_PMR) && \
  47. !defined(BOOST_COBALT_USE_CUSTOM_PMR) && \
  48. !defined(BOOST_COBALT_NO_PMR)
  49. #define BOOST_COBALT_USE_STD_PMR 1
  50. #endif
  51. #if defined(BOOST_COBALT_USE_BOOST_CONTAINER_PMR)
  52. #include <boost/container/pmr/memory_resource.hpp>
  53. #include <boost/container/pmr/unsynchronized_pool_resource.hpp>
  54. #include <boost/container/pmr/polymorphic_allocator.hpp>
  55. #include <boost/container/pmr/monotonic_buffer_resource.hpp>
  56. #include <boost/container/pmr/global_resource.hpp>
  57. #include <boost/container/pmr/vector.hpp>
  58. #endif
  59. #if defined(BOOST_COBALT_USE_STD_PMR)
  60. #include <memory_resource>
  61. #endif
  62. #if !defined(BOOST_COBALT_OP_SBO_SIZE)
  63. #define BOOST_COBALT_SBO_BUFFER_SIZE 4096
  64. #endif
  65. namespace boost::cobalt
  66. {
  67. #if defined(BOOST_COBALT_USE_IO_CONTEXT)
  68. using executor = boost::asio::io_context::executor_type;
  69. #elif !defined(BOOST_COBALT_CUSTOM_EXECUTOR)
  70. using executor = boost::asio::any_io_executor;
  71. #endif
  72. #if defined(BOOST_COBALT_USE_BOOST_CONTAINER_PMR)
  73. namespace pmr = boost::container::pmr;
  74. #endif
  75. #if defined(BOOST_COBALT_USE_STD_PMR)
  76. namespace pmr = std::pmr;
  77. #endif
  78. }
  79. #if !defined(BOOST_COBALT_SOURCE) && !defined(BOOST_ALL_NO_LIB) && !defined(BOOST_COBALT_NO_LIB)
  80. #define BOOST_LIB_NAME boost_cobalt
  81. #if defined(BOOST_ALL_DYN_LINK) || defined(BOOST_COBALT_DYN_LINK)
  82. #define BOOST_DYN_LINK
  83. #endif
  84. #include <boost/config/auto_link.hpp>
  85. #endif
  86. #endif //BOOST_COBALT_CONFIG_HPP