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 22 #ifndef VK_SDK_PLATFORM_H 23 #define VK_SDK_PLATFORM_H 24 25 #if defined(_WIN32) 26 #define NOMINMAX 27 #ifndef __cplusplus 28 #undef inline 29 #define inline __inline 30 #endif // __cplusplus 31 32 #if (defined(_MSC_VER) && _MSC_VER < 1900 /*vs2015*/) 33 // C99: 34 // Microsoft didn't implement C99 in Visual Studio; but started adding it with 35 // VS2013. However, VS2013 still didn't have snprintf(). The following is a 36 // work-around (Note: The _CRT_SECURE_NO_WARNINGS macro must be set in the 37 // "CMakeLists.txt" file). 38 // NOTE: This is fixed in Visual Studio 2015. 39 #define snprintf _snprintf 40 #endif 41 42 #define strdup _strdup 43 44 #endif // _WIN32 45 46 // Check for noexcept support using clang, with fallback to Windows or GCC version numbers 47 #ifndef NOEXCEPT 48 #if defined(__clang__) 49 #if __has_feature(cxx_noexcept) 50 #define HAS_NOEXCEPT 51 #endif 52 #else 53 #if defined(__GXX_EXPERIMENTAL_CXX0X__) && __GNUC__ * 10 + __GNUC_MINOR__ >= 46 54 #define HAS_NOEXCEPT 55 #else 56 #if defined(_MSC_FULL_VER) && _MSC_FULL_VER >= 190023026 && defined(_HAS_EXCEPTIONS) && _HAS_EXCEPTIONS 57 #define HAS_NOEXCEPT 58 #endif 59 #endif 60 #endif 61 62 #ifdef HAS_NOEXCEPT 63 #define NOEXCEPT noexcept 64 #else 65 #define NOEXCEPT 66 #endif 67 #endif 68 69 #endif // VK_SDK_PLATFORM_H 70