Collection of tools useful for audio production
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.

107 lines
2.7KB

  1. /*
  2. * Carla common defines
  3. * Copyright (C) 2011-2012 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_H
  18. #define CARLA_DEFINES_H
  19. #ifdef __WINE__
  20. # define Q_CORE_EXPORT
  21. # define Q_GUI_EXPORT
  22. # define QT_NO_STL
  23. #endif
  24. #include <QtCore/Qt>
  25. // TESTING - remove later (QtCreator doesn't fully support this)
  26. #ifdef QTCREATOR_TEST
  27. # undef Q_COMPILER_INITIALIZER_LISTS
  28. #endif
  29. // If the compiler can't do C++11 lambdas, it most likely doesn't know about nullptr either
  30. #ifndef Q_COMPILER_LAMBDA
  31. # define nullptr (0)
  32. #endif
  33. // Common includes and macros
  34. #ifdef Q_OS_WIN
  35. # include <windows.h>
  36. //# define uintptr_t size_t // FIXME
  37. #else
  38. # include <unistd.h>
  39. # ifndef __cdecl
  40. # define __cdecl
  41. # endif
  42. #endif
  43. // Define various string format types, needed for qDebug/Warning/Critical sections
  44. #if defined(Q_OS_WIN64) && ! defined(__WINE__)
  45. # define P_INT64 "%I64i"
  46. # define P_INTPTR "%I64i"
  47. # define P_UINTPTR "%I64x"
  48. # define P_SIZE "%I64u"
  49. #elif __WORDSIZE == 64
  50. # define P_INT64 "%li"
  51. # define P_INTPTR "%li"
  52. # define P_UINTPTR "%lx"
  53. # define P_SIZE "%lu"
  54. #else
  55. # define P_INT64 "%lli"
  56. # define P_INTPTR "%i"
  57. # define P_UINTPTR "%x"
  58. # define P_SIZE "%u"
  59. #endif
  60. // Define BINARY_NATIVE
  61. #if defined(Q_OS_HAIKU) || defined(Q_OS_UNIX)
  62. # ifdef __LP64__
  63. # define BINARY_NATIVE BINARY_POSIX64
  64. # else
  65. # define BINARY_NATIVE BINARY_POSIX32
  66. # endif
  67. #elif defined(Q_OS_WIN)
  68. # ifdef Q_OS_WIN64
  69. # define BINARY_NATIVE BINARY_WIN64
  70. # else
  71. # define BINARY_NATIVE BINARY_WIN32
  72. # endif
  73. #else
  74. # warning Unknown binary type
  75. # define BINARY_NATIVE BINARY_OTHER
  76. #endif
  77. // Define CARLA_ASSERT*
  78. #ifdef NDEBUG
  79. # define CARLA_ASSERT(cond) ((!(cond)) ? carla_assert(#cond, __FILE__, __LINE__) : qt_noop())
  80. # define CARLA_ASSERT_INT(cond, value) ((!(cond)) ? carla_assert_int(#cond, __FILE__, __LINE__, value) : qt_noop())
  81. #else
  82. # define CARLA_ASSERT Q_ASSERT
  83. # define CARLA_ASSERT_INT(cond, value) Q_ASSERT(cond)
  84. #endif
  85. // Define CARLA_EXPORT
  86. #ifdef BUILD_BRIDGE
  87. # define CARLA_EXPORT extern "C"
  88. #else
  89. # if defined(Q_OS_WIN) && ! defined(__WINE__)
  90. # define CARLA_EXPORT extern "C" __declspec (dllexport)
  91. # else
  92. # define CARLA_EXPORT extern "C" __attribute__ ((visibility("default")))
  93. # endif
  94. #endif
  95. #endif // CARLA_DEFINES_H