4
0

Config.hpp 3.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104
  1. /* Copyright 2016, Ableton AG, Berlin. All rights reserved.
  2. *
  3. * This program is free software: you can redistribute it and/or modify
  4. * it under the terms of the GNU General Public License as published by
  5. * the Free Software Foundation, either version 2 of the License, or
  6. * (at your option) any later version.
  7. *
  8. * This program is distributed in the hope that it will be useful,
  9. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  10. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  11. * GNU General Public License for more details.
  12. *
  13. * You should have received a copy of the GNU General Public License
  14. * along with this program. If not, see <http://www.gnu.org/licenses/>.
  15. *
  16. * If you would like to incorporate Link into a proprietary software application,
  17. * please contact <link-devs@ableton.com>.
  18. */
  19. #pragma once
  20. #include <ableton/link/Controller.hpp>
  21. #include <ableton/link/SessionController.hpp>
  22. #include <ableton/util/Log.hpp>
  23. #if defined(LINK_PLATFORM_WINDOWS)
  24. #include <ableton/platforms/asio/Context.hpp>
  25. #include <ableton/platforms/stl/Random.hpp>
  26. #include <ableton/platforms/windows/Clock.hpp>
  27. #include <ableton/platforms/windows/ScanIpIfAddrs.hpp>
  28. #include <ableton/platforms/windows/ThreadFactory.hpp>
  29. #elif defined(LINK_PLATFORM_MACOSX)
  30. #include <ableton/platforms/asio/Context.hpp>
  31. #include <ableton/platforms/darwin/Clock.hpp>
  32. #include <ableton/platforms/darwin/ThreadFactory.hpp>
  33. #include <ableton/platforms/posix/ScanIpIfAddrs.hpp>
  34. #include <ableton/platforms/stl/Random.hpp>
  35. #elif defined(LINK_PLATFORM_LINUX)
  36. #include <ableton/platforms/asio/Context.hpp>
  37. #include <ableton/platforms/linux/Clock.hpp>
  38. #include <ableton/platforms/posix/ScanIpIfAddrs.hpp>
  39. #include <ableton/platforms/stl/Random.hpp>
  40. #ifdef __linux__
  41. #include <ableton/platforms/linux/ThreadFactory.hpp>
  42. #endif
  43. #elif defined(ESP_PLATFORM)
  44. #include <ableton/platforms/esp32/Clock.hpp>
  45. #include <ableton/platforms/esp32/Context.hpp>
  46. #include <ableton/platforms/esp32/Log.hpp>
  47. #include <ableton/platforms/esp32/Random.hpp>
  48. #include <ableton/platforms/esp32/ScanIpIfAddrs.hpp>
  49. #endif
  50. namespace ableton
  51. {
  52. namespace link
  53. {
  54. namespace platform
  55. {
  56. #if defined(LINK_PLATFORM_WINDOWS)
  57. using Clock = platforms::windows::Clock;
  58. using Random = platforms::stl::Random;
  59. using ThreadPriority = platforms::windows::ThreadPriority;
  60. #if defined(LINK_WINDOWS_SETTHREADDESCRIPTION)
  61. using IoContext = platforms::asio::Context<platforms::windows::ScanIpIfAddrs,
  62. util::NullLog,
  63. platforms::windows::ThreadFactory>;
  64. #else
  65. using IoContext =
  66. platforms::asio::Context<platforms::windows::ScanIpIfAddrs, util::NullLog>;
  67. #endif
  68. #elif defined(LINK_PLATFORM_MACOSX)
  69. using Clock = platforms::darwin::Clock;
  70. using IoContext = platforms::asio::Context<platforms::posix::ScanIpIfAddrs,
  71. util::NullLog,
  72. platforms::darwin::ThreadFactory>;
  73. using Random = platforms::stl::Random;
  74. using ThreadPriority = platforms::darwin::ThreadPriority;
  75. #elif defined(LINK_PLATFORM_LINUX)
  76. using Clock = platforms::linux_::ClockMonotonicRaw;
  77. using Random = platforms::stl::Random;
  78. using ThreadPriority = platforms::linux_::ThreadPriority;
  79. #ifdef __linux__
  80. using IoContext = platforms::asio::Context<platforms::posix::ScanIpIfAddrs,
  81. util::NullLog,
  82. platforms::linux_::ThreadFactory>;
  83. #else
  84. using IoContext =
  85. platforms::asio::Context<platforms::posix::ScanIpIfAddrs, util::NullLog>;
  86. #endif
  87. #elif defined(ESP_PLATFORM)
  88. using Clock = platforms::esp32::Clock;
  89. using IoContext =
  90. platforms::esp32::Context<platforms::esp32::ScanIpIfAddrs, util::NullLog>;
  91. using Random = platforms::esp32::Random;
  92. #endif
  93. } // namespace platform
  94. } // namespace link
  95. } // namespace ableton