summaryrefslogtreecommitdiffstats
path: root/omni/platform.h
blob: b7627918f0d43129b29ffe75255aeb27216e575e (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
#ifndef OMNI_PLATFORM_H
#define OMNI_PLATFORM_H

/*
 *
 * COMPILER INFORMATION
 *
 */

#if defined(_MSC_VER)
#  define OMNI_CC_MSVC
#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

/*
 *
 * TARGET ARCHITECTURE INFORMATION
 *
 */

#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(__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(OMNI_ARCH_X86) && !defined(OMNI_ARCH_ARM)
#  error "target architecture is not supported"
#endif

/*
 *
 * TARGET OS INFORMATION
 *
 */

#if defined(_WIN32) || defined(_WIN64)
#  define OMNI_OS_WIN
#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(__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

/*
 *
 *
 * CHECK COMPILER STANDARD
 *
 */

#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

#endif