2021-05-20 16:29:39 +00:00
|
|
|
/***
|
|
|
|
Copyright (©) 2020 Reece Wilson (a/k/a "Reece").
|
|
|
|
All rights reserved.
|
|
|
|
|
2021-05-21 16:34:33 +00:00
|
|
|
File: AuroraEnvironment.hpp
|
2021-05-20 16:29:39 +00:00
|
|
|
Date: 2020-6-9
|
|
|
|
Originator: Reece
|
|
|
|
Purpose:
|
|
|
|
***/
|
|
|
|
#pragma once
|
|
|
|
|
|
|
|
extern "C"
|
|
|
|
{
|
2021-05-21 16:34:33 +00:00
|
|
|
#include "AuroraEnvironment.h"
|
2021-05-20 16:29:39 +00:00
|
|
|
}
|
|
|
|
|
2022-01-25 00:53:18 +00:00
|
|
|
#if defined(_AUHAS_AURORAENUM) && defined(_ALLOW_AURORA_ENUM_AUENVHPP)
|
|
|
|
#include <AuroraForEach.hpp>
|
|
|
|
#include <AuroraEnum.hpp>
|
|
|
|
|
|
|
|
#define AUENVHPP_START_ENUM(platform, ...) \
|
|
|
|
AUE_DEFINE(platform, (__VA_ARGS__))
|
|
|
|
|
|
|
|
#else
|
|
|
|
#define AUENVHPP_START_ENUM(platform, ...) \
|
|
|
|
enum class platform \
|
|
|
|
{ \
|
|
|
|
eEnumInvalid = -1, \
|
|
|
|
__VA_ARGS__ \
|
|
|
|
};
|
|
|
|
#endif
|
|
|
|
|
2021-05-20 16:29:39 +00:00
|
|
|
namespace Aurora::Build
|
|
|
|
{
|
2022-01-25 00:53:18 +00:00
|
|
|
AUENVHPP_START_ENUM(ECompiler,
|
2021-09-14 13:30:08 +00:00
|
|
|
eMSVC,
|
|
|
|
eClang,
|
2022-01-25 00:53:18 +00:00
|
|
|
eGCC,
|
|
|
|
eIntelInside
|
|
|
|
);
|
2021-05-20 16:29:39 +00:00
|
|
|
|
|
|
|
#if defined(AURORA_COMPILER_CLANG)
|
2022-01-25 00:53:18 +00:00
|
|
|
static const ECompiler kCurrentCompiler = ECompiler::eClang;
|
2021-05-20 16:29:39 +00:00
|
|
|
#elif defined(AURORA_COMPILER_MSVC)
|
2022-01-25 00:53:18 +00:00
|
|
|
static const ECompiler kCurrentCompiler = ECompiler::eMSVC;
|
2021-05-20 16:29:39 +00:00
|
|
|
#elif defined(AURORA_COMPILER_GCC)
|
2022-01-25 00:53:18 +00:00
|
|
|
static const ECompiler kCurrentCompiler = ECompiler::eGCC;
|
|
|
|
#elif defined(AURORA_COMPILER_INTEL)
|
|
|
|
static const ECompiler kCurrentCompiler = ECompiler::eIntelInside;
|
2021-05-20 16:29:39 +00:00
|
|
|
#else
|
2022-01-25 00:53:18 +00:00
|
|
|
static const ECompiler kCurrentCompiler = ECompiler::eEnumInvalid;
|
2021-05-20 16:29:39 +00:00
|
|
|
#endif
|
|
|
|
|
2022-01-25 00:53:18 +00:00
|
|
|
enum class EPlatformLTS
|
2021-05-20 16:29:39 +00:00
|
|
|
{
|
2021-09-14 13:30:08 +00:00
|
|
|
eInvalid = -1,
|
2022-01-25 00:53:18 +00:00
|
|
|
|
2021-11-14 18:34:15 +00:00
|
|
|
eKernelLinux,
|
2022-01-25 00:53:18 +00:00
|
|
|
eKernelBsd,
|
2021-11-14 18:34:15 +00:00
|
|
|
eKernelNtos,
|
2022-01-25 00:53:18 +00:00
|
|
|
eKernelReserved1,
|
|
|
|
eKernelReserved2,
|
|
|
|
eKernelReserved3,
|
|
|
|
|
|
|
|
ePlatformWin32, // including padding for future OSes
|
|
|
|
ePlatformUWP,
|
|
|
|
ePlatformBSD,
|
2021-09-14 13:30:08 +00:00
|
|
|
ePlatformAndroid,
|
|
|
|
ePlatformLinux,
|
2022-01-25 00:53:18 +00:00
|
|
|
ePlatformAppleMacOS,
|
2021-09-14 13:30:08 +00:00
|
|
|
ePlatformIos,
|
2022-01-25 00:53:18 +00:00
|
|
|
ePlatformRTOS,
|
|
|
|
ePlatformNX,
|
2021-09-14 13:30:08 +00:00
|
|
|
ePlatformPS4,
|
|
|
|
ePlatformPS5,
|
2022-01-25 00:53:18 +00:00
|
|
|
ePlatformPS6,
|
|
|
|
ePlatformPS7,
|
2021-09-14 13:30:08 +00:00
|
|
|
ePlatformXbone,
|
2022-01-25 00:53:18 +00:00
|
|
|
ePlatformXbone2020,
|
|
|
|
ePlatformXboneReserved,
|
|
|
|
ePlatformXboneReserved2,
|
|
|
|
ePlatformXboneReserved3,
|
|
|
|
ePlatformNxPlusOne,
|
|
|
|
ePlatformNxPlusTwo,
|
|
|
|
ePlatformNxPlusThree,
|
|
|
|
ePlatformUWPAlt1,
|
|
|
|
ePlatformUWPAlt2,
|
|
|
|
ePlatformAppleAlt1,
|
|
|
|
ePlatformAppleAlt2,
|
2021-09-14 13:30:08 +00:00
|
|
|
ePlatformWii,
|
2022-01-25 00:53:18 +00:00
|
|
|
ePlatformWiiU,
|
|
|
|
|
|
|
|
ePlatformMCU = 60,
|
|
|
|
ePlatformMPU = 70,
|
|
|
|
|
|
|
|
ePlatformUserReserved1 = 100,
|
|
|
|
ePlatformUserReserved2,
|
|
|
|
ePlatformUserReserved3,
|
2021-05-20 16:29:39 +00:00
|
|
|
};
|
2022-01-25 00:53:18 +00:00
|
|
|
|
|
|
|
AUENVHPP_START_ENUM(EPlatform,
|
|
|
|
eKernelLinux,
|
|
|
|
eKernelBsd,
|
|
|
|
eKernelNtos,
|
|
|
|
eKernelReserved1,
|
|
|
|
eKernelReserved2,
|
|
|
|
eKernelReserved3,
|
|
|
|
ePlatformWin32,
|
|
|
|
ePlatformUWP,
|
|
|
|
ePlatformBSD,
|
|
|
|
ePlatformAndroid,
|
|
|
|
ePlatformLinux,
|
|
|
|
ePlatformAppleMacOS,
|
|
|
|
ePlatformIos,
|
|
|
|
ePlatformRTOS,
|
|
|
|
ePlatformNX,
|
|
|
|
ePlatformPS4,
|
|
|
|
ePlatformPS5,
|
|
|
|
ePlatformPS6,
|
|
|
|
ePlatformPS7,
|
|
|
|
ePlatformXbone,
|
|
|
|
ePlatformXbone2020,
|
|
|
|
ePlatformXboneReserved,
|
|
|
|
ePlatformXboneReserved2,
|
|
|
|
ePlatformXboneReserved3,
|
|
|
|
ePlatformNxPlusOne,
|
|
|
|
ePlatformNxPlusTwo,
|
|
|
|
ePlatformNxPlusThree
|
|
|
|
)
|
2021-05-20 16:29:39 +00:00
|
|
|
|
2021-11-14 18:34:15 +00:00
|
|
|
#if defined(AURORA_PLATFORM_KERNEL_LINUX)
|
|
|
|
static const EPlatform kCurrentPlatform = EPlatform::eKernelLinux;
|
2021-05-20 16:29:39 +00:00
|
|
|
#elif defined(AURORA_PLATFORM_NTOS)
|
2021-11-14 18:34:15 +00:00
|
|
|
static const EPlatform kCurrentPlatform = EPlatform::eKernelNtos;
|
2022-01-25 00:53:18 +00:00
|
|
|
#elif defined(AURORA_PLATFORM_KERNEL_FREEBSD) || defined(AURORA_PLATFORM_KERNEL_LAIN)
|
|
|
|
static const EPlatform kCurrentPlatform = EPlatform::eKernelBsd;
|
|
|
|
#elif defined(AURORA_PLATFORM_BSD)
|
|
|
|
static const EPlatform kCurrentPlatform = EPlatform::ePlatformBSD;
|
2021-05-20 16:29:39 +00:00
|
|
|
#elif defined(AURORA_PLATFORM_WIN32)
|
2021-09-14 13:30:08 +00:00
|
|
|
static const EPlatform kCurrentPlatform = EPlatform::ePlatformWin32;
|
2021-05-20 16:29:39 +00:00
|
|
|
#elif defined(AURORA_PLATFORM_ANDROID)
|
2021-09-14 13:30:08 +00:00
|
|
|
static const EPlatform kCurrentPlatform = EPlatform::ePlatformAndroid;
|
2021-05-20 16:29:39 +00:00
|
|
|
#elif defined(AURORA_PLATFORM_LINUX)
|
2021-09-14 13:30:08 +00:00
|
|
|
static const EPlatform kCurrentPlatform = EPlatform::ePlatformLinux;
|
2021-05-20 16:29:39 +00:00
|
|
|
#elif defined(AURORA_PLATFORM_APPLE)
|
2022-01-25 00:53:18 +00:00
|
|
|
static const EPlatform kCurrentPlatform = EPlatform::ePlatformAppleMacOS;
|
2021-05-20 16:29:39 +00:00
|
|
|
#elif defined(AURORA_PLATFORM_IOS)
|
2021-09-14 13:30:08 +00:00
|
|
|
static const EPlatform kCurrentPlatform = EPlatform::ePlatformIos;
|
2021-05-20 16:29:39 +00:00
|
|
|
#elif defined(AURORA_PLATFORM_SWITCH)
|
2021-09-14 13:30:08 +00:00
|
|
|
static const EPlatform kCurrentPlatform = EPlatform::ePlatformSwitch;
|
2021-05-20 16:29:39 +00:00
|
|
|
#elif defined(AURORA_PLATFORM_PS4)
|
2021-09-14 13:30:08 +00:00
|
|
|
static const EPlatform kCurrentPlatform = EPlatform::ePlatformPS4;
|
2021-05-20 16:29:39 +00:00
|
|
|
#elif defined(AURORA_PLATFORM_PS5)
|
2021-09-14 13:30:08 +00:00
|
|
|
static const EPlatform kCurrentPlatform = EPlatform::ePlatformPS5;
|
2021-05-20 16:29:39 +00:00
|
|
|
#elif defined(AURORA_PLATFORM_XBONE)
|
2021-09-14 13:30:08 +00:00
|
|
|
static const EPlatform kCurrentPlatform = EPlatform::ePlatformXbone;
|
2021-05-20 16:29:39 +00:00
|
|
|
#elif defined(AURORA_PLATFORM_WII)
|
2021-09-14 13:30:08 +00:00
|
|
|
static const EPlatform kCurrentPlatform = EPlatform::ePlatformWii;
|
2021-05-20 16:29:39 +00:00
|
|
|
#elif defined(AURORA_PLATFORM_WII_U)
|
2021-09-14 13:30:08 +00:00
|
|
|
static const EPlatform kCurrentPlatform = EPlatform::ePlatformWiiU;
|
2021-05-20 16:29:39 +00:00
|
|
|
#else
|
2022-01-25 00:53:18 +00:00
|
|
|
static const EPlatform kCurrentPlatform = EPlatform::eEnumInvalid;
|
2021-05-20 16:29:39 +00:00
|
|
|
#endif
|
|
|
|
|
2022-01-25 00:53:18 +00:00
|
|
|
AUENVHPP_START_ENUM(EVendor,
|
2021-09-14 13:30:08 +00:00
|
|
|
eConsoleMicrosft,
|
|
|
|
eConsoleSony,
|
|
|
|
eConsoleNintendo,
|
|
|
|
eGenericApple,
|
2022-01-25 00:53:18 +00:00
|
|
|
eGenericMicrosoft
|
|
|
|
)
|
2021-05-20 16:29:39 +00:00
|
|
|
|
|
|
|
#if defined(VENDOR_CONSOLE_MICROSOFT)
|
2021-09-14 13:30:08 +00:00
|
|
|
static const EVendor kCurrentVendor = EVendor::eConsoleMicrosft;
|
2021-05-20 16:29:39 +00:00
|
|
|
#elif defined(VENDOR_GENERIC_APPLE)
|
2021-09-14 13:30:08 +00:00
|
|
|
static const EVendor kCurrentVendor = EVendor::eGenericApple;
|
2021-05-20 16:29:39 +00:00
|
|
|
#elif defined(VENDOR_CONSOLE_SONY)
|
2021-09-14 13:30:08 +00:00
|
|
|
static const EVendor kCurrentVendor = EVendor::eConsoleSony;
|
2021-05-20 16:29:39 +00:00
|
|
|
#elif defined(VENDOR_CONSOLE_NINTENDO)
|
2021-09-14 13:30:08 +00:00
|
|
|
static const EVendor kCurrentVendor = EVendor::eConsoleNintendo;
|
2021-05-20 16:29:39 +00:00
|
|
|
#elif defined(VENDOR_GENERIC_MICROSOFT)
|
2021-09-14 13:30:08 +00:00
|
|
|
static const EVendor kCurrentVendor = EVendor::eGenericMicrosoft;
|
2022-01-18 22:41:40 +00:00
|
|
|
#elif defined(VENDOR_UNKNOWN)
|
|
|
|
static const EVendor kCurrentVendor = EVendor::eUnknown;
|
2021-05-20 16:29:39 +00:00
|
|
|
#else
|
2022-01-25 00:53:18 +00:00
|
|
|
static const EVendor kCurrentVendor = EVendor::eEnumInvalid;
|
2021-05-20 16:29:39 +00:00
|
|
|
#endif
|
|
|
|
|
2022-01-25 00:53:18 +00:00
|
|
|
AUENVHPP_START_ENUM(EArchitecture,
|
2021-09-14 13:30:08 +00:00
|
|
|
eX86_32,
|
|
|
|
eX86_64,
|
|
|
|
eAArch64
|
2022-01-25 00:53:18 +00:00
|
|
|
)
|
2021-09-14 13:30:08 +00:00
|
|
|
|
2021-05-20 16:29:39 +00:00
|
|
|
#if defined(AURORA_ARCH_X86)
|
2021-09-14 13:30:08 +00:00
|
|
|
static const EArchitecture kCurrentArchitecture = EArchitecture::eX86_32;
|
2021-05-20 16:29:39 +00:00
|
|
|
#elif defined(AURORA_ARCH_X64)
|
2021-09-14 13:30:08 +00:00
|
|
|
static const EArchitecture kCurrentArchitecture = EArchitecture::eX86_64;
|
2021-05-20 16:29:39 +00:00
|
|
|
#elif defined(AURORA_ARCH_ARM)
|
2021-09-14 13:30:08 +00:00
|
|
|
static const EArchitecture kCurrentArchitecture = EArchitecture::eAArch64;
|
2021-05-20 16:29:39 +00:00
|
|
|
#else
|
2022-01-25 00:53:18 +00:00
|
|
|
static const EArchitecture kCurrentArchitecture = EArchitecture::eEnumInvalid;
|
2021-05-20 16:29:39 +00:00
|
|
|
#endif
|
|
|
|
|
2021-09-14 13:30:08 +00:00
|
|
|
|
|
|
|
static bool constexpr IsPlatformX32()
|
|
|
|
{
|
|
|
|
return kCurrentArchitecture == EArchitecture::eX86_32;
|
|
|
|
}
|
|
|
|
|
2022-01-25 00:53:18 +00:00
|
|
|
AUENVHPP_START_ENUM(EABI,
|
2021-05-20 16:29:39 +00:00
|
|
|
// MSFTs in house amd64 abi
|
2021-09-14 13:30:08 +00:00
|
|
|
eMSFT64,
|
2021-05-20 16:29:39 +00:00
|
|
|
// MSFTs in house aarch64 abi
|
2021-09-14 13:30:08 +00:00
|
|
|
eMSFTArm,
|
2021-05-20 16:29:39 +00:00
|
|
|
// x86 sysv and microsoft only deviate with fastcall and thiscall :(
|
2021-09-14 13:30:08 +00:00
|
|
|
eCdeclIntel,
|
2021-05-20 16:29:39 +00:00
|
|
|
// x86_64 others
|
2021-09-14 13:30:08 +00:00
|
|
|
eSysV,
|
|
|
|
// M1
|
|
|
|
eAppleArm,
|
|
|
|
// Microsoft made a new aarch ABI that makes it easier for them to JIT x86
|
|
|
|
eMSFTAArchIntelBridge,
|
2021-05-20 16:29:39 +00:00
|
|
|
// other arm EPlatforms...
|
2021-09-14 13:30:08 +00:00
|
|
|
eLLVMArm
|
2022-01-25 00:53:18 +00:00
|
|
|
);
|
2021-05-20 16:29:39 +00:00
|
|
|
|
|
|
|
#if defined(AURORA_ABI_MSFT_64)
|
2021-09-14 13:30:08 +00:00
|
|
|
static const EABI kCurrentABI = EABI::eMSFT64;
|
2021-05-20 16:29:39 +00:00
|
|
|
#elif defined(AURORA_ABI_MS_ARM)
|
2021-09-14 13:30:08 +00:00
|
|
|
static const EABI kCurrentABI = EABI::eMSFTArm;
|
2021-05-20 16:29:39 +00:00
|
|
|
#elif defined(AURORA_ABI_LLVM_ARM)
|
2021-09-14 13:30:08 +00:00
|
|
|
static const EABI kCurrentABI = EABI::eLLVMArm;
|
2021-05-20 16:29:39 +00:00
|
|
|
#elif defined(AURORA_ABI_CDECL)
|
2021-09-14 13:30:08 +00:00
|
|
|
static const EABI kCurrentABI = EABI::eCdeclIntel;
|
2021-05-20 16:29:39 +00:00
|
|
|
#elif defined(AURORA_ABI_SYSV)
|
2021-09-14 13:30:08 +00:00
|
|
|
static const EABI kCurrentABI = EABI::eSysV;
|
2021-05-20 16:29:39 +00:00
|
|
|
#elif defined(AURORA_ABI_APPLE)
|
2021-09-14 13:30:08 +00:00
|
|
|
static const EABI kCurrentABI = EABI::eAppleArm;
|
|
|
|
#else
|
2022-01-25 00:53:18 +00:00
|
|
|
static const EABI kCurrentABI = EABI::eEnumInvalid;
|
2021-09-14 13:30:08 +00:00
|
|
|
#endif
|
|
|
|
|
2022-01-25 00:53:18 +00:00
|
|
|
AUENVHPP_START_ENUM(ECPUEndian,
|
2021-09-14 13:30:08 +00:00
|
|
|
eCPUBig,
|
|
|
|
eCPULittle
|
2022-01-25 00:53:18 +00:00
|
|
|
);
|
2021-09-14 13:30:08 +00:00
|
|
|
|
|
|
|
#if defined (AU_CPU_ENDIAN_LITTLE)
|
|
|
|
static const ECPUEndian kCurrentEndian = ECPUEndian::eCPULittle;
|
|
|
|
#else
|
|
|
|
static const ECPUEndian kCurrentEndian = ECPUEndian::eCPUBig;
|
|
|
|
#endif
|
|
|
|
|
|
|
|
enum class ELanguage
|
|
|
|
{
|
|
|
|
eCpp20,
|
|
|
|
eCpp17,
|
|
|
|
eCpp14,
|
2022-01-25 00:53:18 +00:00
|
|
|
eC,
|
|
|
|
eRust,
|
|
|
|
eGo,
|
|
|
|
eCs,
|
|
|
|
eJava,
|
|
|
|
eJavaScript,
|
|
|
|
eKotlin,
|
|
|
|
eHLSL,
|
|
|
|
gGLSL,
|
|
|
|
eCpp20Plus = 20
|
2021-09-14 13:30:08 +00:00
|
|
|
};
|
|
|
|
|
|
|
|
#if defined (AU_LANG_CPP_20)
|
|
|
|
static const ELanguage kCurrentLanguage = ELanguage::eCpp20;
|
|
|
|
#elif defined (AU_LANG_CPP_17)
|
|
|
|
static const ELanguage kCurrentLanguage = ELanguage::eCpp17;
|
|
|
|
#elif defined (AU_LANG_CPP_14)
|
|
|
|
static const ELanguage kCurrentLanguage = ELanguage::eCpp14;
|
|
|
|
#elif defined (AU_LANG_C)
|
|
|
|
static const ELanguage kCurrentLanguage = ELanguage::eC;
|
|
|
|
#else
|
|
|
|
static const ELanguage kCurrentLanguage = ELanguage::eC;
|
|
|
|
#endif
|
|
|
|
|
|
|
|
#if defined(AURORA_IS_BSD_DERIVED)
|
2021-11-15 14:55:55 +00:00
|
|
|
static const bool kIsBSDDerived = true;
|
2021-09-14 13:30:08 +00:00
|
|
|
#else
|
2021-11-15 14:55:55 +00:00
|
|
|
static const bool kIsBSDDerived = false;
|
2021-09-14 13:30:08 +00:00
|
|
|
#endif
|
|
|
|
|
|
|
|
#if defined(AURORA_IS_POSIX_DERIVED)
|
2021-11-15 14:55:55 +00:00
|
|
|
static const bool kIsPosixDerived = true;
|
2021-09-14 13:30:08 +00:00
|
|
|
#else
|
2021-11-15 14:55:55 +00:00
|
|
|
static const bool kIsPosixDerived = false;
|
2021-09-14 13:30:08 +00:00
|
|
|
#endif
|
|
|
|
|
|
|
|
#if defined(AURORA_IS_BSD_DERIVED)
|
2021-11-15 14:55:55 +00:00
|
|
|
static const bool kIsBsdDerived = true;
|
2021-09-14 13:30:08 +00:00
|
|
|
#else
|
2021-11-15 14:55:55 +00:00
|
|
|
static const bool kIsBsdDerived = false;
|
2021-09-14 13:30:08 +00:00
|
|
|
#endif
|
|
|
|
|
|
|
|
#if defined(AURORA_IS_XNU_DERIVED)
|
2021-11-15 14:55:55 +00:00
|
|
|
static const bool kIsXnuDerived = true;
|
2021-09-14 13:30:08 +00:00
|
|
|
#else
|
2021-11-15 14:55:55 +00:00
|
|
|
static const bool kIsXnuDerived = false;
|
2021-09-14 13:30:08 +00:00
|
|
|
#endif
|
|
|
|
|
|
|
|
#if defined(AURORA_IS_LINUX_DERIVED)
|
2021-11-15 14:55:55 +00:00
|
|
|
static const bool kIsLinuxDerived = true;
|
2021-05-20 16:29:39 +00:00
|
|
|
#else
|
2021-11-15 14:55:55 +00:00
|
|
|
static const bool kIsLinuxDerived = false;
|
2021-05-20 16:29:39 +00:00
|
|
|
#endif
|
2021-09-14 13:30:08 +00:00
|
|
|
|
|
|
|
#if defined(AURORA_IS_MODERNNT_DERIVED)
|
2021-11-15 14:55:55 +00:00
|
|
|
static const bool kIsNtDerived = true;
|
2021-09-14 13:30:08 +00:00
|
|
|
#else
|
2021-11-15 14:55:55 +00:00
|
|
|
static const bool kIsNtDerived = false;
|
2021-09-14 13:30:08 +00:00
|
|
|
#endif
|
|
|
|
|
2021-05-20 16:29:39 +00:00
|
|
|
}
|