]> de.git.xonotic.org Git - xonotic/netradiant.git/blob - libs/globaldefs.h
cmake: do not look for graphical libs when not building radiant
[xonotic/netradiant.git] / libs / globaldefs.h
1 #ifndef INCLUDED_LIBS_GLOBALDEFS
2 #define INCLUDED_LIBS_GLOBALDEFS
3
4 // ARCH_ENDIAN
5
6 #if defined(__BIG_ENDIAN__) || defined(_SGI_SOURCE)
7 #define GDEF_ARCH_ENDIAN_BIG 1
8 #else
9 #define GDEF_ARCH_ENDIAN_BIG 0
10 #endif
11
12 // ARCH_BITS
13
14 #if defined(__i386__) || defined(_M_IX86)
15 #define GDEF_ARCH_BITS_32 1
16 #else
17 #define GDEF_ARCH_BITS_32 0
18 #endif
19
20 #if defined(__LP64__) || defined(_M_X64) || defined(_M_AMD64) || defined(_WIN64)
21 #define GDEF_ARCH_BITS_64 1
22 #else
23 #define GDEF_ARCH_BITS_64 0
24 #endif
25
26 // OS
27
28 #if defined(POSIX)
29 #define GDEF_OS_POSIX 1
30 #else
31 #define GDEF_OS_POSIX 0
32 #endif
33
34 #if defined(WIN32) || defined(_WIN32) || defined(_WIN64)
35 #define GDEF_OS_WINDOWS 1
36 #else
37 #define GDEF_OS_WINDOWS 0
38 #endif
39
40 #if defined(__APPLE__)
41 #define GDEF_OS_MACOS 1
42 #else
43 #define GDEF_OS_MACOS 0
44 #endif
45
46 #if defined(__linux__)
47 #define GDEF_OS_LINUX 1
48 #else
49 #define GDEF_OS_LINUX 0
50 #endif
51
52
53 #define GDEF_OS_BSD 0
54
55 #if defined(__FreeBSD__)
56 #undef GDEF_OS_BSD
57 #define GDEF_OS_BSD 1
58 #define GDEF_OS_BSD_FREE 1
59 #else
60 #define GDEF_OS_BSD_FREE 0
61 #endif
62
63 #if defined(__NetBSD__)
64 #undef GDEF_OS_BSD
65 #define GDEF_OS_BSD 1
66 #define GDEF_OS_BSD_NET 1
67 #else
68 #define GDEF_OS_BSD_NET 0
69 #endif
70
71 #if defined(__OpenBSD__)
72 #undef GDEF_OS_BSD
73 #define GDEF_OS_BSD 1
74 #define GDEF_OS_BSD_OPEN 1
75 #else
76 #define GDEF_OS_BSD_OPEN 0
77 #endif
78
79 #if defined(__DragonFly__)
80 #undef GDEF_OS_BSD
81 #define GDEF_OS_BSD 1
82 #define GDEF_OS_BSD_DRAGONFLY 1
83 #else
84 #define GDEF_OS_BSD_DRAGONFLY 0
85 #endif
86
87 // COMPILER
88
89 #if defined(_MSC_VER)
90 #define GDEF_COMPILER_MSVC 1
91 #else
92 #define GDEF_COMPILER_MSVC 0
93 #endif
94
95 #if defined(__GNUC__)
96 #define GDEF_COMPILER_GNU 1
97 #else
98 #define GDEF_COMPILER_GNU 0
99 #endif
100
101 // ATTRIBUTE
102
103 #if GDEF_COMPILER_GNU
104 #define GDEF_ATTRIBUTE_NORETURN __attribute__((noreturn))
105 #else
106 #define GDEF_ATTRIBUTE_NORETURN
107 #endif
108
109 #ifdef GDEF_COMPILER_MSVC
110 #define GDEF_ATTRIBUTE_INLINE __inline
111 #else
112 #define GDEF_ATTRIBUTE_INLINE inline
113 #endif
114
115 // MISC
116
117 #define GDEF_DEBUG 0
118 #if defined(_DEBUG)
119 #if _DEBUG
120 #undef GDEF_DEBUG
121 #define GDEF_DEBUG 1
122 #endif
123 #endif
124
125 #endif