Include/AuroraEnvironment.h
2021-05-21 17:34:33 +01:00

107 lines
3.2 KiB
C

/***
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
#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(_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_COMPILER_MSVC)
#if defined(_M_X64)
#define AURORA_ABI_MSFT_64
#define AURORA_ARCH_X64
#elif defined(__aarch64__)
#define AURORA_ARCH_ARM
#define AURORA_ABI_MS_ARM
#else
#define AURORA_ARCH_X86
#define AURORA_ABI_CDECL
#endif
#define AURORA_SYMBOL_IMPORT __declspec(dllimport)
#define AURORA_SYMBOL_EXPORT __declspec(dllexport)
#elif defined(AURORA_COMPILER_COMMUNISM) || 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
#elif defined(__aarch64__)
#define AURORA_ARCH_ARM
#if defined(__APPLE__)
#define AURORA_ABI_APPLE_ARM
#else
#define AURORA_ABI_LLVM_ARM
#endif
#else
#define AURORA_ARCH_X86
#define AURORA_ABI_CDECL
#endif
#define AURORA_SYMBOL_IMPORT
#define AURORA_SYMBOL_EXPORT __attribute__((visibility("default")))
#endif