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.

67 lines
1.6 KiB

1 year ago
  1. /** @file Def.h
  2. * @brief Common SDK definitions.
  3. * @copyright VisionLabs LLC
  4. * @date 25.06.2014
  5. */
  6. #pragma once
  7. #if defined(__clang__) || defined(__GNUC__)
  8. #define FSDK_DEPRECATED(msg) __attribute__((__deprecated__(msg)))
  9. #elif defined(_MSC_VER)
  10. #define FSDK_DEPRECATED(msg) __declspec(deprecated(msg))
  11. #else
  12. #define FSDK_DEPRECATED(msg)
  13. #endif
  14. #if defined(WIN32) || defined(_WIN32)
  15. #if defined (SDK_DLL_EXPORTS)
  16. #define FSDK_API __declspec(dllexport) //!< DLL export specifier.
  17. #else
  18. #define FSDK_API __declspec(dllimport) //!< DLL import specifier.
  19. #endif
  20. #else
  21. #if __GNUC__ >= 4
  22. #define FSDK_API __attribute__ ((visibility ("default")))
  23. #else
  24. #define FSDK_API //!< Dummy.
  25. #endif
  26. #endif
  27. #if __APPLE__
  28. #include <TargetConditionals.h>
  29. #if TARGET_CPU_ARM || TARGET_CPU_ARM64
  30. #define IOS
  31. #endif
  32. #endif // __APPLE__
  33. /** @addtogroup CoreGroup
  34. * @{
  35. */
  36. // Aling value up to align so that value % align == 0.
  37. #define ALIGN_UP(value, align) \
  38. (((value) & (align-1)) ? \
  39. (((value) + (align-1)) & ~(align-1)) : \
  40. (value))
  41. #if defined(_MSC_VER)
  42. #define ALIGNED(x) __declspec(align(x))
  43. #define RESTRICT __restrict
  44. #define FORCE_INLINE __forceinline
  45. #else
  46. #define ALIGNED(x) __attribute__ ((aligned(x)))
  47. #define RESTRICT __restrict__
  48. #define FORCE_INLINE inline __attribute__ ((always_inline))
  49. #endif
  50. //! Smart ptr declaration helper macro
  51. #define DECLARE_SMARTPTR(X) struct X; using X##Ptr = fsdk::Ref<X>
  52. //! Stringification helper macro.
  53. #define STRINGIFY2(x) #x
  54. //! Stringifies it's argument.
  55. #define STRINGIFY(x) STRINGIFY2(x)
  56. /** @} */ // end of CoreGroup