From 70dfff41ce5d50264ca419724c038e8acc8df753 Mon Sep 17 00:00:00 2001 From: Fabrice Date: Thu, 16 Apr 2026 16:31:25 +0200 Subject: adding compiler check --- omni/platform.h | 148 ++++++++++++++++++++++++++++++++++---------------------- 1 file changed, 89 insertions(+), 59 deletions(-) (limited to 'omni/platform.h') diff --git a/omni/platform.h b/omni/platform.h index 593b79c..5410f6d 100644 --- a/omni/platform.h +++ b/omni/platform.h @@ -1,5 +1,5 @@ #ifndef OMNI_PLATFORM_H -#define OMNI_PLATFORM_H +# define OMNI_PLATFORM_H /* * @@ -7,21 +7,20 @@ * */ -#undef OMNI_CC_MSVC -#undef OMNI_CC_GNU +# undef OMNI_CC_MSVC +# undef OMNI_CC_GNU -#if defined(_MSC_VER) -#define OMNI_CC_MSVC -#endif +# if defined(_MSC_VER) +# define OMNI_CC_MSVC +# endif -#if defined(__GNUC__) || defined(__clang__) -#define OMNI_CC_GNU -#endif +# if defined(__GNUC__) || defined(__clang__) +# define OMNI_CC_GNU +# endif - -#if !defined(OMNI_CC_GNU) && !defined(OMNI_CC_MSVC) -#error "compiler not supported" -#endif +# if !defined(OMNI_CC_GNU) && !defined(OMNI_CC_MSVC) +# error "compiler not supported" +# endif /* * @@ -29,34 +28,34 @@ * */ -#undef OMNI_ARCH_X86 -#undef OMNI_ARCH_ARM -#undef OMNI_ARCH_64BIT -#undef OMNI_ARCH_32BIT +# undef OMNI_ARCH_X86 +# undef OMNI_ARCH_ARM +# undef OMNI_ARCH_64BIT +# undef OMNI_ARCH_32BIT -#if defined(__i386__) || defined(_M_IX86) -#define OMNI_ARCH_X86 -#define OMNI_ARCH_32BIT -#endif +# if defined(__i386__) || defined(_M_IX86) +# define OMNI_ARCH_X86 +# define OMNI_ARCH_32BIT +# endif -#if defined(__x86_64__) || defined(_M_X64) -#define OMNI_ARCH_X86 -#define OMNI_ARCH_64BIT -#endif +# if defined(__x86_64__) || defined(_M_X64) +# define OMNI_ARCH_X86 +# define OMNI_ARCH_64BIT +# endif -#if defined(__arm__) || defined(_M_ARM) -#define OMNI_ARCH_ARM -#define OMNI_ARCH_32BIT -#endif +# if defined(__arm__) || defined(_M_ARM) +# define OMNI_ARCH_ARM +# define OMNI_ARCH_32BIT +# endif -#if defined(__aarch64__) || defined(_M_ARM64) || defined(__arm64__) -#define OMNI_ARCH_ARM -#define OMNI_ARCH_64BIT -#endif +# if defined(__aarch64__) || defined(_M_ARM64) || defined(__arm64__) +# define OMNI_ARCH_ARM +# define OMNI_ARCH_64BIT +# endif -#if !defined(OMNI_ARCH_X86) && !defined(OMNI_ARCH_ARM) -#error "target architecture is not supported" -#endif +# if !defined(OMNI_ARCH_X86) && !defined(OMNI_ARCH_ARM) +# error "target architecture is not supported" +# endif /* * @@ -64,33 +63,64 @@ * */ -#undef OMNI_OS_WIN -#undef OMNI_OS_LINUX -#undef OMNI_OS_FREEBSD -#undef OMNI_OS_OSX +# undef OMNI_OS_WIN +# undef OMNI_OS_LINUX +# undef OMNI_OS_FREEBSD +# undef OMNI_OS_OSX -#if defined(_WIN32) || defined(_WIN64) -#define OMNI_OS_WIN -#endif +# if defined(_WIN32) || defined(_WIN64) +# define OMNI_OS_WIN +# endif -#if defined(__linux__) -#define OMNI_OS_LINUX -#define OMNI_OS_UNIX -#endif +# if defined(__linux__) +# define OMNI_OS_LINUX +# define OMNI_OS_UNIX +# endif -#if defined(__FreeBSD__) || defined(__FreeBSD_kernel__) -#define OMNI_OS_FREEBSD -#define OMNI_OS_UNIX -#endif +# if defined(__FreeBSD__) || defined(__FreeBSD_kernel__) +# define OMNI_OS_FREEBSD +# define OMNI_OS_UNIX +# endif -#if defined(__APPLE__) && defined(__MACH__) -#define OMNI_OS_OSX -#define OMNI_OS_UNIX -#endif +# if defined(__APPLE__) && defined(__MACH__) +# define OMNI_OS_OSX +# define OMNI_OS_UNIX +# endif -#if !defined(OMNI_OS_UNIX) && !defined(OMNI_OS_WIN) -#error "target os not supported" -#endif +# if !defined(OMNI_OS_UNIX) && !defined(OMNI_OS_WIN) +# error "target os not supported" +# endif -#endif +/* + * + * + * CHECK COMPILER STANDARD + * + */ +# undef OMNI_CXX_VER_MIN +# undef OMNI_CXX_VER +# undef OMNI_CC_VER + +# define OMNI_CC_VER __STDC_VERSION__ + +# if defined(OMNI_CC_MSVC) +# if defined(_MSVC_LANG) +# define OMNI_CXX_VER _MSVC_LANG +# else +# define OMNI_CXX_VER 0 +# endif +# endif + +# if defined(OMNI_CC_GNU) +# if defined(__cplusplus) +# define OMNI_CXX_VER __cplusplus +# else +# define OMNI_CXX_VER 0 +# endif +# endif + +# define OMNI_CXX_VER_MIN 201103L +# if OMNI_CXX_VER_MIN > OMNI_CXX_VER +# error "atleast C++11 is required" +# endif -- cgit v1.2.3