opennurbs_system_runtime.h
1 /*
2 // Copyright (c) 1993-2016 Robert McNeel & Associates. All rights reserved.
3 // OpenNURBS, Rhinoceros, and Rhino3D are registered trademarks of Robert
4 // McNeel & Associates.
5 //
6 // THIS SOFTWARE IS PROVIDED "AS IS" WITHOUT EXPRESS OR IMPLIED WARRANTY.
7 // ALL IMPLIED WARRANTIES OF FITNESS FOR ANY PARTICULAR PURPOSE AND OF
8 // MERCHANTABILITY ARE HEREBY DISCLAIMED.
9 //
10 // For complete openNURBS copyright information see <http://www.opennurbs.org>.
11 //
12 ////////////////////////////////////////////////////////////////
13 */
14 
15 #if !defined(OPENNURBS_SYSTEM_RUNTIME_INC_)
16 #define OPENNURBS_SYSTEM_RUNTIME_INC_
17 
18 /*
19 ////////////////////////////////////////////////////////////////
20 //
21 // Determines the runtime environment where the code is executed.
22 //
23 ////////////////////////////////////////////////////////////////
24 */
25 
26 
27 /*
28 ////////////////////////////////////////////////////////////
29 //
30 // BEGIN - ON_RUNTIME_APPLE / ON_RUNTIME_WIN / ON_RUNTIME_ANDROID defines
31 //
32 // ON_RUNTIME_* specifies the runtime C/C++ SDK being used
33 // At most one the ON_RUNTIME_* should be defined
34 //
35 // ON_RUNTIME_APPLE / ON_RUNTIME_WIN / ON_RUNTIME_ANDROID
36 //
37 */
38 #if (defined(__APPLE__) || defined(TARGET_OS_IPHONE) || defined(TARGET_IPHONE_SIMULATOR) || defined(__IOS__))
39 
40 #if !defined(ON_RUNTIME_APPLE)
41 #define ON_RUNTIME_APPLE
42 #endif
43 
44 #elif defined(_WIN32) || defined(WIN32) || defined(_WIN64) || defined(WIN64) || defined(WINDOWS) || defined(_WINDOWS_) || defined(__WINDOWS__)
45 
46 #if !defined(ON_RUNTIME_WIN)
47 #define ON_RUNTIME_WIN
48 #endif
49 
50 #elif defined(__ANDROID__)
51 
52 #if !defined(ON_RUNTIME_ANDROID)
53 #define ON_RUNTIME_ANDROID
54 #endif
55 
56 #endif
57 /*
58 //
59 // END - ON_RUNTIME_APPLE / ON_RUNTIME_WIN / ON_RUNTIME_ANDROID defines
60 //
61 ////////////////////////////////////////////////////////////
62 */
63 
64 /*
65 ////////////////////////////////////////////////////////////
66 //
67 // BEGIN - Additional platform defines
68 //
69 // ON_64BIT_RUNTIME / ON_32BIT_RUNTIME
70 // ON_LITTLE_ENDIAN / ON_BIG_ENDIAN
71 // ON_SIZEOF_WCHAR_T
72 // ON_RUNTIME_<PLATFORM>_<SUBPLATFORM>
73 //
74 */
75 #if defined(ON_RUNTIME_APPLE)
76 
77 #if (defined(TARGET_OS_IPHONE) || defined(TARGET_IPHONE_SIMULATOR) || defined(__IOS__))
78 #define ON_RUNTIME_APPLE_IOS
79 #else
80 #define ON_RUNTIME_APPLE_MACOS
81 #endif
82 
83 #if (defined(__LP64__) || defined(__ppc64__))
84 #define ON_64BIT_RUNTIME
85 #elif defined(__LP32__)
86 #define ON_32BIT_RUNTIME
87 #else
88 #error Add code to detect sizeof pointer on this Apple platform
89 #endif
90 
91 #define ON_SIZEOF_WCHAR_T 4
92 
93 #if (defined(__ppc__) || defined(__ppc64__))
94 #define ON_BIG_ENDIAN
95 #else
96 #define ON_LITTLE_ENDIAN
97 #endif
98 
99 #elif defined(ON_RUNTIME_WIN)
100 
101 #define ON_SIZEOF_WCHAR_T 2
102 
103 #if defined(WINDOWS_PHONE)
104 #define ON_RUNTIME_WIN_MOBILE
105 #else
106 #define ON_RUNTIME_WIN_WINOS
107 #endif
108 
109 #if defined(_M_X64) || defined(_WIN64)
110 #define ON_64BIT_RUNTIME
111 #elif defined(_M_X86) || defined(_WIN32)
112 #define ON_32BIT_RUNTIME
113 #else
114 #error Add code to detect sizeof pointer on this Windows platform
115 #endif
116 
117 #if !defined(ON_LITTLE_ENDIAN)
118 #if (defined(_M_X64) || defined(_M_IX86) || defined (__i386__) || defined( __x86_64__ ))
119 #define ON_LITTLE_ENDIAN
120 #endif
121 #endif
122 
123 #elif defined(ON_RUNTIME_ANDROID)
124 
125 #if !defined(ON_SIZEOF_WCHAR_T)
126 #define ON_SIZEOF_WCHAR_T 4
127 #endif
128 
129 #endif
130 
131 #if !defined(ON_64BIT_RUNTIME) && !defined(ON_32BIT_RUNTIME)
132 /* Attempt to determing runtime pointer size */
133 #if (defined(_M_X64) || defined(__LP64__) || defined(__ppc64__))
134 #define ON_64BIT_RUNTIME
135 #elif (defined(_M_X86) || defined(__LP32__))
136 #define ON_32BIT_RUNTIME
137 #endif
138 #endif
139 
140 #if defined(ON_64BIT_RUNTIME) && defined(ON_32BIT_RUNTIME)
141 #error Exactly one of ON_64BIT_RUNTIME or ON_32BIT_RUNTIME must be defined.
142 #endif
143 
144 #if !defined(ON_64BIT_RUNTIME) && !defined(ON_32BIT_RUNTIME)
145 #error Exactly one of ON_64BIT_RUNTIME or ON_32BIT_RUNTIME must be defined.
146 #endif
147 
148 #if defined(ON_BIG_ENDIAN) && defined(ON_LITTLE_ENDIAN)
149 #error Exactly one of ON_LITTLE_ENDIAN or ON_BIG_ENDIAN should be defined.
150 #endif
151 
152 #if !defined(ON_BIG_ENDIAN) && !defined(ON_LITTLE_ENDIAN)
153 #error Exactly one of ON_LITTLE_ENDIAN or ON_BIG_ENDIAN should be defined.
154 #endif
155 
156 /*
157 //
158 // END - Additional platform defines
159 //
160 ////////////////////////////////////////////////////////////
161 */
162 
163 #endif