XMP Toolkit SDK  6.0.0
XMP_Environment.h
Go to the documentation of this file.
1 #ifndef __XMP_Environment_h__
2 #define __XMP_Environment_h__ 1
3 
4 // =================================================================================================
5 // XMP_Environment.h - Build environment flags for the XMP toolkit.
6 // ================================================================
7 //
8 // This header is just C preprocessor macro definitions to set up the XMP toolkit build environment.
9 // It must be the first #include in any chain since it might affect things in other #includes.
10 //
11 // =================================================================================================
12 
13 // =================================================================================================
14 // Copyright 2002 Adobe
15 // All Rights Reserved.
16 //
17 // NOTICE: Adobe permits you to use, modify, and distribute this file in accordance with the terms
18 // of the Adobe license agreement accompanying it. If you have received this file from a source other
19 // than Adobe, then your use, modification, or distribution of it requires the prior written permission
20 // of Adobe.
21 // =================================================================================================
22 
23 // =================================================================================================
24 // Determine the Platform
25 // ======================
26 
27 // One of MAC_ENV, WIN_ENV, UNIX_ENV or IOS_ENV must be defined by the client. Since some other code
28 // requires these to be defined without values, they are only used here to define XMP-specific
29 // macros with 0 or 1 values.
30 
31 // ! Tempting though it might be to have a standard macro for big or little endian, there seems to
32 // ! be no decent way to do that on our own in UNIX. Forcing it on the client isn't acceptable.
33 
34 #if defined ( MAC_ENV ) && !defined (IOS_ENV)
35 
36  #if 0 // ! maybe someday - ! MAC_ENV
37  #error "MAC_ENV must be defined so that \"#if MAC_ENV\" is true"
38  #endif
39 
40  #if defined ( WIN_ENV ) || defined ( UNIX_ENV ) || defined ( ANDROID_ENV )
41  #error "XMP environment error - must define only one of MAC_ENV, WIN_ENV, UNIX_ENV or ANDROID_ENV"
42  #endif
43 
44  #define XMP_MacBuild 1
45  #define XMP_WinBuild 0
46  #define XMP_UNIXBuild 0
47  #define XMP_iOSBuild 0
48  #define XMP_UWP 0
49  #define XMP_AndroidBuild 0
50 
51 #elif defined ( WIN_ENV )
52 
53  #if 0 // ! maybe someday - ! WIN_ENV
54  #error "WIN_ENV must be defined so that \"#if WIN_ENV\" is true"
55  #endif
56 
57  #if defined ( MAC_ENV ) || defined ( UNIX_ENV ) || defined ( IOS_ENV ) || defined ( ANDROID_ENV )
58  #error "XMP environment error - must define only one of MAC_ENV (or IOS_ENV), WIN_ENV, UNIX_ENV, ANDROID_ENV"
59  #endif
60 
61  #define XMP_MacBuild 0
62  #define XMP_WinBuild 1
63  #define XMP_UNIXBuild 0
64  #define XMP_iOSBuild 0
65  #if defined ( WIN_UNIVERSAL_ENV)
66  #define XMP_UWP 1
67  #else
68  #define XMP_UWP 0
69  #endif
70  #define XMP_AndroidBuild 0
71 
72 #elif defined ( UNIX_ENV ) && !defined (ANDROID_ENV)
73 
74  #if 0 // ! maybe someday - ! UNIX_ENV
75  #error "UNIX_ENV must be defined so that \"#if UNIX_ENV\" is true"
76  #endif
77 
78  #if defined ( MAC_ENV ) || defined ( WIN_ENV ) || defined ( IOS_ENV ) || defined ( ANDROID_ENV )
79  #error "XMP environment error - must define only one of MAC_ENV (or IOS_ENV), WIN_ENV, UNIX_ENV, ANDROID_ENV"
80  #endif
81 
82  #define XMP_MacBuild 0
83  #define XMP_WinBuild 0
84  #define XMP_UNIXBuild 1
85  #define XMP_iOSBuild 0
86 
87  #define XMP_UWP 0
88  #define XMP_AndroidBuild 0
89 
90 #elif defined ( IOS_ENV )
91 
92  #if 0 // ! maybe someday - ! IOS_ENV
93  #error "IOS_ENV must be defined so that \"#if IOS_ENV\" is true"
94  #endif
95 
96  #if defined ( WIN_ENV ) || defined ( UNIX_ENV ) || defined ( ANDROID_ENV )
97  #error "XMP environment error - must define only one of IOS_ENV, WIN_ENV, UNIX_ENV, ANDROID_ENV"
98  #endif
99 
100  #define XMP_MacBuild 0
101  #define XMP_WinBuild 0
102  #define XMP_UNIXBuild 0
103  #define XMP_iOSBuild 1
104 
105  #define XMP_UWP 0
106 
107  #define XMP_AndroidBuild 0
108 
109 #elif defined ( ANDROID_ENV )
110 
111  #if 0 // ! maybe someday - ! UNIX_ENV
112  #error "ANDROID_ENV must be defined so that \"#if ANDROID_ENV\" is true"
113  #endif
114 
115  #if defined ( MAC_ENV ) || defined ( WIN_ENV ) || defined ( IOS_ENV )
116  #error "XMP environment error - must define only one of MAC_ENV (or IOS_ENV), WIN_ENV, UNIX_ENV, ANDROID_ENV"
117  #endif
118 
119  #define XMP_MacBuild 0
120  #define XMP_WinBuild 0
121  #define XMP_UNIXBuild 0
122  #define XMP_iOSBuild 0
123  #define XMP_AndroidBuild 1
124 
125 #else
126 
127  #error "XMP environment error - must define one of MAC_ENV, WIN_ENV, UNIX_ENV , ANDROID_ENV or IOS_ENV"
128 
129 #endif
130 
131 // =================================================================================================
132 // Common Macros
133 // =============
134 
135 #if defined ( DEBUG )
136  #if defined ( NDEBUG )
137  #error "XMP environment error - both DEBUG and NDEBUG are defined"
138  #endif
139  #define XMP_DebugBuild 1
140 #endif
141 
142 #if defined ( NDEBUG )
143  #define XMP_DebugBuild 0
144 #endif
145 
146 #ifndef XMP_DebugBuild
147  #define XMP_DebugBuild 0
148 #endif
149 
150 #if XMP_DebugBuild
151  #include <stdio.h> // The assert macro needs printf.
152 #endif
153 
154 #ifndef DISABLE_SERIALIZED_IMPORT_EXPORT
155  #define DISABLE_SERIALIZED_IMPORT_EXPORT 0
156 #endif
157 
158 #ifndef XMP_64
159  #if _WIN64 || defined(_LP64)
160  #define XMP_64 1
161  #else
162  #define XMP_64 0
163  #endif
164 #endif
165 
166 // =================================================================================================
167 // Macintosh Specific Settings
168 // ===========================
169 #if (XMP_MacBuild)
170  #define XMP_HELPER_DLL_IMPORT __attribute__((visibility("default")))
171  #define XMP_HELPER_DLL_EXPORT __attribute__((visibility("default")))
172  #define XMP_HELPER_DLL_PRIVATE __attribute__((visibility("hidden")))
173  #define APICALL
174 #endif
175 
176 // =================================================================================================
177 // Windows Specific Settings
178 // =========================
179 #if (XMP_WinBuild)
180  #define XMP_HELPER_DLL_IMPORT
181  #define XMP_HELPER_DLL_EXPORT
182  #define XMP_HELPER_DLL_PRIVATE
183  #define APICALL __stdcall
184 #endif
185 
186 // =================================================================================================
187 // UNIX Specific Settings
188 // ======================
189 #if (XMP_UNIXBuild) | (XMP_AndroidBuild)
190  #define XMP_HELPER_DLL_IMPORT
191  #define XMP_HELPER_DLL_EXPORT __attribute__ ((visibility ("default")))
192  #define XMP_HELPER_DLL_PRIVATE __attribute__ ((visibility ("hidden")))
193  #define APICALL
194 #endif
195 
196 // =================================================================================================
197 // IOS Specific Settings
198 // ===========================
199 #if (XMP_iOSBuild)
200  #include <TargetConditionals.h>
201  #if (TARGET_CPU_ARM)
202  #define XMP_IOS_ARM 1
203  #else
204  #define XMP_IOS_ARM 0
205  #endif
206  #define XMP_HELPER_DLL_IMPORT __attribute__((visibility("default")))
207  #define XMP_HELPER_DLL_EXPORT __attribute__((visibility("default")))
208  #define XMP_HELPER_DLL_PRIVATE __attribute__((visibility("hidden")))
209  #define APICALL
210 #endif
211 
212 // =================================================================================================
213 
214 #if (XMP_DynamicBuild)
215  #define XMP_PUBLIC XMP_HELPER_DLL_EXPORT
216  #define XMP_PRIVATE XMP_HELPER_DLL_PRIVATE
217 #elif (XMP_StaticBuild)
218  #define XMP_PUBLIC
219  #define XMP_PRIVATE
220 #else
221  #define XMP_PUBLIC XMP_HELPER_DLL_IMPORT
222  #define XMP_PRIVATE XMP_HELPER_DLL_PRIVATE
223 #endif
224 
225 #endif // __XMP_Environment_h__