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.

carla_defines.hpp 2.8KB

12 years ago
11 years ago
12 years ago
11 years ago
12 years ago
11 years ago
12 years ago
11 years ago
12 years ago
123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102
  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 modify
  6. * it under the terms of the GNU General Public License as published by
  7. * the Free Software Foundation; either version 2 of the License, or
  8. * 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 COPYING file
  16. */
  17. #ifndef __CARLA_DEFINES_HPP__
  18. #define __CARLA_DEFINES_HPP__
  19. #include <QtCore/Qt>
  20. // If the compiler can't do C++11 lambdas, it most likely doesn't know about nullptr either
  21. #ifndef Q_COMPILER_LAMBDA
  22. # define nullptr (0)
  23. #endif
  24. // Common includes
  25. #ifdef Q_OS_WIN
  26. # include <winsock2.h>
  27. # include <windows.h>
  28. #else
  29. # include <unistd.h>
  30. # ifndef __cdecl
  31. # define __cdecl
  32. # endif
  33. #endif
  34. // Define various string format types, needed for qDebug/Warning/Critical sections
  35. #if defined(Q_OS_WIN64)
  36. # define P_INT64 "%I64i"
  37. # define P_INTPTR "%I64i"
  38. # define P_UINTPTR "%I64x"
  39. # define P_SIZE "%I64u"
  40. #elif defined(Q_OS_WIN32)
  41. # define P_INT64 "%I64i"
  42. # define P_INTPTR "%i"
  43. # define P_UINTPTR "%x"
  44. # define P_SIZE "%u"
  45. #elif __WORDSIZE == 64
  46. # define P_INT64 "%li"
  47. # define P_INTPTR "%li"
  48. # define P_UINTPTR "%lx"
  49. # define P_SIZE "%lu"
  50. #else
  51. # define P_INT64 "%lli"
  52. # define P_INTPTR "%i"
  53. # define P_UINTPTR "%x"
  54. # define P_SIZE "%u"
  55. #endif
  56. // Define BINARY_NATIVE
  57. #if defined(Q_OS_HAIKU) || defined(Q_OS_UNIX)
  58. # ifdef __LP64__
  59. # define BINARY_NATIVE BINARY_POSIX64
  60. # else
  61. # define BINARY_NATIVE BINARY_POSIX32
  62. # endif
  63. #elif defined(Q_OS_WIN)
  64. # ifdef Q_OS_WIN64
  65. # define BINARY_NATIVE BINARY_WIN64
  66. # else
  67. # define BINARY_NATIVE BINARY_WIN32
  68. # endif
  69. #else
  70. # warning Unknown binary native
  71. # define BINARY_NATIVE BINARY_OTHER
  72. #endif
  73. // Define CARLA_ASSERT*
  74. #ifdef NDEBUG
  75. # define CARLA_ASSERT(cond) ((!(cond)) ? carla_assert(#cond, __FILE__, __LINE__) : qt_noop())
  76. # define CARLA_ASSERT_INT(cond, value) ((!(cond)) ? carla_assert_int(#cond, __FILE__, __LINE__, value) : qt_noop())
  77. # define CARLA_ASSERT_INT2(cond, v1, v2) ((!(cond)) ? carla_assert_int2(#cond, __FILE__, __LINE__, v1, v2) : qt_noop())
  78. #else
  79. # define CARLA_ASSERT(cond) Q_ASSERT(cond)
  80. # define CARLA_ASSERT_INT(cond, value) Q_ASSERT(cond)
  81. # define CARLA_ASSERT_INT2(cond, v1, v2) Q_ASSERT(cond)
  82. #endif
  83. // Define CARLA_EXPORT
  84. #ifdef BUILD_BRIDGE
  85. # define CARLA_EXPORT extern "C"
  86. #else
  87. # if defined(Q_OS_WIN) && ! defined(__WINE__)
  88. # define CARLA_EXPORT extern "C" __declspec (dllexport)
  89. # else
  90. # define CARLA_EXPORT extern "C" __attribute__ ((visibility("default")))
  91. # endif
  92. #endif
  93. #endif // __CARLA_DEFINES_HPP__