NVIDIA Iray: Math API Home  Up
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Groups Pages
config.h
Go to the documentation of this file.
1 //*****************************************************************************
2 // Copyright 1986, 2016 NVIDIA Corporation. All rights reserved.
3 //*****************************************************************************
9 //*****************************************************************************
10 
11 #ifndef MI_BASE_CONFIG_H
12 #define MI_BASE_CONFIG_H
13 
24 // The current copyright year string.
25 #define MI_COPYRIGHT_YEARS_STRING "1986, 2015"
26 
27 // The NVIDIA company name string for copyrights etc.
28 #define MI_COPYRIGHT_COMPANY_STRING "NVIDIA ARC GmbH"
29 
30 // The NVIDIA copyright string.
31 #define MI_COPYRIGHT_COPYRIGHT_STRING \
32 "Copyright " MI_COPYRIGHT_YEARS_STRING \
33 " " MI_COPYRIGHT_COMPANY_STRING ". All rights reserved."
34 
35 // The NVIDIA copyright string if only portions are covered.
36 #define MI_COPYRIGHT_PORTIONS_STRING \
37 "Portions " MI_COPYRIGHT_COPYRIGHT_STRING
38 
39 
40 // The preprocessor defines MI_DLL_EXPORT and MI_DLL_LOCAL provide access to
41 // the compiler-dependent declaration directives for managing symbol
42 // visibility. The default for any symbol is to be invisible unless specified
43 // otherwise. Visibility concerns shared libraries, mostly, which means that
44 // every symbol you'd like to be accessible when building a DLL must be
45 // declared as MI_DLL_EXPORT. The syntax is as follows:
46 //
47 // MI_DLL_EXPORT void visible_function();
48 //
49 // class MI_DLL_EXPORT visible_class
50 // {
51 // public:
52 // visible_class(); /* these functions have external linkage */
53 // ~visible_class();
54 // void do_stuff();
55 //
56 // private:
57 // MI_DLL_LOCAL do_invisible_stuff(); /* no external linkage */
58 // };
59 //
60 // On Windows, the preprocessor symbol MI_DLL_BUILD must be defined while
61 // compiling the shared object. Other platforms typically don't need that
62 // define, but it won't hurt either, so it should probably be defined anyway.
63 // The GCC compiler needs the command line switch "-fvisibility=hidden" for
64 // these declarations to take any effect.
65 //
66 // A general introduction to the topic can be found in Ulrich Drepper's paper
67 // "How To Write Shared Libraries" <http://people.redhat.com/~drepper/> and on
68 // the GCC web site <http://gcc.gnu.org/wiki/Visibility>.
69 
70 #ifdef _WIN32
71 # ifdef MI_DLL_BUILD
72 # define MI_DLL_EXPORT __declspec(dllexport)
73 # else
74 # define MI_DLL_EXPORT __declspec(dllimport)
75 # endif
76 # define MI_DLL_LOCAL
77 #elif defined(__GNUC__) && !defined(__ICC)
78 # define MI_DLL_EXPORT __attribute__ ((visibility("default")))
79 # define MI_DLL_LOCAL __attribute__ ((visibility("hidden")))
80 #else
81 # define MI_DLL_EXPORT
82 # define MI_DLL_LOCAL
83 #endif
84 
87 #define MI_BASE_JOIN( X, Y ) MI_BASE_DO_JOIN( X, Y )
88 #define MI_BASE_DO_JOIN( X, Y ) MI_BASE_DO_JOIN2(X,Y)
89 #define MI_BASE_DO_JOIN2( X, Y ) X##Y
90 
92 #define MI_BASE_STRINGIZE( X ) MI_BASE_DO_STRINGIZE( X )
93 #define MI_BASE_DO_STRINGIZE( X ) MI_BASE_DO_STRINGIZE2(X)
94 #define MI_BASE_DO_STRINGIZE2( X ) #X
95 
99 #define MI_PREVENT_MACRO_EXPAND
100 
101 #if defined(__cplusplus)
102 
103 // STL Customization start
104 
105 // If defined, the namespace alias definition for \c MISTD is suppressed.
106 // This can be used if the standard library classes and functions have
107 // been configured to live already in the \c MISTD namespace.
108 #ifndef MI_BASE_NO_MISTD_ALIAS
109 
110 // If defined it expands to a valid namespace scope that contains the
111 // standard library classes and functions. It is used for the namespace
112 // alias \c MISTD instead of the default <code>::std</code>.
113 #ifdef MI_BASE_STD_NAMESPACE
114 namespace MISTD = MI_BASE_STD_NAMESPACE;
115 #else // MI_BASE_STD_NAMESPACE
116 namespace std {}
117 namespace MISTD = ::std;
118 #if defined(_WIN32) && !defined(_USE_MATH_DEFINES)
119 #define _USE_MATH_DEFINES // for M_PI
120 #endif
121 #endif // MI_BASE_STD_NAMESPACE
122 
123 #endif // MI_BASE_NO_MISTD_ALIAS
124 
125 // STL Customization end
126 
127 #endif // __cplusplus
128 
129 // Platform detection start
130 
131 #if defined(_WIN32)
132 
133 #if !defined(MI_PLATFORM_WINDOWS)
134 #define MI_PLATFORM_WINDOWS
135 #endif // !defined(MI_PLATFORM_WINDOWS)
136 
137 #if defined(_WIN64)
138 
139 #if !defined(MI_PLATFORM_WIN64)
140 #define MI_PLATFORM_WIN64
141 #endif // !defined(MI_PLATFORM_WIN64)
142 
143 #else // defined(_WIN64)
144 
145 #if !defined(MI_PLATFORM_WIN32)
146 #define MI_PLATFORM_WIN32
147 #endif // !defined(MI_PLATFORM_WIN32)
148 
149 #endif // defined(_WIN64)
150 
151 #elif defined(__APPLE__) // defined(_WIN32)
152 
153 #if !defined(MI_PLATFORM_MACOSX)
154 #define MI_PLATFORM_MACOSX
155 #endif // !defined(MI_PLATFORM_MACOSX)
156 
157 #elif defined(__unix__) // defined(__APPLE__)
158 
159 #if !defined(MI_PLATFORM_UNIX)
160 #define MI_PLATFORM_UNIX
161 #endif // !defined(MI_PLATFORM_UNIX)
162 
163 #if defined(__x86_64__)
164 
165 #if !defined(MI_PLATFORM_UNIX64)
166 #define MI_PLATFORM_UNIX64
167 #endif // !defined(MI_PLATFORM_UNIX64)
168 
169 #else // defined(__x86_64__)
170 
171 #if !defined(MI_PLATFORM_UNIX32)
172 #define MI_PLATFORM_UNIX32
173 #endif // !defined(MI_PLATFORM_UNIX32)
174 
175 #endif // defined(__x86_64__)
176 
177 #if defined(__linux__)
178 
179 #if !defined(MI_PLATFORM_LINUX)
180 #define MI_PLATFORM_LINUX
181 #endif // !defined(MI_PLATFORM_LINUX)
182 
183 #endif // defined(__linux__)
184 
185 #endif // defined(__unix__)
186 
187 // Platform detection end
188 
189 // Compiler detection start
190 
191 #if defined(_MSC_VER)
192 
193 #ifndef MI_SKIP_COMPILER_VERSION_CHECK
194 #if (_MSC_VER < 1400)
195 #error Microsoft Visual C++ compiler version is unsupported (smaller than 1400).
196 #endif
197 #endif // MI_SKIP_COMPILER_VERSION_CHECK
198 
199 #if !defined(MI_COMPILER_MSC)
200 #define MI_COMPILER_MSC _MSC_VER
201 #endif // !defined(MI_COMPILER_MSC)
202 
203 #elif defined(__ICC) // defined(_MSC_VER)
204 
205 #ifndef MI_SKIP_COMPILER_VERSION_CHECK
206 #if (__ICC < 900)
207 #error Intel C++ compiler version is unsupported (smaller than 900).
208 #endif
209 #endif // MI_SKIP_COMPILER_VERSION_CHECK
210 
211 #if !defined(MI_COMPILER_ICC)
212 #define MI_COMPILER_ICC __ICC
213 #endif // !defined(MI_COMPILER_ICC)
214 
215 #elif defined(__GNUC__) && !defined(__ICC) // #elif defined(__ICC)
216 
217 #ifndef MI_SKIP_COMPILER_VERSION_CHECK
218 #if ((__GNUC__ < 3) || ((__GNUC__ == 3) && (__GNUC_MINOR__ < 3)))
219 #error GNU C++ compiler version is unsupported (smaller than 3.3).
220 #endif
221 
222 #if ((__GNUC__ < 3) || ((__GNUC__ == 3) && (__GNUC_MINOR__ < 4)))
223 #warning GNU C++ compiler version is unsupported (smaller than 3.4).
224 #endif
225 #endif // MI_SKIP_COMPILER_VERSION_CHECK
226 
227 #if !defined(MI_COMPILER_GCC)
228 #define MI_COMPILER_GCC __GNUC__
229 #endif // !defined(MI_COMPILER_GCC)
230 
231 #endif // defined(__GNUC__)
232 
233 // Compiler detection end
234 
235 // Processor architecture detection start
236 
237 #if defined(_M_IX86) || defined(__i386__) || defined(__x86_64__) || defined(_M_X64)
238 
239 #if !defined(MI_ARCH_X86)
240 #define MI_ARCH_X86
241 #endif // !defined(MI_ARCH_X86)
242 
243 #if (defined(__x86_64__) || defined(_M_X64) ) && !defined(MI_ARCH_X86_64)
244 #define MI_ARCH_X86_64
245 #endif // defined(__x86_64__) && !defined(MI_ARCH_X86_64)
246 
247 #if !defined(MI_ARCH_LITTLE_ENDIAN)
248 #define MI_ARCH_LITTLE_ENDIAN
249 #endif // !defined(MI_ARCH_LITTLE_ENDIAN)
250 
251 #elif defined(__sparcv9) // defined(_M_IX86) || defined(__i386__)
252 
253 #if ! defined( MI_ARCH_SPARC_64)
254 #define MI_ARCH_SPARC_64
255 #endif // !defined( MI_ARCH_SPARC_64)
256 
257 #if !defined(MI_ARCH_BIG_ENDIAN)
258 #define MI_ARCH_BIG_ENDIAN
259 #endif // !defined(MI_ARCH_BIG_ENDIAN)
260 
261 #elif defined(__powerpc64__)
262 
263 #if !defined(MI_ARCH_POWERPC_64)
264 #define MI_ARCH_POWERPC_64
265 #endif // !defined( MI_ARCH_ARCH_POWERPC_64)
266 
267 #if !defined(__LITTLE_ENDIAN__)
268 #error Architecture POWERPC_64 is only supported in little endian mode.
269 #endif
270 
271 #if !defined(MI_ARCH_LITTLE_ENDIAN)
272 #define MI_ARCH_LITTLE_ENDIAN
273 #endif // !defined(MI_ARCH_LITTLE_ENDIAN)
274 
275 #endif
276 
277 #if defined(MI_ARCH_X86_64) || defined(MI_ARCH_SPARC_64) || defined(MI_ARCH_POWERPC_64)
278 #define MI_ARCH_64BIT
279 #endif // defined(MI_ARCH_X86_64) ...
280 
281 // Check that we detected one architecture
282 #if ! defined(MI_ARCH_BIG_ENDIAN) && ! defined(MI_ARCH_LITTLE_ENDIAN)
283 #error Architecture unknown, neither big-endian nor little-endian detected.
284 #endif
285 
286 // Processor architecture detection end
287 
299 #if defined(__cplusplus) && !defined(MI_FORCE_INLINE)
300 # if defined(_MSC_VER) /* Microsoft Visual C++ */
301 # define MI_FORCE_INLINE __forceinline
302 # elif defined(__GNUC__) /* GNU C/C++ Compiler */
303 # if defined(DEBUG)
304  /* Known bug in some g++ compiler versions: forced inlining produces
305  * buggy code when compiling without optimization.
306  */
307 # define MI_FORCE_INLINE inline
308 # else
309 # define MI_FORCE_INLINE __attribute__ ((always_inline)) inline
310 # endif
311 # else
312 # define MI_FORCE_INLINE inline
313 # endif
314 #endif
315  // end group mi_base_config
317 
318 #endif // MI_BASE_CONFIG_H