Urho3DConfig.h 3.2 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495
  1. //
  2. // Copyright (c) 2008-2020 the Urho3D project.
  3. //
  4. // Permission is hereby granted, free of charge, to any person obtaining a copy
  5. // of this software and associated documentation files (the "Software"), to deal
  6. // in the Software without restriction, including without limitation the rights
  7. // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
  8. // copies of the Software, and to permit persons to whom the Software is
  9. // furnished to do so, subject to the following conditions:
  10. //
  11. // The above copyright notice and this permission notice shall be included in
  12. // all copies or substantial portions of the Software.
  13. //
  14. // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
  15. // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
  16. // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
  17. // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
  18. // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
  19. // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
  20. // THE SOFTWARE.
  21. //
  22. #pragma once
  23. #ifdef URHO3D_IS_BUILDING
  24. #include "Urho3D.h"
  25. #else
  26. #include <Urho3D/Urho3D.h>
  27. #endif
  28. // Macros with identifiers of c++ version.
  29. #define URHO_CPP11_STANDARD (201103L)
  30. #define URHO_CPP14_STANDARD (201402L)
  31. #define URHO_CPP17_STANDARD (201703L)
  32. #define URHO_CPP20_STANDARD (202000L) // speculative
  33. // Macro that can be used to identify c++ version.
  34. #ifndef URHO_CPLUSPLUS
  35. #if defined(_MSVC_LANG) && !defined(__clang__)
  36. // Note: VC14.0/1900 (VS2015) lacks too much from C++14
  37. #if (_MSC_VER == 1900)
  38. #define URHO_CPLUSPLUS URHO_CPP11_STANDARD
  39. #else
  40. #define URHO_CPLUSPLUS _MSVC_LANG
  41. #endif
  42. #else
  43. #define URHO_CPLUSPLUS __cplusplus
  44. #endif
  45. #endif
  46. // Macros with a strong guarantee of what c++ version is available.
  47. #define URHO_CPP11_OR_LATER (URHO_CPLUSPLUS >= URHO_CPP11_STANDARD)
  48. #define URHO_CPP14_OR_LATER (URHO_CPLUSPLUS >= URHO_CPP14_STANDARD)
  49. #define URHO_CPP17_OR_LATER (URHO_CPLUSPLUS >= URHO_CPP17_STANDARD)
  50. // Macros for specific c++ versions
  51. #if URHO_CPP11_OR_LATER
  52. // Least match
  53. #define URHO_CPP11(x) x
  54. #define URHO_CPP14(x)
  55. #define URHO_CPP17(x)
  56. // Exact match
  57. #define URHO_CPP11_ONLY(x) x
  58. #define URHO_CPP14_ONLY(x)
  59. #define URHO_CPP17_ONLY(x)
  60. #elif URHO_CPP14_OR_LATER
  61. // Least match
  62. #define URHO_CPP11(x) x
  63. #define URHO_CPP14(x) x
  64. #define URHO_CPP17(x)
  65. // Exact match
  66. #define URHO_CPP11_ONLY(x)
  67. #define URHO_CPP14_ONLY(x) x
  68. #define URHO_CPP17_ONLY(x)
  69. #elif URHO_CPP17_OR_LATER
  70. // Least match
  71. #define URHO_CPP11(x) x
  72. #define URHO_CPP14(x) x
  73. #define URHO_CPP17(x) x
  74. // Exact match
  75. #define URHO_CPP11_ONLY(x)
  76. #define URHO_CPP14_ONLY(x)
  77. #define URHO_CPP17_ONLY(x) x
  78. #else
  79. #error Compiler does not support required c++ standard. How did you get here?
  80. #endif
  81. // Case insensitive string comparison.
  82. #ifdef _WIN32
  83. #define URHO_STRICMP(a,b) stricmp(a,b)
  84. #define URHO_STRNICMP(a,b,n) strnicmp(a,b,n)
  85. #else
  86. #define URHO_STRICMP(a,b) strcasecmp(a,b)
  87. #define URHO_STRNICMP(a,b,n) strncasecmp(a,b,n)
  88. #endif