platform.h (1350B)
1 #pragma once 2 3 #if defined( _WIN32 ) 4 # define PLATFORM_WINDOWS 1 5 #elif defined( __linux__ ) 6 # define PLATFORM_LINUX 1 7 # define PLATFORM_UNIX 1 8 #elif defined( __APPLE__ ) 9 # define PLATFORM_OSX 1 10 # define PLATFORM_UNIX 1 11 #elif defined( __OpenBSD__ ) 12 # define PLATFORM_OPENBSD 1 13 # define PLATFORM_UNIX 1 14 #else 15 # error new platform 16 #endif 17 18 #if defined( _MSC_VER ) 19 # define COMPILER_MSVC 1 20 #elif defined( __clang__ ) 21 # define COMPILER_CLANG 1 22 # define COMPILER_GCCORCLANG 1 23 #elif defined( __GNUC__ ) 24 # define COMPILER_GCC 1 25 # define COMPILER_GCCORCLANG 1 26 #else 27 # error new compiler 28 #endif 29 30 #if COMPILER_MSVC 31 # if _WIN64 == 1 32 # define PLATFORM_64BIT 1 33 # else 34 # define PLATFORM_32BIT 1 35 # endif 36 #elif COMPILER_GCCORCLANG 37 # if __x86_64__ 38 # define PLATFORM_64BIT 1 39 # else 40 # define PLATFORM_32BIT 1 41 # endif 42 #endif 43 44 #if defined( __MINGW32__ ) 45 # define COMPILER_MINGW 1 46 #endif 47 48 #ifdef RL_TEST 49 # define PLATFORM_RELACY 1 50 #endif 51 52 #if PLATFORM_WINDOWS 53 # if PLATFORM_64BIT 54 # define PLATFORM_NAME "windows64" 55 # else 56 # define PLATFORM_NAME "windows32" 57 # endif 58 #elif PLATFORM_LINUX 59 # if PLATFORM_64BIT 60 # define PLATFORM_NAME "linux64" 61 # else 62 # define PLATFORM_NAME "linux32" 63 # endif 64 #elif PLATFORM_OSX 65 # if PLATFORM_64BIT 66 # define PLATFORM_NAME "macos64" 67 # else 68 # define PLATFORM_NAME "macos32" 69 # endif 70 #endif