Banuba SDK
defs.hpp
1 #pragma once
2 
3 #include <bnb/utils/config.hpp>
4 
5 /**
6  * @addtogroup Utils
7  * @{
8  */
9 
10 #ifdef BNB_EXPORT
11  // fix warning about macro redefinition, BNB_EXPORT is also defined in wraps/c_api_common/include/interfaces/bnb/export.h
12  #undef BNB_EXPORT
13 #endif
14 
15 #ifdef _WIN32
16  #if BNB_SDK_SHARED_LIBRARY
17  #define BNB_EXPORT __declspec(dllexport)
18  #elif BNB_SDK_STATIC_LIBRARY
19  #define BNB_EXPORT
20  #else
21  #define BNB_EXPORT __declspec(dllimport)
22  #endif
23 #else
24  #define BNB_EXPORT __attribute__((__visibility__("default")))
25 #endif
26 
27 //-----------------------
28 
29 #define BNB_OS_ANDROID 0
30 
31 #if !defined(BNB_DETAIL_OS_DETECTED) && (defined(__ANDROID__))
32  #undef BNB_OS_ANDROID
33  #define BNB_OS_ANDROID 1
34 #endif
35 
36 #if BNB_OS_ANDROID
37  #define BNB_OS_ANDROID_AVAILABLE
38  #include <bnb/utils/os_detected.hpp>
39 #endif
40 
41 //-----------------------
42 
43 #define BNB_OS_IOS 0
44 
45 #if !defined(BNB_DETAIL_OS_DETECTED) && (defined(__APPLE__) && defined(__MACH__) && defined(__ENVIRONMENT_IPHONE_OS_VERSION_MIN_REQUIRED__))
46  #undef BNB_OS_IOS
47  #define BNB_OS_IOS 1
48 #endif
49 
50 #if BNB_OS_IOS
51  #define BNB_OS_IOS_AVAILABLE
52  #include <bnb/utils/os_detected.hpp>
53 #endif
54 
55 //-----------------------
56 
57 #define BNB_OS_LINUX 0
58 
59 #if !defined(BNB_DETAIL_OS_DETECTED) && (defined(linux) || defined(__linux))
60  #undef BNB_OS_LINUX
61  #define BNB_OS_LINUX 1
62 #endif
63 
64 #if BNB_OS_LINUX
65  #define BNB_OS_LINUX_AVAILABLE
66  #include <bnb/utils/os_detected.hpp>
67 #endif
68 
69 //-----------------------
70 
71 #define BNB_OS_MACOS 0
72 
73 #if !defined(BNB_DETAIL_OS_DETECTED) && (defined(macintosh) || defined(Macintosh) || (defined(__APPLE__) && defined(__MACH__)))
74  #undef BNB_OS_MACOS
75  #define BNB_OS_MACOS 1
76 #endif
77 
78 #if BNB_OS_MACOS
79  #define BNB_OS_MACOS_AVAILABLE
80  #include <bnb/utils/os_detected.hpp>
81 #endif
82 
83 //-----------------------
84 
85 #define BNB_OS_EMSCRIPTEN 0
86 
87 #if !defined(BNB_DETAIL_OS_DETECTED) && defined(__EMSCRIPTEN__)
88  #undef BNB_OS_EMSCRIPTEN
89  #define BNB_OS_EMSCRIPTEN 1
90 #endif
91 
92 #if BNB_OS_EMSCRIPTEN
93  #define BNB_OS_EMSCRIPTEN_AVAILABLE
94  #include <bnb/utils/os_detected.hpp>
95 #endif
96 
97 //-----------------------
98 
99 #define BNB_OS_UNIX 0
100 
101 #if defined(unix) || defined(__unix) || defined(_XOPEN_SOURCE) || defined(_POSIX_SOURCE)
102  #undef BNB_OS_UNIX
103  #define BNB_OS_UNIX 1
104 #endif
105 
106 #if BNB_OS_UNIX
107  #define BNB_OS_UNIX_AVAILABLE
108 #endif
109 
110 //-----------------------
111 
112 #define BNB_OS_WINDOWS 0
113 #define BNB_OS_WINDOWS_ARM64 0
114 
115 #if !defined(BNB_DETAIL_OS_DETECTED) && (defined(_WIN32) || defined(_WIN64) || defined(__WIN32__) || defined(__TOS_WIN__) || defined(__WINDOWS__))
116  #undef BNB_OS_WINDOWS
117  #define BNB_OS_WINDOWS 1
118  #undef BNB_OS_WINDOWS_ARM64
119  #define BNB_OS_WINDOWS_ARM64 _M_ARM64
120 #endif
121 
122 #if BNB_OS_WINDOWS
123  #define BNB_OS_WINDOWS_AVAILABLE
124  #include <bnb/utils/os_detected.hpp>
125 #endif
126 
127 
128 #define BNB_APPLE 0
129 
130 #if defined(macintosh) || defined(Macintosh) || defined(__APPLE__)
131  #undef BNB_APPLE
132  #define BNB_APPLE 1
133 #endif
134 
135 //-----------------------
136 
137 #if BNB_OS_ANDROID || BNB_OS_IOS || BNB_OS_EMSCRIPTEN
138  #define BNB_GLSL_VERSION "#version 300 es\n"
139 #elif BNB_OS_WINDOWS || BNB_OS_MACOS || BNB_OS_UNIX
140  #define BNB_GLSL_VERSION "#version 410 core\n"
141 #else
142  #error "Can't determine GLSL version for OS"
143 #endif
144 
145 #if !defined(__cpp_char8_t)
146 typedef char char8_t;
147 #endif
148 
149 #if BNB_OS_ANDROID || (BNB_OS_LINUX && BNB_PYBIND_BUILD) || BNB_OS_IOS
150  #define BNB_HAVE_EGL 1
151 #else
152  #define BNB_HAVE_EGL 0
153 #endif
154 
155 /** @} */ // endgroup utils