VerifyPlatformEnvironment.h 3.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132
  1. #pragma once
  2. // This header verifies that all required platform defines have been provided by the
  3. // BaselibPlatformEnvironment and defines all non-defined optional macros to 0. Please make
  4. // sure to verify the proper definition of newly added platform defines here.
  5. #ifndef EXPORTED_SYMBOL
  6. #error "BaselibPlatformSpecificEnvironment is expected to define EXPORTED_SYMBOL."
  7. #endif
  8. #ifndef IMPORTED_SYMBOL
  9. #error "BaselibPlatformSpecificEnvironment is expected to define IMPORTED_SYMBOL."
  10. #endif
  11. #ifndef PLATFORM_FUTEX_NATIVE_SUPPORT
  12. #error "BaselibPlatformSpecificEnvironment is expected to define PLATFORM_FUTEX_NATIVE_SUPPORT to 0 or 1."
  13. #endif
  14. // define all other platforms to 0
  15. #ifndef BASELIB_PLATFORM_WINDOWS
  16. #define BASELIB_PLATFORM_WINDOWS 0
  17. #endif
  18. #ifndef BASELIB_PLATFORM_MACOS
  19. #define BASELIB_PLATFORM_MACOS 0
  20. #endif
  21. #ifndef BASELIB_PLATFORM_LINUX
  22. #define BASELIB_PLATFORM_LINUX 0
  23. #endif
  24. #ifndef BASELIB_PLATFORM_EMBEDDED_LINUX
  25. #define BASELIB_PLATFORM_EMBEDDED_LINUX 0
  26. #endif
  27. #ifndef BASELIB_PLATFORM_WINRT
  28. #define BASELIB_PLATFORM_WINRT 0
  29. #endif
  30. #ifndef BASELIB_PLATFORM_WINDOWSGAMES
  31. #define BASELIB_PLATFORM_WINDOWSGAMES 0
  32. #endif
  33. #ifndef BASELIB_PLATFORM_EMSCRIPTEN
  34. #define BASELIB_PLATFORM_EMSCRIPTEN 0
  35. #endif
  36. #ifndef BASELIB_PLATFORM_WASI
  37. #define BASELIB_PLATFORM_WASI 0
  38. #endif
  39. #ifndef BASELIB_PLATFORM_ANDROID
  40. #define BASELIB_PLATFORM_ANDROID 0
  41. #endif
  42. #ifndef BASELIB_PLATFORM_PS4
  43. #define BASELIB_PLATFORM_PS4 0
  44. #endif
  45. #ifndef BASELIB_PLATFORM_PS5
  46. #define BASELIB_PLATFORM_PS5 0
  47. #endif
  48. #ifndef BASELIB_PLATFORM_IOS
  49. #define BASELIB_PLATFORM_IOS 0
  50. #endif
  51. #ifndef BASELIB_PLATFORM_TVOS
  52. #define BASELIB_PLATFORM_TVOS 0
  53. #endif
  54. #ifndef BASELIB_PLATFORM_VISIONOS
  55. #define BASELIB_PLATFORM_VISIONOS 0
  56. #endif
  57. #ifndef BASELIB_PLATFORM_XBOXONE
  58. #define BASELIB_PLATFORM_XBOXONE 0
  59. #endif
  60. #ifndef BASELIB_PLATFORM_SWITCH
  61. #define BASELIB_PLATFORM_SWITCH 0
  62. #endif
  63. #ifndef BASELIB_PLATFORM_STADIA
  64. #define BASELIB_PLATFORM_STADIA 0
  65. #endif
  66. #ifndef BASELIB_PLATFORM_NETBSD
  67. #define BASELIB_PLATFORM_NETBSD 0
  68. #endif
  69. #ifndef BASELIB_PLATFORM_QNX
  70. #define BASELIB_PLATFORM_QNX 0
  71. #endif
  72. // Define all other compilers with 0
  73. #ifndef COMPILER_MSVC
  74. #define COMPILER_MSVC 0
  75. #endif
  76. #ifndef COMPILER_GCC
  77. #define COMPILER_GCC 0
  78. #endif
  79. #ifndef COMPILER_CLANG
  80. #define COMPILER_CLANG 0
  81. #endif
  82. // Make sure no platform is defined twice.
  83. // Note that having no known platform defined is accepted.
  84. #if BASELIB_PLATFORM_WINDOWS + \
  85. BASELIB_PLATFORM_MACOS + \
  86. BASELIB_PLATFORM_LINUX + \
  87. BASELIB_PLATFORM_EMBEDDED_LINUX + \
  88. BASELIB_PLATFORM_WINRT + \
  89. BASELIB_PLATFORM_WINDOWSGAMES + \
  90. BASELIB_PLATFORM_EMSCRIPTEN + \
  91. BASELIB_PLATFORM_WASI + \
  92. BASELIB_PLATFORM_ANDROID + \
  93. BASELIB_PLATFORM_PS4 + \
  94. BASELIB_PLATFORM_PS5 + \
  95. BASELIB_PLATFORM_IOS + \
  96. BASELIB_PLATFORM_TVOS + \
  97. BASELIB_PLATFORM_VISIONOS + \
  98. BASELIB_PLATFORM_XBOXONE + \
  99. BASELIB_PLATFORM_SWITCH + \
  100. BASELIB_PLATFORM_STADIA + \
  101. BASELIB_PLATFORM_NETBSD \
  102. > 1
  103. #error "Only a single BASELIB_PLATFORM_X is allowed to be set to 1"
  104. #endif