Urho3DConfig.h 1.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657
  1. // Copyright (c) 2008-2023 the Urho3D project
  2. // License: MIT
  3. #pragma once
  4. #ifdef URHO3D_IS_BUILDING
  5. #include "Urho3D.h"
  6. #else
  7. #include <Urho3D/Urho3D.h>
  8. #endif
  9. // Macros with identifiers of c++ version.
  10. #define URHO_CPP17_STANDARD (201703L)
  11. #define URHO_CPP20_STANDARD (202002L)
  12. // Macro that can be used to identify c++ version.
  13. #ifndef URHO_CPLUSPLUS
  14. #if defined(_MSVC_LANG) && !defined(__clang__)
  15. #define URHO_CPLUSPLUS _MSVC_LANG
  16. #else
  17. #define URHO_CPLUSPLUS __cplusplus
  18. #endif
  19. #endif
  20. // Macros with a strong guarantee of what c++ version is available.
  21. #define URHO_CPP17_OR_LATER (URHO_CPLUSPLUS >= URHO_CPP17_STANDARD)
  22. #define URHO_CPP20_OR_LATER (URHO_CPLUSPLUS >= URHO_CPP20_STANDARD)
  23. // Macros for specific c++ versions
  24. #if URHO_CPP20_OR_LATER
  25. // Least match
  26. #define URHO_CPP17(x) x
  27. #define URHO_CPP20(x) x
  28. // Exact match
  29. #define URHO_CPP17_ONLY(x)
  30. #define URHO_CPP20_ONLY(x) x
  31. #elif URHO_CPP17_OR_LATER
  32. // Least match
  33. #define URHO_CPP17(x) x
  34. #define URHO_CPP20(x)
  35. // Exact match
  36. #define URHO_CPP17_ONLY(x) x
  37. #define URHO_CPP20_ONLY(x)
  38. #else
  39. #error Compiler does not support required c++ standard. How did you get here?
  40. #endif
  41. // Case insensitive string comparison.
  42. #ifdef _WIN32
  43. #define URHO_STRICMP(a,b) stricmp(a,b)
  44. #define URHO_STRNICMP(a,b,n) strnicmp(a,b,n)
  45. #else
  46. #define URHO_STRICMP(a,b) strcasecmp(a,b)
  47. #define URHO_STRNICMP(a,b,n) strncasecmp(a,b,n)
  48. #endif