#pragma once // Platform information macro #ifndef PLATFORM_NAME # error "PLATFORM_NAME must be defined." #endif #ifndef PLATFORM_WINDOWS # define PLATFORM_WINDOWS 0 #endif #ifndef PLATFORM_LINUX # define PLATFORM_LINUX 0 #endif #ifndef PLATFORM_UNKNOWN # define PLATFORM_UNKNOWN 0 #endif // Build information macro #ifndef BUILD_TYPE # error "BUILD_TYPE must be defined." #endif #ifndef BUILD_DEBUG # define BUILD_DEBUG 0 #endif #ifndef BUILD_DEVELOPMENT # define BUILD_DEVELOPMENT 0 #endif #ifndef BUILD_RELEASE # define BUILD_RELEASE 0 #endif #ifndef BUILD_UNKNOWN # define BUILD_UNKNOWN 0 #endif // Compiler information macro #ifndef PLATFORM_COMPILER_NAME # error "COMPILER_NAME must be defined." #endif #ifndef PLATFORM_COMPILER_MSVC # define PLATFORM_COMPILER_MSVC 0 #endif #ifndef PLATFORM_COMPILER_CLANG # define PLATFORM_COMPILER_CLANG 0 #endif #ifndef PLATFORM_COMPILER_GCC # define PLATFORM_COMPILER_GCC 0 #endif #ifndef PLATFORM_COMPILER_UNKNOWN # define PLATFORM_COMPILER_UNKNOWN 0 #endif // Architecture information macro #ifndef PLATFORM_CPU_X86_FAMILY # if (defined(_M_IX86) || defined(__i386__) || defined(_M_X64) || defined(__amd64__) || defined(__x86_64__)) # define PLATFORM_CPU_X86_FAMILY 1 # else # define PLATFORM_CPU_X86_FAMILY 0 # endif #endif #ifndef PLATFORM_CPU_ARM_FAMILY # if (defined(__arm__) || defined(_M_ARM) || defined(__aarch64__) || defined(_M_ARM64)) # define PLATFORM_CPU_ARM_FAMILY 1 # else # define PLATFORM_CPU_ARM_FAMILY 0 # endif #endif #ifndef PLATFORM_CPU_UNKNOWN_FAMILY # define PLATFORM_CPU_UNKNOWN_FAMILY (!(PLATFORM_CPU_X86_FAMILY || PLATFORM_CPU_ARM_FAMILY)) #endif // CPU bits information macro #ifndef PLATFORM_CPU_BITS # if (defined(_M_X64) || defined(__amd64__) || defined(__x86_64__) || defined(__aarch64__) || defined(_M_ARM64)) # define PLATFORM_CPU_BITS 64 # elif (defined(_M_IX86) || defined(__i386__) || defined(__arm__) || defined(_M_ARM)) # define PLATFORM_CPU_BITS 32 # else # define PLATFORM_CPU_BITS 0 # endif #endif // Endian information macro #if !defined(PLATFORM_LITTLE_ENDIAN) && !defined(PLATFORM_BIG_ENDIAN) # if PLATFORM_COMPILER_MSVC # define PLATFORM_LITTLE_ENDIAN 1 # define PLATFORM_BIG_ENDIAN 0 # elif defined(__BYTE_ORDER__) && defined(__ORDER_LITTLE_ENDIAN__) && defined(__ORDER_BIG_ENDIAN__) # if __BYTE_ORDER__ == __ORDER_LITTLE_ENDIAN__ # define PLATFORM_LITTLE_ENDIAN 1 # define PLATFORM_BIG_ENDIAN 0 # elif __BYTE_ORDER__ == __ORDER_BIG_ENDIAN__ # define PLATFORM_LITTLE_ENDIAN 0 # define PLATFORM_BIG_ENDIAN 1 # else # define PLATFORM_LITTLE_ENDIAN 0 # define PLATFORM_BIG_ENDIAN 0 # endif # endif #endif #ifndef PLATFORM_LITTLE_ENDIAN # define PLATFORM_LITTLE_ENDIAN 0 #endif #ifndef PLATFORM_BIG_ENDIAN # define PLATFORM_BIG_ENDIAN 0 #endif #ifndef PLATFORM_MIXED_ENDIAN # define PLATFORM_MIXED_ENDIAN (!(PLATFORM_LITTLE_ENDIAN || PLATFORM_BIG_ENDIAN)) #endif