| 1 |
/*****************************************************************************/ |
| 2 |
// Copyright 2006-2019 Adobe Systems Incorporated |
| 3 |
// All Rights Reserved. |
| 4 |
// |
| 5 |
// NOTICE: Adobe permits you to use, modify, and distribute this file in |
| 6 |
// accordance with the terms of the Adobe license agreement accompanying it. |
| 7 |
/*****************************************************************************/ |
| 8 |
|
| 9 |
/** \file |
| 10 |
* Conditional compilation flags for DNG SDK. |
| 11 |
* |
| 12 |
* All conditional compilation macros for the DNG SDK begin with a lowercase 'q'. |
| 13 |
*/ |
| 14 |
|
| 15 |
/*****************************************************************************/ |
| 16 |
|
| 17 |
#ifndef __dng_flags__ |
| 18 |
#define __dng_flags__ |
| 19 |
|
| 20 |
/*****************************************************************************/ |
| 21 |
|
| 22 |
/// \def qMacOS |
| 23 |
/// 1 if compiling for Mac OS X. |
| 24 |
|
| 25 |
/// \def qWinOS |
| 26 |
/// 1 if compiling for Windows. |
| 27 |
|
| 28 |
// Make sure a platform is defined |
| 29 |
|
| 30 |
#if !(defined(qMacOS) || defined(qWinOS) || defined(qAndroid) || defined(qiPhone) || defined(qLinux) || defined(qWeb)) |
| 31 |
#include "RawEnvironment.h" |
| 32 |
#endif |
| 33 |
|
| 34 |
// This requires a force include or compiler define. These are the unique platforms. |
| 35 |
|
| 36 |
#if !(defined(qMacOS) || defined(qWinOS) || defined(qAndroid) || defined(qiPhone) || defined(qLinux) || defined(qWeb)) |
| 37 |
#error Unable to figure out platform |
| 38 |
#endif |
| 39 |
|
| 40 |
/*****************************************************************************/ |
| 41 |
|
| 42 |
// Platforms. |
| 43 |
// Zeros out any undefined platforms, so that #if can be used in place of #ifdef. |
| 44 |
|
| 45 |
#ifndef qMacOS |
| 46 |
#define qMacOS 0 |
| 47 |
#endif |
| 48 |
|
| 49 |
#ifndef qiPhone |
| 50 |
#define qiPhone 0 |
| 51 |
#endif |
| 52 |
|
| 53 |
#ifndef qiPhoneSimulator |
| 54 |
#define qiPhoneSimulator 0 |
| 55 |
#endif |
| 56 |
|
| 57 |
#ifndef qAndroid |
| 58 |
#define qAndroid 0 |
| 59 |
#endif |
| 60 |
|
| 61 |
#ifndef qWinOS |
| 62 |
#define qWinOS 0 |
| 63 |
#endif |
| 64 |
|
| 65 |
#ifndef qWinRT |
| 66 |
#define qWinRT 0 |
| 67 |
#endif |
| 68 |
|
| 69 |
#ifndef qLinux |
| 70 |
#define qLinux 0 |
| 71 |
#endif |
| 72 |
|
| 73 |
#ifndef qWeb |
| 74 |
#define qWeb 0 |
| 75 |
#endif |
| 76 |
|
| 77 |
/*****************************************************************************/ |
| 78 |
|
| 79 |
#ifndef qIsFauxPlatformBuild |
| 80 |
#define qIsFauxPlatformBuild 0 |
| 81 |
#endif |
| 82 |
|
| 83 |
#ifndef qIsFauxWebPlatformBuild |
| 84 |
#define qIsFauxWebPlatformBuild 0 |
| 85 |
#endif |
| 86 |
|
| 87 |
#ifndef qIsFauxLinuxPlatformBuild |
| 88 |
#define qIsFauxLinuxPlatformBuild 0 |
| 89 |
#endif |
| 90 |
|
| 91 |
/*****************************************************************************/ |
| 92 |
|
| 93 |
#ifndef qMacOSNonFaux |
| 94 |
#define qMacOSNonFaux (qMacOS && !qIsFauxPlatformBuild) |
| 95 |
#endif |
| 96 |
|
| 97 |
/*****************************************************************************/ |
| 98 |
|
| 99 |
#if qiPhoneSimulator |
| 100 |
#if !qiPhone |
| 101 |
#error "qiPhoneSimulator set and not qiPhone" |
| 102 |
#endif |
| 103 |
#endif |
| 104 |
|
| 105 |
#if qWinRT |
| 106 |
#if !qWinOS |
| 107 |
#error "qWinRT set but not qWinOS" |
| 108 |
#endif |
| 109 |
#endif |
| 110 |
|
| 111 |
/*****************************************************************************/ |
| 112 |
|
| 113 |
// arm and arm64 support |
| 114 |
|
| 115 |
// arm detect (apple vs. win) |
| 116 |
#if defined(__arm__) || defined(__arm64__) || defined(_M_ARM) || defined(_M_ARM64) || defined(__aarch64__) |
| 117 |
#define qARM 1 |
| 118 |
#endif |
| 119 |
|
| 120 |
#if defined(__arm64__) || defined(_M_ARM64) || defined(__aarch64__) |
| 121 |
#define qARM64 1 |
| 122 |
#endif |
| 123 |
|
| 124 |
#ifndef qARM |
| 125 |
#define qARM 0 |
| 126 |
#endif |
| 127 |
|
| 128 |
#ifndef qARM64 |
| 129 |
#define qARM64 0 |
| 130 |
#endif |
| 131 |
|
| 132 |
/*****************************************************************************/ |
| 133 |
|
| 134 |
/// \def qX86_64 |
| 135 |
/// 1 if and only if this target platform is 64-bit x86 architecture |
| 136 |
|
| 137 |
#if defined(__x86_64__) || defined(_M_AMD64) || defined(_M_X64) |
| 138 |
#define qX86_64 1 |
| 139 |
#endif |
| 140 |
|
| 141 |
#ifndef qX86_64 |
| 142 |
#define qX86_64 0 |
| 143 |
#endif |
| 144 |
|
| 145 |
/*****************************************************************************/ |
| 146 |
|
| 147 |
// Establish WIN32 and WIN64 definitions. |
| 148 |
|
| 149 |
#if defined(_WIN32) && !defined(WIN32) |
| 150 |
#define WIN32 1 |
| 151 |
#endif |
| 152 |
|
| 153 |
#if defined(_WIN64) && !defined(WIN64) |
| 154 |
#define WIN64 1 |
| 155 |
#endif |
| 156 |
|
| 157 |
/*****************************************************************************/ |
| 158 |
|
| 159 |
/// \def qDNGDebug |
| 160 |
/// 1 if debug code is compiled in, 0 otherwise. Enables assertions and other debug |
| 161 |
/// checks in exchange for slower processing. |
| 162 |
|
| 163 |
// Figure out if debug build or not. |
| 164 |
|
| 165 |
#ifndef qDNGDebug |
| 166 |
|
| 167 |
#if defined(Debug) |
| 168 |
#define qDNGDebug Debug |
| 169 |
|
| 170 |
#elif defined(_DEBUG) |
| 171 |
#define qDNGDebug _DEBUG |
| 172 |
|
| 173 |
#else |
| 174 |
#define qDNGDebug 0 |
| 175 |
|
| 176 |
#endif |
| 177 |
#endif |
| 178 |
|
| 179 |
/*****************************************************************************/ |
| 180 |
|
| 181 |
// This is not really a switch, but rather a shorthand for determining whether |
| 182 |
// or not we're building a particular translation unit (source file) using the |
| 183 |
// Intel Compiler. |
| 184 |
|
| 185 |
#ifndef qDNGIntelCompiler |
| 186 |
#if defined(__INTEL_COMPILER) |
| 187 |
#define qDNGIntelCompiler (__INTEL_COMPILER >= 1700) |
| 188 |
#elif defined(__INTEL_LLVM_COMPILER) |
| 189 |
#define qDNGIntelCompiler __INTEL_LLVM_COMPILER |
| 190 |
#else |
| 191 |
#define qDNGIntelCompiler 0 |
| 192 |
#endif |
| 193 |
#endif |
| 194 |
|
| 195 |
/*****************************************************************************/ |
| 196 |
|
| 197 |
// Figure out byte order. |
| 198 |
|
| 199 |
/// \def qDNGBigEndian |
| 200 |
/// 1 if this target platform is big endian (e.g. PowerPC Macintosh), else 0. |
| 201 |
/// |
| 202 |
/// \def qDNGLittleEndian |
| 203 |
/// 1 if this target platform is little endian (e.g. x86 processors), else 0. |
| 204 |
|
| 205 |
#ifndef qDNGBigEndian |
| 206 |
|
| 207 |
#if defined(qDNGLittleEndian) |
| 208 |
#define qDNGBigEndian !qDNGLittleEndian |
| 209 |
|
| 210 |
#elif defined(__POWERPC__) |
| 211 |
#define qDNGBigEndian 1 |
| 212 |
|
| 213 |
#elif defined(__INTEL__) |
| 214 |
#define qDNGBigEndian 0 |
| 215 |
|
| 216 |
#elif defined(_M_IX86) |
| 217 |
#define qDNGBigEndian 0 |
| 218 |
|
| 219 |
#elif defined(_M_X64) || defined(__amd64__) |
| 220 |
#define qDNGBigEndian 0 |
| 221 |
|
| 222 |
#elif defined(__LITTLE_ENDIAN__) |
| 223 |
#define qDNGBigEndian 0 |
| 224 |
|
| 225 |
#elif defined(__BIG_ENDIAN__) |
| 226 |
#define qDNGBigEndian 1 |
| 227 |
|
| 228 |
#elif defined(_ARM_) || defined(__ARM_NEON) || defined(__mips__) |
| 229 |
#define qDNGBigEndian 0 |
| 230 |
|
| 231 |
#elif defined(_M_ARM64) |
| 232 |
// See https://docs.microsoft.com/en-us/cpp/build/arm64-windows-abi-conventions?view=vs-2019 |
| 233 |
#define qDNGBigEndian 0 |
| 234 |
|
| 235 |
#else |
| 236 |
|
| 237 |
#ifndef qXCodeRez |
| 238 |
#error Unable to figure out byte order. |
| 239 |
#endif |
| 240 |
|
| 241 |
#endif |
| 242 |
#endif |
| 243 |
|
| 244 |
#ifndef qXCodeRez |
| 245 |
|
| 246 |
#ifndef qDNGLittleEndian |
| 247 |
#define qDNGLittleEndian !qDNGBigEndian |
| 248 |
#endif |
| 249 |
|
| 250 |
#endif |
| 251 |
|
| 252 |
/*****************************************************************************/ |
| 253 |
|
| 254 |
/// \def qDNG64Bit |
| 255 |
/// 1 if this target platform uses 64-bit addresses, 0 otherwise. |
| 256 |
|
| 257 |
#ifndef qDNG64Bit |
| 258 |
|
| 259 |
#if qMacOS |
| 260 |
|
| 261 |
#ifdef __LP64__ |
| 262 |
#if __LP64__ |
| 263 |
#define qDNG64Bit 1 |
| 264 |
#endif |
| 265 |
#endif |
| 266 |
|
| 267 |
#elif qWinOS |
| 268 |
|
| 269 |
#ifdef WIN64 |
| 270 |
#if WIN64 |
| 271 |
#define qDNG64Bit 1 |
| 272 |
#endif |
| 273 |
#endif |
| 274 |
|
| 275 |
#elif qLinux |
| 276 |
|
| 277 |
#ifdef __LP64__ |
| 278 |
#if __LP64__ |
| 279 |
#define qDNG64Bit 1 |
| 280 |
#endif |
| 281 |
#endif |
| 282 |
|
| 283 |
#elif qAndroid |
| 284 |
|
| 285 |
#ifdef __LP64__ |
| 286 |
#if __LP64__ |
| 287 |
#define qDNG64Bit 1 |
| 288 |
#endif |
| 289 |
#endif |
| 290 |
|
| 291 |
#endif |
| 292 |
|
| 293 |
#ifndef qDNG64Bit |
| 294 |
#ifdef qXCodeRez |
| 295 |
#define qDNG64Bit qXCodeRez |
| 296 |
#else |
| 297 |
#define qDNG64Bit 0 |
| 298 |
#endif |
| 299 |
#endif |
| 300 |
|
| 301 |
#endif |
| 302 |
|
| 303 |
/*****************************************************************************/ |
| 304 |
|
| 305 |
#ifdef __cplusplus |
| 306 |
#if defined(__clang__) && !defined(__INTEL_LLVM_COMPILER) |
| 307 |
#define DNG_RESTRICT __restrict |
| 308 |
#elif defined(qWinOS) && !defined(__INTEL_LLVM_COMPILER) |
| 309 |
#define DNG_RESTRICT __restrict |
| 310 |
#else |
| 311 |
#define DNG_RESTRICT |
| 312 |
#endif |
| 313 |
#endif /* __cplusplus */ |
| 314 |
|
| 315 |
/*****************************************************************************/ |
| 316 |
|
| 317 |
#ifdef __cplusplus |
| 318 |
#if defined(__clang__) && !defined(__INTEL_LLVM_COMPILER) |
| 319 |
#define DNG_ALWAYS_INLINE __attribute((__always_inline__)) inline |
| 320 |
#else |
| 321 |
#define DNG_ALWAYS_INLINE inline |
| 322 |
#endif |
| 323 |
#endif /* __cplusplus */ |
| 324 |
|
| 325 |
/*****************************************************************************/ |
| 326 |
|
| 327 |
/// \def qDNGThreadSafe |
| 328 |
/// 1 if target platform has thread support and threadsafe libraries, 0 otherwise. |
| 329 |
|
| 330 |
#ifndef qDNGThreadSafe |
| 331 |
#define qDNGThreadSafe (qMacOS || qWinOS) |
| 332 |
#endif |
| 333 |
|
| 334 |
/*****************************************************************************/ |
| 335 |
|
| 336 |
/// \def qDNGValidateTarget |
| 337 |
/// 1 if dng_validate command line tool is being built, 0 otherwise. |
| 338 |
|
| 339 |
#ifndef qDNGValidateTarget |
| 340 |
#define qDNGValidateTarget 0 |
| 341 |
#endif |
| 342 |
|
| 343 |
/*****************************************************************************/ |
| 344 |
|
| 345 |
/// \def qDNGValidate |
| 346 |
/// 1 if DNG validation code is enabled, 0 otherwise. |
| 347 |
|
| 348 |
#ifndef qDNGValidate |
| 349 |
#define qDNGValidate qDNGValidateTarget |
| 350 |
#endif |
| 351 |
|
| 352 |
/*****************************************************************************/ |
| 353 |
|
| 354 |
/// \def qDNGPrintMessages |
| 355 |
/// 1 if dng_show_message should use fprintf to stderr. 0 if it should use a platform |
| 356 |
/// specific interrupt mechanism. |
| 357 |
|
| 358 |
#ifndef qDNGPrintMessages |
| 359 |
#define qDNGPrintMessages qDNGValidate |
| 360 |
#endif |
| 361 |
|
| 362 |
/*****************************************************************************/ |
| 363 |
|
| 364 |
// Experimental features -- work in progress for Lightroom and Camera Raw |
| 365 |
// major releases. Turn this off for Lightroom & Camera Raw dot releases. |
| 366 |
|
| 367 |
#ifndef qDNGExperimental |
| 368 |
#define qDNGExperimental 1 |
| 369 |
#endif |
| 370 |
|
| 371 |
/*****************************************************************************/ |
| 372 |
|
| 373 |
/// \def qDNGXMPFiles |
| 374 |
/// 1 to use XMPFiles. |
| 375 |
|
| 376 |
#ifndef qDNGXMPFiles |
| 377 |
#define qDNGXMPFiles 1 |
| 378 |
#endif |
| 379 |
|
| 380 |
/*****************************************************************************/ |
| 381 |
|
| 382 |
/// \def qDNGXMPDocOps |
| 383 |
/// 1 to use XMPDocOps. |
| 384 |
|
| 385 |
#ifndef qDNGXMPDocOps |
| 386 |
#define qDNGXMPDocOps (!qDNGValidateTarget) |
| 387 |
#endif |
| 388 |
|
| 389 |
/*****************************************************************************/ |
| 390 |
|
| 391 |
/// \def qDNGUseLibJPEG |
| 392 |
/// 1 to use open-source libjpeg for lossy jpeg processing. |
| 393 |
|
| 394 |
#ifndef qDNGUseLibJPEG |
| 395 |
#define qDNGUseLibJPEG qDNGValidateTarget |
| 396 |
#endif |
| 397 |
|
| 398 |
/*****************************************************************************/ |
| 399 |
|
| 400 |
#ifndef qDNGAVXSupport |
| 401 |
#define qDNGAVXSupport ((qMacOS || qWinOS) && qDNG64Bit && !qARM && 1) |
| 402 |
#endif |
| 403 |
|
| 404 |
#if qDNGAVXSupport && !(qDNG64Bit && !qARM) |
| 405 |
#error AVX support is enabled when 64-bit support is not or ARM is |
| 406 |
#endif |
| 407 |
|
| 408 |
/*****************************************************************************/ |
| 409 |
|
| 410 |
#ifndef qDNGSupportVC5 |
| 411 |
#define qDNGSupportVC5 (1) |
| 412 |
#endif |
| 413 |
|
| 414 |
/*****************************************************************************/ |
| 415 |
|
| 416 |
/// \def qDNGUsingSanitizer |
| 417 |
/// Set to 1 when using a Sanitizer tool. |
| 418 |
|
| 419 |
#ifndef qDNGUsingSanitizer |
| 420 |
#define qDNGUsingSanitizer (0) |
| 421 |
#endif |
| 422 |
|
| 423 |
/*****************************************************************************/ |
| 424 |
|
| 425 |
#ifndef DNG_ATTRIB_NO_SANITIZE |
| 426 |
#if qDNGUsingSanitizer && defined(__clang__) |
| 427 |
#define DNG_ATTRIB_NO_SANITIZE(type) __attribute__((no_sanitize(type))) |
| 428 |
#else |
| 429 |
#define DNG_ATTRIB_NO_SANITIZE(type) |
| 430 |
#endif |
| 431 |
#endif |
| 432 |
|
| 433 |
/*****************************************************************************/ |
| 434 |
|
| 435 |
// Big image support? |
| 436 |
// |
| 437 |
// When set to true: |
| 438 |
// - maximum linear image dimensions is 300000 pixels |
| 439 |
// - maximum total number of pixels is 10 gigapixels (10 * 1000 * 1000 * 1000 pixels) |
| 440 |
// |
| 441 |
// When set to false: |
| 442 |
// - maximum linear image dimensions is 65000 pixels |
| 443 |
// - maximum total number of pixels is 512 megapixels (512 * 1024 * 1024 pixels) |
| 444 |
|
| 445 |
#ifndef qDNGBigImage |
| 446 |
#define qDNGBigImage (qDNGExperimental && 1) |
| 447 |
#endif |
| 448 |
|
| 449 |
/*****************************************************************************/ |
| 450 |
|
| 451 |
// Enable XMP support in the DNG SDK? |
| 452 |
|
| 453 |
#ifndef qDNGUseXMP |
| 454 |
#define qDNGUseXMP 1 |
| 455 |
#endif |
| 456 |
|
| 457 |
/*****************************************************************************/ |
| 458 |
|
| 459 |
// Use custom integral types? |
| 460 |
|
| 461 |
#ifndef qDNGUseCustomIntegralTypes |
| 462 |
#define qDNGUseCustomIntegralTypes 0 |
| 463 |
#endif |
| 464 |
|
| 465 |
/*****************************************************************************/ |
| 466 |
|
| 467 |
// Place deprecated flags into this file. |
| 468 |
|
| 469 |
#include "dng_deprecated_flags.h" |
| 470 |
|
| 471 |
/*****************************************************************************/ |
| 472 |
|
| 473 |
#endif |
| 474 |
|
| 475 |
/*****************************************************************************/ |