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