platform.h - Engine C API Reference

platform.h
  1. #pragma once
  2. // Platform names
  3. #define PLATFORM_NAME_WIN32 "win32"
  4. #define PLATFORM_NAME_XB1 "xb1"
  5. #define PLATFORM_NAME_ANDROID "android"
  6. #define PLATFORM_NAME_MACOSX "macosx"
  7. #define PLATFORM_NAME_IOS "ios"
  8. #define PLATFORM_NAME_PS4 "ps4"
  9. #define PLATFORM_NAME_WEB "web"
  10. #define PLATFORM_NAME_LINUX "linux"
  11. #define PLATFORM_NAME_UWP "uwp"
  12. #if defined(XBOXONE)
  13. #include <intrin.h>
  14. #include <stdint.h>
  15. __forceinline uint64_t rdtsc(void) { return __rdtsc(); }
  16. #endif
  17. #if defined(IOS)
  18. #include <errno.h>
  19. #endif
  20. #if defined(WINDOWSPC) || defined(UWP) || defined(XBOXONE)
  21. #define __ALIGN(x) __declspec(align(x))
  22. #define __THREAD __declspec(thread)
  23. #elif defined(IOS) || defined(ANDROID) || defined(WEB) || defined(LINUXPC) || defined(MACOSX)
  24. #define __forceinline __attribute__((__always_inline__)) inline
  25. #define __ALIGN(x) __attribute__((aligned(x)))
  26. #define __THREAD
  27. #elif defined(PS4)
  28. #define __forceinline __inline__ __attribute__((always_inline))
  29. #define __ALIGN(x) __attribute__((aligned(x)))
  30. #define __THREAD __thread
  31. #endif
  32. #if defined(ANDROID)
  33. #define PLUGIN_DLLEXPORT
  34. #elif defined(IOS)
  35. #define PLUGIN_DLLEXPORT __attribute__((visibility("default")))
  36. #else
  37. #define PLUGIN_DLLEXPORT __declspec(dllexport)
  38. #endif