/*** Copyright (©) 2020 Reece Wilson (a/k/a "Reece"). All rights reserved. File: AuroraEnvironment.h Date: 2020-6-9 Originator: Reece Purpose: ***/ #pragma once #if defined(__clang_major__) #define AURORA_COMPILER_CLANG #elif defined(_MSC_VER) #define AURORA_COMPILER_MSVC #elif __GNUC__ > 8 || __GNUC__ == 8 // minimum *might* be boosted to 10 soon #define AURORA_COMPILER_GCC #elif __GNUC__ #error GCC outdated #else #error Illegal Compiler #endif #if defined(_LINUX_KERNEL_AURORA_PREPROCESSOR) #define AURORA_PLATFORM_KERNEL_LINUX #elif defined(_NTOS_AURORA_PREPROCESSOR) #define AURORA_PLATFORM_NTOS #elif defined(_WINDOWS) || defined(_WIN32) || defined(_WIN64) #define AURORA_PLATFORM_WIN32 #elif defined(__ANDROID__) || defined(_ANDROID_AURORA_PREPROCESSOR) #define AURORA_PLATFORM_ANDROID #elif defined(__linux__) || defined(_LINUX_AURORA_PREPROCESSOR) #define AURORA_PLATFORM_LINUX #elif (defined(__APPLE__) && defined(__MACH__)) || defined(_APPLE_AURORA_PREPROCESSOR) #define AURORA_PLATFORM_APPLE #elif (defined(__APPLE__) && defined(TARGET_OS_IPHONE)) || defined(_APPLE_MOBILE_AURORA_PREPROCESSOR) #define AURORA_PLATFORM_IOS #elif defined(__FreeBSD__) #define AURORA_PLATFORM_BSD #elif defined(_SWITCH_AURORA_PREPROCESSOR) #define AURORA_PLATFORM_SWITCH #elif defined(_PS4_AURORA_PREPROCESSOR) || defined(__ORBIS__) #define AURORA_PLATFORM_PS4 #elif defined(_PS5_AURORA_PREPROCESSOR) #define AURORA_PLATFORM_PS5 #elif defined(_XBONE_AURORA_PREPROCESSOR) || defined(_XBOX_ONE) #define AURORA_PLATFORM_XBONE #elif defined(_WII_AURORA_PREPROCESSOR) #define AURORA_PLATFORM_WII #elif defined(_WII_U_AURORA_PREPROCESSOR) #define AURORA_PLATFORM_WII_U #endif #if defined(_GAMING_XBOX) #define VENDOR_CONSOLE_MICROSOFT #elif defined(__APPLE__) #define VENDOR_GENERIC_APPLE #elif defined(AURORA_PLATFORM_PS4) || defined(AURORA_PLATFORM_PS5) #define VENDOR_CONSOLE_SONY #elif defined(AURORA_PLATFORM_SWITCH) || defined(AURORA_PLATFORM_WII)|| defined(AURORA_PLATFORM_WII_U) #define VENDOR_CONSOLE_NINTENDO #elif defined(AURORA_PLATFORM_NTOS) || defined(AURORA_PLATFORM_WIN32) #define VENDOR_GENERIC_MICROSOFT #else #define VENDOR_UNKNOWN #endif #if defined(AURORA_PLATFORM_BSD) || defined(AURORA_PLATFORM_IOS) || defined(AURORA_PLATFORM_APPLE) || defined(VENDOR_CONSOLE_SONY) #define AURORA_IS_BSD_DERIVED #endif #if defined(AURORA_PLATFORM_LINUX) || defined(AURORA_PLATFORM_ANDROID) #define AURORA_IS_LINUX_DERIVED #endif #if defined(VENDOR_GENERIC_APPLE) #define AURORA_IS_XNU_DERIVED #endif #if defined(AURORA_IS_BSD_DERIVED) || defined(AURORA_IS_LINUX_DERIVED) || defined(VENDOR_GENERIC_APPLE) #define AURORA_IS_POSIX_DERIVED #endif #if defined(VENDOR_CONSOLE_MICROSOFT) || defined(AURORA_PLATFORM_WIN32) #define AURORA_IS_MODERNNT_DERIVED #endif #if defined(AURORA_COMPILER_MSVC) #if defined(_M_X64) #define AURORA_ABI_MSFT_64 #define AURORA_ARCH_X64 #define AURORA_IS_64BIT #elif defined(__aarch64__) #define AURORA_ARCH_ARM #define AURORA_ABI_MS_ARM #define AURORA_IS_64BIT #else #define AURORA_ARCH_X86 #define AURORA_ABI_CDECL #define AURORA_IS_32BIT #endif #define AURORA_SYMBOL_IMPORT __declspec(dllimport) #define AURORA_SYMBOL_EXPORT __declspec(dllexport) #elif defined(AURORA_COMPILER_GCC) || defined(AURORA_COMPILER_CLANG) #if defined(__x86_64__) #define AURORA_ARCH_X64 #if defined(AURORA_PLATFORM_WIN32) || defined(AURORA_PLATFORM_NTOS) #define AURORA_ABI_MSFT_64 #else #define AURORA_ABI_SYSV #endif #define AURORA_IS_64BIT #elif defined(__aarch64__) #define AURORA_ARCH_ARM #if defined(__APPLE__) #define AURORA_ABI_APPLE_ARM #else #define AURORA_ABI_LLVM_ARM #endif #define AURORA_IS_64BIT #else #define AURORA_ARCH_X86 #define AURORA_ABI_CDECL #define AURORA_IS_32BIT #endif #if defined(AURORA_IS_MODERNNT_DERIVED) #define AURORA_SYMBOL_IMPORT #define AURORA_SYMBOL_EXPORT __declspec(dllexport) #else #define AURORA_SYMBOL_IMPORT #define AURORA_SYMBOL_EXPORT __attribute__((visibility("default"))) #endif #endif #if defined(__cplusplus) #if defined(_AURORA_DONT_QUESTION_ME_17) #define AU_LANG_CPP_17 #define AU_LANG_CPP #elif defined(_AURORA_DONT_QUESTION_ME_14) #define AU_LANG_CPP_14 #define AU_LANG_CPP #elif defined(_AURORA_DONT_QUESTION_ME_20) #define AU_LANG_CPP_20 #define AU_LANG_CPP #elif defined(_AURORA_DONT_QUESTION_ME_23) #define AU_LANG_CPP_23 #define AU_LANG_CPP #elif __cplusplus > 202002L #define AU_LANG_CPP_23 #define AU_LANG_CPP #elif __cplusplus > 201703L #define AU_LANG_CPP_20 #define AU_LANG_CPP #elif __cplusplus >= 201703L #define AU_LANG_CPP_17 #define AU_LANG_CPP #elif __cplusplus >= 201400L #define AU_LANG_CPP_14 #define AU_LANG_CPP #else #define AU_LANG_C #endif #endif #if (defined(_CPU_BIG_AURORA_PREPROCESSOR) || defined(_CPU_LITTLE_AURORA_PREPROCESSOR)) #if defined(_CPU_LITTLE_AURORA_PREPROCESSOR) #define AU_CPU_ENDIAN_LITTLE #elif defined(_CPU_BIG_AURORA_PREPROCESSOR) #define AU_CPU_ENDIAN_BIG #endif #else // Could we please ignore this? #if defined(__has_include) #if __has_include() #include #elif __has_include() #include #endif #endif #if (defined(__BYTE_ORDER) && __BYTE_ORDER == __BIG_ENDIAN) || \ (defined(__BYTE_ORDER) && __BYTE_ORDER == __ORDER_BIG_ENDIAN__) || \ defined(__BIG_ENDIAN__) || \ defined(__ARMEB__) || \ defined(__THUMBEB__) || \ defined(__AARCH64EB__) || \ defined(_M_PPC) || \ (defined(__sun) && defined(__SVR4) && defined(_BIG_ENDIAN)) || \ defined(_MIBSEB) || defined(__MIBSEB) || defined(__MIBSEB__) #define AU_CPU_ENDIAN_BIG #elif (defined(__BYTE_ORDER) && __BYTE_ORDER == __LITTLE_ENDIAN) || \ (defined(__BYTE_ORDER) && __BYTE_ORDER == __ORDER_LITTLE_ENDIAN__) || \ defined(__LITTLE_ENDIAN__) || \ defined(__ARMEL__) || \ defined(__THUMBEL__) || \ defined(__AARCH64EL__) || \ defined(_MIPSEL) || defined(__MIPSEL) || defined(__MIPSEL__) || \ defined(_M_IX86) || defined(_M_X64) #define AU_CPU_ENDIAN_LITTLE #else #if defined(AURORA_PLATFORM_WIN32) #define AU_CPU_ENDIAN_LITTLE #else #define AU_CPU_ENDIAN_LITTLE #endif #endif #endif