vk_sdk_platform.h 1.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869
  1. //
  2. // File: vk_sdk_platform.h
  3. //
  4. /*
  5. * Copyright (c) 2015-2016 The Khronos Group Inc.
  6. * Copyright (c) 2015-2016 Valve Corporation
  7. * Copyright (c) 2015-2016 LunarG, Inc.
  8. *
  9. * Licensed under the Apache License, Version 2.0 (the "License");
  10. * you may not use this file except in compliance with the License.
  11. * You may obtain a copy of the License at
  12. *
  13. * http://www.apache.org/licenses/LICENSE-2.0
  14. *
  15. * Unless required by applicable law or agreed to in writing, software
  16. * distributed under the License is distributed on an "AS IS" BASIS,
  17. * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  18. * See the License for the specific language governing permissions and
  19. * limitations under the License.
  20. */
  21. #ifndef VK_SDK_PLATFORM_H
  22. #define VK_SDK_PLATFORM_H
  23. #if defined(_WIN32)
  24. #define NOMINMAX
  25. #ifndef __cplusplus
  26. #undef inline
  27. #define inline __inline
  28. #endif // __cplusplus
  29. #if (defined(_MSC_VER) && _MSC_VER < 1900 /*vs2015*/)
  30. // C99:
  31. // Microsoft didn't implement C99 in Visual Studio; but started adding it with
  32. // VS2013. However, VS2013 still didn't have snprintf(). The following is a
  33. // work-around (Note: The _CRT_SECURE_NO_WARNINGS macro must be set in the
  34. // "CMakeLists.txt" file).
  35. // NOTE: This is fixed in Visual Studio 2015.
  36. #define snprintf _snprintf
  37. #endif
  38. #define strdup _strdup
  39. #endif // _WIN32
  40. // Check for noexcept support using clang, with fallback to Windows or GCC version numbers
  41. #ifndef NOEXCEPT
  42. #if defined(__clang__)
  43. #if __has_feature(cxx_noexcept)
  44. #define HAS_NOEXCEPT
  45. #endif
  46. #else
  47. #if defined(__GXX_EXPERIMENTAL_CXX0X__) && __GNUC__ * 10 + __GNUC_MINOR__ >= 46
  48. #define HAS_NOEXCEPT
  49. #else
  50. #if defined(_MSC_FULL_VER) && _MSC_FULL_VER >= 190023026 && defined(_HAS_EXCEPTIONS) && _HAS_EXCEPTIONS
  51. #define HAS_NOEXCEPT
  52. #endif
  53. #endif
  54. #endif
  55. #ifdef HAS_NOEXCEPT
  56. #define NOEXCEPT noexcept
  57. #else
  58. #define NOEXCEPT
  59. #endif
  60. #endif
  61. #endif // VK_SDK_PLATFORM_H