File indexing completed on 2025-01-19 03:54:58
0001 /*****************************************************************************/ 0002 // Copyright 2006-2019 Adobe Systems Incorporated 0003 // All Rights Reserved. 0004 // 0005 // NOTICE: Adobe permits you to use, modify, and distribute this file in 0006 // accordance with the terms of the Adobe license agreement accompanying it. 0007 /*****************************************************************************/ 0008 0009 /** \file 0010 * Conditional compilation flags for DNG SDK. 0011 * 0012 * All conditional compilation macros for the DNG SDK begin with a lowercase 'q'. 0013 */ 0014 0015 /*****************************************************************************/ 0016 0017 #ifndef __dng_flags__ 0018 #define __dng_flags__ 0019 0020 /*****************************************************************************/ 0021 0022 /// \def qMacOS 0023 /// 1 if compiling for Mac OS X. 0024 0025 /// \def qWinOS 0026 /// 1 if compiling for Windows. 0027 0028 // Make sure a platform is defined 0029 0030 #if !(defined(qMacOS) || defined(qWinOS) || defined(qAndroid) || defined(qiPhone) || defined(qLinux)) 0031 #include "RawEnvironment.h" 0032 #endif 0033 0034 // This requires a force include or compiler define. These are the unique platforms. 0035 0036 #if !(defined(qMacOS) || defined(qWinOS) || defined(qAndroid) || defined(qiPhone) || defined(qLinux)) 0037 #error Unable to figure out platform 0038 #endif 0039 0040 /*****************************************************************************/ 0041 0042 // Platforms. 0043 // Zeros out any undefined platforms, so that #if can be used in place of #ifdef. 0044 0045 #ifndef qMacOS 0046 #define qMacOS 0 0047 #endif 0048 0049 #ifndef qiPhone 0050 #define qiPhone 0 0051 #endif 0052 0053 #ifndef qiPhoneSimulator 0054 #define qiPhoneSimulator 0 0055 #endif 0056 0057 #ifndef qAndroid 0058 #define qAndroid 0 0059 #endif 0060 0061 #ifndef qWinOS 0062 #define qWinOS 0 0063 #endif 0064 0065 #ifndef qWinRT 0066 #define qWinRT 0 0067 #endif 0068 0069 #ifndef qLinux 0070 #define qLinux 0 0071 #endif 0072 0073 #ifndef qWeb 0074 #define qWeb 0 0075 #endif 0076 0077 /*****************************************************************************/ 0078 0079 #if qiPhoneSimulator 0080 #if !qiPhone 0081 #error "qiPhoneSimulator set and not qiPhone" 0082 #endif 0083 #endif 0084 0085 #if qWinRT 0086 #if !qWinOS 0087 #error "qWinRT set but not qWinOS" 0088 #endif 0089 #endif 0090 0091 /*****************************************************************************/ 0092 0093 // arm and neon support 0094 0095 // arm detect (apple vs. win) 0096 #if defined(__arm__) || defined(__arm64__) || defined(_M_ARM) 0097 #define qARM 1 0098 #endif 0099 0100 // arm_neon detect 0101 #if defined(__ARM_NEON__) || defined(_M_ARM) 0102 #define qARMNeon 1 0103 #endif 0104 0105 #ifndef qARM 0106 #define qARM 0 0107 #endif 0108 0109 #ifndef qARMNeon 0110 #define qARMNeon 0 0111 #endif 0112 0113 /*****************************************************************************/ 0114 0115 // Establish WIN32 and WIN64 definitions. 0116 0117 #if defined(_WIN32) && !defined(WIN32) 0118 #define WIN32 1 0119 #endif 0120 0121 #if defined(_WIN64) && !defined(WIN64) 0122 #define WIN64 1 0123 #endif 0124 0125 /*****************************************************************************/ 0126 0127 /// \def qDNGDebug 0128 /// 1 if debug code is compiled in, 0 otherwise. Enables assertions and other debug 0129 /// checks in exchange for slower processing. 0130 0131 // Figure out if debug build or not. 0132 0133 #ifndef qDNGDebug 0134 0135 #if defined(Debug) 0136 #define qDNGDebug Debug 0137 0138 #elif defined(_DEBUG) 0139 #define qDNGDebug _DEBUG 0140 0141 #else 0142 #define qDNGDebug 0 0143 0144 #endif 0145 #endif 0146 0147 /*****************************************************************************/ 0148 // Support Intel Thread Building Blocks (TBB)? 0149 // 0150 // This flag needs to be configured via the project, because there are sources 0151 // outside the cr_sdk (such as the CTJPEG and ACE libs) that need to use the 0152 // same flag to determine whether to use TBB or not. 0153 // 0154 // By default, configure to 0 (disabled). 0155 0156 #ifndef qCRSupportTBB 0157 #define qCRSupportTBB 0 0158 #endif 0159 0160 #if qCRSupportTBB 0161 #ifndef TBB_DEPRECATED 0162 #define TBB_DEPRECATED 0 0163 #endif 0164 #endif 0165 0166 // This is not really a switch, but rather a shorthand for determining whether 0167 // or not we're building a particular translation unit (source file) using the 0168 // Intel Compiler. 0169 0170 #ifndef qDNGIntelCompiler 0171 #if defined(__INTEL_COMPILER) 0172 #define qDNGIntelCompiler (__INTEL_COMPILER >= 1700) 0173 #else 0174 #define qDNGIntelCompiler 0 0175 #endif 0176 #endif 0177 0178 /*****************************************************************************/ 0179 0180 // Figure out byte order. 0181 0182 /// \def qDNGBigEndian 0183 /// 1 if this target platform is big endian (e.g. PowerPC Macintosh), else 0. 0184 /// 0185 /// \def qDNGLittleEndian 0186 /// 1 if this target platform is little endian (e.g. x86 processors), else 0. 0187 0188 #ifndef qDNGBigEndian 0189 0190 #if defined(qDNGLittleEndian) 0191 #define qDNGBigEndian !qDNGLittleEndian 0192 0193 #elif defined(__s390__) || defined(__s390x__) 0194 #define qDNGBigEndian 1 0195 0196 #elif defined(__POWERPC__) 0197 #define qDNGBigEndian 1 0198 0199 #elif defined(__INTEL__) 0200 #define qDNGBigEndian 0 0201 0202 #elif defined(_M_IX86) 0203 #define qDNGBigEndian 0 0204 0205 #elif defined(_M_X64) || defined(__amd64__) 0206 #define qDNGBigEndian 0 0207 0208 #elif defined(__LITTLE_ENDIAN__) 0209 #define qDNGBigEndian 0 0210 0211 #elif defined(__BIG_ENDIAN__) 0212 #define qDNGBigEndian 1 0213 0214 #elif defined(_ARM_) 0215 #define qDNGBigEndian 0 0216 0217 #else 0218 0219 #ifndef qXCodeRez 0220 #error Unable to figure out byte order. 0221 #endif 0222 0223 #endif 0224 #endif 0225 0226 #ifndef qXCodeRez 0227 0228 #ifndef qDNGLittleEndian 0229 #define qDNGLittleEndian !qDNGBigEndian 0230 #endif 0231 0232 #endif 0233 0234 /*****************************************************************************/ 0235 0236 /// \def qDNG64Bit 0237 /// 1 if this target platform uses 64-bit addresses, 0 otherwise. 0238 0239 #ifndef qDNG64Bit 0240 0241 #if qMacOS 0242 0243 #ifdef __LP64__ 0244 #if __LP64__ 0245 #define qDNG64Bit 1 0246 #endif 0247 #endif 0248 0249 #elif qWinOS 0250 0251 #ifdef WIN64 0252 #if WIN64 0253 #define qDNG64Bit 1 0254 #endif 0255 #endif 0256 0257 #elif qLinux 0258 0259 #ifdef __LP64__ 0260 #if __LP64__ 0261 #define qDNG64Bit 1 0262 #endif 0263 #endif 0264 0265 #endif 0266 0267 #ifndef qDNG64Bit 0268 #define qDNG64Bit 0 0269 #endif 0270 0271 #endif 0272 0273 /*****************************************************************************/ 0274 0275 /// \def qDNGThreadSafe 0276 /// 1 if target platform has thread support and threadsafe libraries, 0 otherwise. 0277 0278 #ifndef qDNGThreadSafe 0279 #define qDNGThreadSafe (qMacOS || qWinOS) 0280 #endif 0281 0282 /*****************************************************************************/ 0283 0284 /// \def qDNGValidateTarget 0285 /// 1 if dng_validate command line tool is being built, 0 otherwise. 0286 0287 #ifndef qDNGValidateTarget 0288 #define qDNGValidateTarget 0 0289 #endif 0290 0291 /*****************************************************************************/ 0292 0293 /// \def qDNGValidate 0294 /// 1 if DNG validation code is enabled, 0 otherwise. 0295 0296 #ifndef qDNGValidate 0297 #define qDNGValidate qDNGValidateTarget 0298 #endif 0299 0300 /*****************************************************************************/ 0301 0302 /// \def qDNGPrintMessages 0303 /// 1 if dng_show_message should use fprintf to stderr. 0 if it should use a platform 0304 /// specific interrupt mechanism. 0305 0306 #ifndef qDNGPrintMessages 0307 #define qDNGPrintMessages qDNGValidate 0308 #endif 0309 0310 /*****************************************************************************/ 0311 0312 // Experimental features -- work in progress for Lightroom and Camera Raw 0313 // major releases. Turn this off for Lightroom & Camera Raw dot releases. 0314 0315 #ifndef qDNGExperimental 0316 #define qDNGExperimental 1 0317 #endif 0318 0319 /*****************************************************************************/ 0320 0321 /// \def qDNGXMPFiles 0322 /// 1 to use XMPFiles. 0323 0324 #ifndef qDNGXMPFiles 0325 #define qDNGXMPFiles 1 0326 #endif 0327 0328 /*****************************************************************************/ 0329 0330 /// \def qDNGXMPDocOps 0331 /// 1 to use XMPDocOps. 0332 0333 #ifndef qDNGXMPDocOps 0334 #define qDNGXMPDocOps (!qDNGValidateTarget) 0335 #endif 0336 0337 /*****************************************************************************/ 0338 0339 /// \def qDNGUseLibJPEG 0340 /// 1 to use open-source libjpeg for lossy jpeg processing. 0341 0342 #ifndef qDNGUseLibJPEG 0343 #define qDNGUseLibJPEG qDNGValidateTarget 0344 #endif 0345 0346 /*****************************************************************************/ 0347 0348 #ifndef qDNGAVXSupport 0349 #define qDNGAVXSupport ((qMacOS || qWinOS) && qDNG64Bit && !qARM && 1) 0350 #endif 0351 0352 #if qDNGAVXSupport && !(qDNG64Bit && !qARM) 0353 #error AVX support is enabled when 64-bit support is not or ARM is 0354 #endif 0355 0356 /*****************************************************************************/ 0357 0358 #ifndef qDNGSupportVC5 0359 #define qDNGSupportVC5 (1) 0360 #endif 0361 0362 /*****************************************************************************/ 0363 0364 /// \def qDNGUsingSanitizer 0365 /// Set to 1 when using a Sanitizer tool. 0366 0367 #ifndef qDNGUsingSanitizer 0368 #define qDNGUsingSanitizer (0) 0369 #endif 0370 0371 /*****************************************************************************/ 0372 0373 #ifndef DNG_ATTRIB_NO_SANITIZE 0374 #if qDNGUsingSanitizer && defined(__clang__) 0375 #define DNG_ATTRIB_NO_SANITIZE(type) __attribute__((no_sanitize(type))) 0376 #else 0377 #define DNG_ATTRIB_NO_SANITIZE(type) 0378 #endif 0379 #endif 0380 0381 /*****************************************************************************/ 0382 0383 /// \def qDNGDepthSupport 0384 /// 1 to add support for depth maps in DNG format. 0385 /// Deprecated 2018-09-19. 0386 0387 #ifdef __cplusplus 0388 #define qDNGDepthSupport #error 0389 #endif 0390 0391 /*****************************************************************************/ 0392 0393 /// \def qDNGPreserveBlackPoint 0394 /// 1 to add support for non-zero black point in early raw pipeline. 0395 /// Deprecated 2018-09-19. 0396 0397 #ifdef __cplusplus 0398 #define qDNGPreserveBlackPoint #error 0399 #endif 0400 0401 /*****************************************************************************/ 0402 0403 #endif 0404 0405 /*****************************************************************************/