Audio plugin host https://kx.studio/carla
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

126 lines
3.4KB

  1. /*
  2. * Carla common defines
  3. * Copyright (C) 2011-2013 Filipe Coelho <falktx@falktx.com>
  4. *
  5. * This program is free software; you can redistribute it and/or
  6. * modify it under the terms of the GNU General Public License as
  7. * published by the Free Software Foundation; either version 2 of
  8. * the License, or any later version.
  9. *
  10. * This program is distributed in the hope that it will be useful,
  11. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  12. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  13. * GNU General Public License for more details.
  14. *
  15. * For a full copy of the GNU General Public License see the GPL.txt file
  16. */
  17. #ifndef __CARLA_DEFINES_HPP__
  18. #define __CARLA_DEFINES_HPP__
  19. // Check OS
  20. #if defined(__APPLE__)
  21. # define CARLA_OS_MAC
  22. #elif defined(__HAIKU__)
  23. # define CARLA_OS_HAIKU
  24. #elif defined(__linux__) || defined(__linux) || defined(QTCREATOR_TEST)
  25. # define CARLA_OS_LINUX
  26. #elif defined(WIN64) || defined(_WIN64) || defined(__WIN64__)
  27. # define CARLA_OS_WIN64
  28. #elif defined(WIN32) || defined(_WIN32) || defined(__WIN32__)
  29. # define CARLA_OS_WIN32
  30. #else
  31. # warning Unsupported platform!
  32. #endif
  33. #if defined(CARLA_OS_WIN32) || defined(CARLA_OS_WIN64)
  34. # define CARLA_OS_WIN
  35. #elif ! defined(CARLA_OS_HAIKU)
  36. # define CARLA_OS_UNIX
  37. #endif
  38. // Check for C++11 support
  39. #if defined(HAVE_CPP11_SUPPORT) || defined(QTCREATOR_TEST)
  40. # define CARLA_CPP11_SUPPORT
  41. #elif defined(__GNUC__) && defined(__GXX_EXPERIMENTAL_CXX0X__)
  42. # if (__GNUC__ * 100 + __GNUC_MINOR__) >= 405
  43. # define CARLA_CPP11_SUPPORT
  44. # endif
  45. #endif
  46. // Common includes
  47. #ifdef CARLA_OS_WIN
  48. # include <winsock2.h>
  49. # include <windows.h>
  50. #else
  51. # include <unistd.h>
  52. # ifndef __cdecl
  53. # define __cdecl
  54. # endif
  55. #endif
  56. // Define various string format types
  57. #if defined(CARLA_OS_WIN64)
  58. # define P_INT64 "%I64i"
  59. # define P_INTPTR "%I64i"
  60. # define P_UINTPTR "%I64x"
  61. # define P_SIZE "%I64u"
  62. #elif defined(CARLA_OS_WIN32)
  63. # define P_INT64 "%I64i"
  64. # define P_INTPTR "%i"
  65. # define P_UINTPTR "%x"
  66. # define P_SIZE "%u"
  67. #elif __WORDSIZE == 64
  68. # define P_INT64 "%li"
  69. # define P_INTPTR "%li"
  70. # define P_UINTPTR "%lx"
  71. # define P_SIZE "%lu"
  72. #else
  73. # define P_INT64 "%lli"
  74. # define P_INTPTR "%i"
  75. # define P_UINTPTR "%x"
  76. # define P_SIZE "%u"
  77. #endif
  78. // Define BINARY_NATIVE
  79. #if defined(CARLA_OS_HAIKU) || defined(CARLA_OS_UNIX)
  80. # ifdef __LP64__
  81. # define BINARY_NATIVE BINARY_POSIX64
  82. # else
  83. # define BINARY_NATIVE BINARY_POSIX32
  84. # endif
  85. #elif defined(CARLA_OS_WIN)
  86. # ifdef CARLA_OS_WIN64
  87. # define BINARY_NATIVE BINARY_WIN64
  88. # else
  89. # define BINARY_NATIVE BINARY_WIN32
  90. # endif
  91. #else
  92. # warning Unknown binary native
  93. # define BINARY_NATIVE BINARY_OTHER
  94. #endif
  95. // Define CARLA_ASSERT*
  96. #ifdef NDEBUG
  97. # define CARLA_ASSERT(cond) ((!(cond)) ? carla_assert(#cond, __FILE__, __LINE__) : pass())
  98. # define CARLA_ASSERT_INT(cond, value) ((!(cond)) ? carla_assert_int(#cond, __FILE__, __LINE__, value) : pass())
  99. # define CARLA_ASSERT_INT2(cond, v1, v2) ((!(cond)) ? carla_assert_int2(#cond, __FILE__, __LINE__, v1, v2) : pass())
  100. #else
  101. # define CARLA_ASSERT(cond) assert(cond)
  102. # define CARLA_ASSERT_INT(cond, value) assert(cond)
  103. # define CARLA_ASSERT_INT2(cond, v1, v2) assert(cond)
  104. #endif
  105. // Define CARLA_EXPORT
  106. #ifdef BUILD_BRIDGE
  107. # define CARLA_EXPORT extern "C"
  108. #else
  109. # if defined(CARLA_OS_WIN) && ! defined(__WINE__)
  110. # define CARLA_EXPORT extern "C" __declspec (dllexport)
  111. # else
  112. # define CARLA_EXPORT extern "C" __attribute__ ((visibility("default")))
  113. # endif
  114. #endif
  115. #endif // __CARLA_DEFINES_HPP__