1 /* Copyright (C) 2010-2020 The RetroArch team 2 * 3 * --------------------------------------------------------------------------------------- 4 * The following license statement only applies to this file (retro_environment.h). 5 * --------------------------------------------------------------------------------------- 6 * 7 * Permission is hereby granted, free of charge, 8 * to any person obtaining a copy of this software and associated documentation files (the "Software"), 9 * to deal in the Software without restriction, including without limitation the rights to 10 * use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, 11 * and to permit persons to whom the Software is furnished to do so, subject to the following conditions: 12 * 13 * The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. 14 * 15 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, 16 * INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. 18 * IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, 19 * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. 21 */ 22 23 #ifndef __LIBRETRO_SDK_ENVIRONMENT_H 24 #define __LIBRETRO_SDK_ENVIRONMENT_H 25 26 /* 27 This file is designed to create a normalized environment for compiling 28 libretro-common's private implementations, or any other sources which might 29 enjoy use of it's environment (RetroArch for instance). 30 This should be an elaborately crafted environment so that sources don't 31 need to be full of platform-specific workarounds. 32 */ 33 34 #if defined (__cplusplus) 35 #if 0 36 printf("This is C++, version %d.\n", __cplusplus); 37 #endif 38 /* The expected values would be 39 * 199711L, for ISO/IEC 14882:1998 or 14882:2003 40 */ 41 42 #elif defined(__STDC__) 43 /* This is standard C. */ 44 45 #if (__STDC__ == 1) 46 /* The implementation is ISO-conforming. */ 47 #define __STDC_ISO__ 48 #else 49 /* The implementation is not ISO-conforming. */ 50 #endif 51 52 #if defined(__STDC_VERSION__) 53 #if (__STDC_VERSION__ >= 201112L) 54 /* This is C11. */ 55 #define __STDC_C11__ 56 #elif (__STDC_VERSION__ >= 199901L) 57 /* This is C99. */ 58 #define __STDC_C99__ 59 #elif (__STDC_VERSION__ >= 199409L) 60 /* This is C89 with amendment 1. */ 61 #define __STDC_C89__ 62 #define __STDC_C89_AMENDMENT_1__ 63 #else 64 /* This is C89 without amendment 1. */ 65 #define __STDC_C89__ 66 #endif 67 #else /* !defined(__STDC_VERSION__) */ 68 /* This is C89. __STDC_VERSION__ is not defined. */ 69 #define __STDC_C89__ 70 #endif 71 72 #else /* !defined(__STDC__) */ 73 /* This is not standard C. __STDC__ is not defined. */ 74 #endif 75 76 #if defined(WIN32) || defined(_WIN32) || defined(__CYGWIN__) || defined(__MINGW32__) 77 /* Try to find out if we're compiling for WinRT or non-WinRT */ 78 #if defined(_MSC_VER) && defined(__has_include) 79 #if __has_include(<winapifamily.h>) 80 #define HAVE_WINAPIFAMILY_H 1 81 #else 82 #define HAVE_WINAPIFAMILY_H 0 83 #endif 84 85 /* If _USING_V110_SDK71_ is defined it means we are using the Windows XP toolset. */ 86 #elif defined(_MSC_VER) && (_MSC_VER >= 1700 && !_USING_V110_SDK71_) /* _MSC_VER == 1700 for Visual Studio 2012 */ 87 #define HAVE_WINAPIFAMILY_H 1 88 #else 89 #define HAVE_WINAPIFAMILY_H 0 90 #endif 91 92 #if HAVE_WINAPIFAMILY_H 93 #include <winapifamily.h> 94 #define WINAPI_FAMILY_WINRT (!WINAPI_FAMILY_PARTITION(WINAPI_PARTITION_DESKTOP) && WINAPI_FAMILY_PARTITION(WINAPI_PARTITION_APP)) 95 #else 96 #define WINAPI_FAMILY_WINRT 0 97 #endif /* HAVE_WINAPIFAMILY_H */ 98 99 #if WINAPI_FAMILY_WINRT 100 #undef __WINRT__ 101 #define __WINRT__ 1 102 #endif 103 104 /* MSVC obviously has to have some non-standard constants... */ 105 #if _M_IX86_FP == 1 106 #define __SSE__ 1 107 #elif _M_IX86_FP == 2 || (defined(_M_AMD64) || defined(_M_X64)) 108 #define __SSE__ 1 109 #define __SSE2__ 1 110 #endif 111 112 #endif 113 114 #endif 115