| OLD | NEW |
| (Empty) |
| 1 # Copyright 2014 PDFium Authors. All rights reserved. | |
| 2 # Use of this source code is governed by a BSD-style license that can be | |
| 3 # found in the LICENSE file. | |
| 4 | |
| 5 # Definitions to be used when building stand-alone PDFium binaries. | |
| 6 | |
| 7 { | |
| 8 'variables': { | |
| 9 'component%': 'static_library', | |
| 10 'clang%': 0, | |
| 11 'asan%': 0, | |
| 12 'sanitizer_coverage%': 0, | |
| 13 'use_goma%': 0, | |
| 14 'gomadir%': '', | |
| 15 'msvs_multi_core_compile%': '1', | |
| 16 'pdf_enable_xfa%': 1, | |
| 17 'variables': { | |
| 18 'variables': { | |
| 19 'variables': { | |
| 20 'conditions': [ | |
| 21 ['OS=="linux" or OS=="mac"', { | |
| 22 # This handles the Unix platforms we generally deal with. | |
| 23 # Anything else gets passed through, which probably won't work | |
| 24 # very well; such hosts should pass an explicit target_arch | |
| 25 # to gyp. | |
| 26 'host_arch%': | |
| 27 '<!(uname -m | sed -e "s/i.86/ia32/;\ | |
| 28 s/x86_64/x64/;\ | |
| 29 s/amd64/x64/;\ | |
| 30 s/arm.*/arm/;\ | |
| 31 s/aarch64/arm64/;\ | |
| 32 s/mips.*/mipsel/")', | |
| 33 }, { | |
| 34 # OS!="linux" and OS!="mac" | |
| 35 'host_arch%': 'ia32', | |
| 36 }], | |
| 37 ], | |
| 38 }, | |
| 39 'host_arch%': '<(host_arch)', | |
| 40 'target_arch%': '<(host_arch)', | |
| 41 }, | |
| 42 'host_arch%': '<(host_arch)', | |
| 43 'target_arch%': '<(target_arch)', | |
| 44 }, | |
| 45 'clang_dir%': 'third_party/llvm-build/Release+Asserts', | |
| 46 # These two are needed by V8. | |
| 47 'host_arch%': '<(host_arch)', | |
| 48 'target_arch%': '<(target_arch)', | |
| 49 'werror%': '-Werror', | |
| 50 'v8_optimized_debug%': 0, | |
| 51 'v8_use_external_startup_data%': 0, | |
| 52 'icu_gyp_path': '../v8/third_party/icu/icu.gyp', | |
| 53 'libjpeg_gyp_path': '../third_party/third_party.gyp', | |
| 54 'conditions': [ | |
| 55 ['OS == "win"', { | |
| 56 'os_posix%': 0, | |
| 57 }, { | |
| 58 'os_posix%': 1, | |
| 59 }], | |
| 60 ['OS=="linux" or OS=="mac"', { | |
| 61 'clang%': 1, | |
| 62 'host_clang%': 1, | |
| 63 }, { | |
| 64 'clang%': 0, | |
| 65 'host_clang%': 0, | |
| 66 }], | |
| 67 # Set default gomadir. | |
| 68 ['OS=="win"', { | |
| 69 'gomadir%': 'c:\\goma\\goma-win', | |
| 70 }, { | |
| 71 'gomadir%': '<!(/bin/echo -n ${HOME}/goma)', | |
| 72 }], | |
| 73 ], | |
| 74 }, | |
| 75 'target_defaults': { | |
| 76 'default_configuration': 'Debug', | |
| 77 'configurations': { | |
| 78 'Debug': { | |
| 79 'cflags': [ | |
| 80 '-g', | |
| 81 '-O0', | |
| 82 '-fdata-sections', | |
| 83 '-ffunction-sections', | |
| 84 ], | |
| 85 'defines': ['_DEBUG'], | |
| 86 'msvs_settings': { | |
| 87 'VCCLCompilerTool': { | |
| 88 'Optimization': '0', | |
| 89 'conditions': [ | |
| 90 ['component=="shared_library"', { | |
| 91 'RuntimeLibrary': '3', # /MDd | |
| 92 }, { | |
| 93 'RuntimeLibrary': '1', # /MTd | |
| 94 }], | |
| 95 ], | |
| 96 }, | |
| 97 'VCLinkerTool': { | |
| 98 'LinkIncremental': '2', | |
| 99 }, | |
| 100 }, | |
| 101 'xcode_settings': { | |
| 102 'GCC_OPTIMIZATION_LEVEL': '0', # -O0 | |
| 103 }, | |
| 104 'conditions': [ | |
| 105 ['OS=="linux"', { | |
| 106 # Enable libstdc++ debugging to help catch problems early. | |
| 107 'defines': ['_GLIBCXX_DEBUG=1',], | |
| 108 }], | |
| 109 ], | |
| 110 }, | |
| 111 'Release': { | |
| 112 'cflags': [ | |
| 113 '-fno-strict-aliasing', | |
| 114 ], | |
| 115 'defines': ['NDEBUG'], | |
| 116 'xcode_settings': { | |
| 117 'GCC_OPTIMIZATION_LEVEL': '3', # -O3 | |
| 118 'GCC_STRICT_ALIASING': 'NO', | |
| 119 }, | |
| 120 'msvs_settings': { | |
| 121 'VCCLCompilerTool': { | |
| 122 'Optimization': '2', | |
| 123 'InlineFunctionExpansion': '2', | |
| 124 'EnableIntrinsicFunctions': 'true', | |
| 125 'FavorSizeOrSpeed': '0', | |
| 126 'StringPooling': 'true', | |
| 127 'conditions': [ | |
| 128 ['component=="shared_library"', { | |
| 129 'RuntimeLibrary': '2', #/MD | |
| 130 }, { | |
| 131 'RuntimeLibrary': '0', #/MT | |
| 132 }], | |
| 133 ], | |
| 134 }, | |
| 135 'VCLinkerTool': { | |
| 136 'LinkIncremental': '1', | |
| 137 'OptimizeReferences': '2', | |
| 138 'EnableCOMDATFolding': '2', | |
| 139 }, | |
| 140 }, | |
| 141 'conditions': [ | |
| 142 ['OS=="linux"', { | |
| 143 'cflags': [ | |
| 144 '-fdata-sections', | |
| 145 '-ffunction-sections', | |
| 146 '-O3', | |
| 147 '-O2', | |
| 148 ], | |
| 149 }], | |
| 150 ['OS=="android"', { | |
| 151 'cflags!': [ | |
| 152 '-O3', | |
| 153 '-Os', | |
| 154 ], | |
| 155 'cflags': [ | |
| 156 '-fdata-sections', | |
| 157 '-ffunction-sections', | |
| 158 '-O2', | |
| 159 ], | |
| 160 }], | |
| 161 ], # conditions | |
| 162 }, | |
| 163 'Debug_x64': { | |
| 164 'inherit_from': ['Debug'], | |
| 165 'msvs_configuration_platform': 'x64', | |
| 166 }, | |
| 167 'Release_x64': { | |
| 168 'inherit_from': ['Release'], | |
| 169 'msvs_configuration_platform': 'x64', | |
| 170 }, | |
| 171 }, | |
| 172 'cflags': [ | |
| 173 '-Wall', | |
| 174 '-Werror', | |
| 175 '-W', | |
| 176 '-Wno-missing-field-initializers', | |
| 177 # Code might someday be made clean for -Wsign-compare, but for now | |
| 178 # this produces too much noise to be useful. | |
| 179 '-Wno-sign-compare', | |
| 180 '-Wno-unused-parameter', | |
| 181 '-pthread', | |
| 182 '-fno-exceptions', | |
| 183 '-fvisibility=hidden', | |
| 184 ], | |
| 185 'cflags_cc': [ | |
| 186 '-std=c++11', | |
| 187 # Add back when ICU is clean | |
| 188 # '-Wnon-virtual-dtor', | |
| 189 '-fno-rtti', | |
| 190 ], | |
| 191 'ldflags': [ | |
| 192 '-pthread', | |
| 193 ], | |
| 194 'defines': [ | |
| 195 # Don't use deprecated V8 APIs anywhere. | |
| 196 'V8_DEPRECATION_WARNINGS', | |
| 197 ], | |
| 198 'msvs_cygwin_dirs': ['<(DEPTH)/v8/third_party/cygwin'], | |
| 199 'msvs_configuration_attributes': { | |
| 200 'OutputDirectory': '<(DEPTH)\\build\\$(ConfigurationName)', | |
| 201 'IntermediateDirectory': '$(OutDir)\\obj\\$(ProjectName)', | |
| 202 'CharacterSet': '1', | |
| 203 }, | |
| 204 'msvs_disabled_warnings': [ | |
| 205 # #### | |
| 206 # This section is PDFium specific. | |
| 207 # #### | |
| 208 | |
| 209 # C4800: forcing value to bool 'true' or 'false' (performance warning) | |
| 210 4800, | |
| 211 | |
| 212 # #### | |
| 213 # This section should match Chromium's build/common.gypi. | |
| 214 # #### | |
| 215 | |
| 216 # C4091: 'typedef ': ignored on left of 'X' when no variable is | |
| 217 # declared. | |
| 218 # This happens in a number of Windows headers. Dumb. | |
| 219 4091, | |
| 220 | |
| 221 # C4127: conditional expression is constant | |
| 222 # This warning can in theory catch dead code and other problems, but | |
| 223 # triggers in far too many desirable cases where the conditional | |
| 224 # expression is either set by macros or corresponds some legitimate | |
| 225 # compile-time constant expression (due to constant template args, | |
| 226 # conditionals comparing the sizes of different types, etc.). Some of | |
| 227 # these can be worked around, but it's not worth it. | |
| 228 4127, | |
| 229 | |
| 230 # C4351: new behavior: elements of array 'array' will be default | |
| 231 # initialized | |
| 232 # This is a silly "warning" that basically just alerts you that the | |
| 233 # compiler is going to actually follow the language spec like it's | |
| 234 # supposed to, instead of not following it like old buggy versions | |
| 235 # did. There's absolutely no reason to turn this on. | |
| 236 4351, | |
| 237 | |
| 238 # C4355: 'this': used in base member initializer list | |
| 239 # It's commonly useful to pass |this| to objects in a class' | |
| 240 # initializer list. While this warning can catch real bugs, most of | |
| 241 # the time the constructors in question don't attempt to call methods | |
| 242 # on the passed-in pointer (until later), and annotating every legit | |
| 243 # usage of this is simply more hassle than the warning is worth. | |
| 244 4355, | |
| 245 | |
| 246 # C4503: 'identifier': decorated name length exceeded, name was | |
| 247 # truncated | |
| 248 # This only means that some long error messages might have truncated | |
| 249 # identifiers in the presence of lots of templates. It has no effect | |
| 250 # on program correctness and there's no real reason to waste time | |
| 251 # trying to prevent it. | |
| 252 4503, | |
| 253 | |
| 254 # Warning C4589 says: "Constructor of abstract class ignores | |
| 255 # initializer for virtual base class." Disable this warning because it | |
| 256 # is flaky in VS 2015 RTM. It triggers on compiler generated | |
| 257 # copy-constructors in some cases. | |
| 258 4589, | |
| 259 | |
| 260 # C4611: interaction between 'function' and C++ object destruction is | |
| 261 # non-portable | |
| 262 # This warning is unavoidable when using e.g. setjmp/longjmp. MSDN | |
| 263 # suggests using exceptions instead of setjmp/longjmp for C++, but | |
| 264 # Chromium code compiles without exception support. We therefore have | |
| 265 # to use setjmp/longjmp for e.g. JPEG decode error handling, which | |
| 266 # means we have to turn off this warning (and be careful about how | |
| 267 # object destruction happens in such cases). | |
| 268 4611, | |
| 269 | |
| 270 # TODO(thestig): These warnings are level 4. They will be slowly | |
| 271 # removed as code is fixed. | |
| 272 4100, # Unreferenced formal parameter | |
| 273 4121, # Alignment of a member was sensitive to packing | |
| 274 4244, # Conversion from 'type1' to 'type2', possible loss of data | |
| 275 4505, # Unreferenced local function has been removed | |
| 276 4510, # Default constructor could not be generated | |
| 277 4512, # Assignment operator could not be generated | |
| 278 4610, # Object can never be instantiated | |
| 279 4838, # Narrowing conversion. Doesn't seem to be very useful. | |
| 280 4995, # 'X': name was marked as #pragma deprecated | |
| 281 4996, # 'X': was declared deprecated (for GetVersionEx). | |
| 282 | |
| 283 # These are variable shadowing warnings that are new in VS2015. We | |
| 284 # should work through these at some point -- they may be removed from | |
| 285 # the RTM release in the /W4 set. | |
| 286 4456, 4457, 4458, 4459, | |
| 287 | |
| 288 # TODO(brucedawson): http://crbug.com/554200 4312 is a VS | |
| 289 # 2015 64-bit warning for integer to larger pointer | |
| 290 4312, | |
| 291 | |
| 292 # #### | |
| 293 # Do not add PDFium specific entries here. Add them to the top. | |
| 294 # #### | |
| 295 ], | |
| 296 'msvs_settings': { | |
| 297 'VCCLCompilerTool': { | |
| 298 'MinimalRebuild': 'false', | |
| 299 'BufferSecurityCheck': 'true', | |
| 300 'EnableFunctionLevelLinking': 'true', | |
| 301 'RuntimeTypeInfo': 'false', | |
| 302 'WarningLevel': '3', | |
| 303 'DebugInformationFormat': '3', | |
| 304 'Detect64BitPortabilityProblems': 'false', | |
| 305 'conditions': [ | |
| 306 [ 'msvs_multi_core_compile', { | |
| 307 'AdditionalOptions': ['/MP'], | |
| 308 }], | |
| 309 ['component=="shared_library"', { | |
| 310 'ExceptionHandling': '1', # /EHsc | |
| 311 }, { | |
| 312 'ExceptionHandling': '0', | |
| 313 }], | |
| 314 ['target_arch=="x64"', { | |
| 315 # 64-bit warnings need to be resolved. | |
| 316 # https://code.google.com/p/pdfium/issues/detail?id=101 | |
| 317 'WarnAsError': 'false', | |
| 318 }, { | |
| 319 'WarnAsError': 'true', | |
| 320 }], | |
| 321 ['clang==1', { | |
| 322 'AdditionalOptions': [ | |
| 323 # Don't warn about unused function parameters. | |
| 324 # (This is also used on other platforms.) | |
| 325 '-Wno-unused-parameter', | |
| 326 # Don't warn about the "struct foo f = {0};" initialization | |
| 327 # pattern. | |
| 328 '-Wno-missing-field-initializers', | |
| 329 | |
| 330 # Many files use intrinsics without including this header. | |
| 331 # TODO(hans): Fix those files, or move this to sub-GYPs. | |
| 332 '/FIIntrin.h', | |
| 333 | |
| 334 # TODO(hans): Make this list shorter eventually, http://crbug.com/
504657 | |
| 335 '-Qunused-arguments', # http://crbug.com/504658 | |
| 336 '-Wno-microsoft-enum-value', # http://crbug.com/505296 | |
| 337 '-Wno-unknown-pragmas', # http://crbug.com/505314 | |
| 338 '-Wno-microsoft-cast', # http://crbug.com/550065 | |
| 339 ], | |
| 340 }], | |
| 341 ['OS=="win" and clang==1 and MSVS_VERSION == "2013"', { | |
| 342 'VCCLCompilerTool': { | |
| 343 'AdditionalOptions': [ | |
| 344 '-fmsc-version=1800', | |
| 345 ], | |
| 346 }, | |
| 347 }], | |
| 348 ['OS=="win" and clang==1 and MSVS_VERSION == "2015"', { | |
| 349 'VCCLCompilerTool': { | |
| 350 'AdditionalOptions': [ | |
| 351 '-fmsc-version=1900', | |
| 352 ], | |
| 353 }, | |
| 354 }], | |
| 355 ], | |
| 356 }, | |
| 357 'VCLibrarianTool': { | |
| 358 'AdditionalOptions': ['/ignore:4221'], | |
| 359 }, | |
| 360 'VCLinkerTool': { | |
| 361 'GenerateDebugInformation': 'true', | |
| 362 'LinkIncremental': '1', | |
| 363 # SubSystem values: | |
| 364 # 0 == not set | |
| 365 # 1 == /SUBSYSTEM:CONSOLE | |
| 366 # 2 == /SUBSYSTEM:WINDOWS | |
| 367 'SubSystem': '1', | |
| 368 }, | |
| 369 }, | |
| 370 'xcode_settings': { | |
| 371 'ALWAYS_SEARCH_USER_PATHS': 'NO', | |
| 372 'CLANG_CXX_LANGUAGE_STANDARD': 'c++11', | |
| 373 'GCC_CW_ASM_SYNTAX': 'NO', # No -fasm-blocks | |
| 374 'GCC_DYNAMIC_NO_PIC': 'NO', # No -mdynamic-no-pic | |
| 375 # (Equivalent to -fPIC) | |
| 376 'GCC_ENABLE_CPP_EXCEPTIONS': 'NO', # -fno-exceptions | |
| 377 'GCC_ENABLE_CPP_RTTI': 'NO', # -fno-rtti | |
| 378 'GCC_ENABLE_PASCAL_STRINGS': 'NO', # No -mpascal-strings | |
| 379 # GCC_INLINES_ARE_PRIVATE_EXTERN maps to -fvisibility-inlines-hidden | |
| 380 'GCC_INLINES_ARE_PRIVATE_EXTERN': 'YES', | |
| 381 'GCC_SYMBOLS_PRIVATE_EXTERN': 'YES', # -fvisibility=hidden | |
| 382 'GCC_TREAT_WARNINGS_AS_ERRORS': 'NO', # -Werror | |
| 383 'GCC_WARN_NON_VIRTUAL_DESTRUCTOR': 'YES', # -Wnon-virtual-dtor | |
| 384 'SYMROOT': '<(DEPTH)/xcodebuild', | |
| 385 'USE_HEADERMAP': 'NO', | |
| 386 'OTHER_CFLAGS': [ | |
| 387 '-fno-strict-aliasing', | |
| 388 ], | |
| 389 'WARNING_CFLAGS': [ | |
| 390 '-Wall', | |
| 391 '-Wendif-labels', | |
| 392 '-W', | |
| 393 '-Wno-unused-parameter', | |
| 394 ], | |
| 395 }, | |
| 396 'variables': { | |
| 397 'clang_warning_flags': [], | |
| 398 }, | |
| 399 'includes': [ 'set_clang_warning_flags.gypi', ], | |
| 400 'conditions': [ | |
| 401 ['component=="shared_library"', { | |
| 402 'cflags': [ | |
| 403 '-fPIC', | |
| 404 ], | |
| 405 }], | |
| 406 ['asan==1', { | |
| 407 'defines': [ | |
| 408 'ADDRESS_SANITIZER', | |
| 409 'LEAK_SANITIZER', | |
| 410 ], | |
| 411 'cflags': [ | |
| 412 '-fsanitize=address', | |
| 413 '-gline-tables-only', | |
| 414 ], | |
| 415 'ldflags': [ | |
| 416 '-fsanitize=address', | |
| 417 ], | |
| 418 }], | |
| 419 ['sanitizer_coverage!=0', { | |
| 420 'cflags': [ | |
| 421 '-fsanitize-coverage=<(sanitizer_coverage)', | |
| 422 ], | |
| 423 }], | |
| 424 ['OS=="win"', { | |
| 425 'defines': [ | |
| 426 'NOMINMAX', | |
| 427 '_CRT_SECURE_NO_DEPRECATE', | |
| 428 '_CRT_NONSTDC_NO_DEPRECATE', | |
| 429 ], | |
| 430 'conditions': [ | |
| 431 ['component=="static_library"', { | |
| 432 'defines': [ | |
| 433 '_HAS_EXCEPTIONS=0', | |
| 434 ], | |
| 435 }], | |
| 436 ['use_goma==1', { | |
| 437 # goma doesn't support PDB yet. | |
| 438 'msvs_settings': { | |
| 439 'VCLinkerTool': { | |
| 440 'GenerateDebugInformation': 'true', | |
| 441 }, | |
| 442 'VCCLCompilerTool': { | |
| 443 'DebugInformationFormat': '1', | |
| 444 }, | |
| 445 }, | |
| 446 }], | |
| 447 ], | |
| 448 }], # OS=="win" | |
| 449 ['OS=="mac"', { | |
| 450 'target_conditions': [ | |
| 451 ['_type!="static_library"', { | |
| 452 'xcode_settings': {'OTHER_LDFLAGS': ['-Wl,-search_paths_first']}, | |
| 453 }], | |
| 454 ], # target_conditions | |
| 455 'variables': { | |
| 456 'mac_sdk_min': '10.10', | |
| 457 'mac_sdk%': '<!(python <(DEPTH)/build/mac_find_sdk.py <(mac_sdk_min))'
, | |
| 458 }, | |
| 459 'xcode_settings': { | |
| 460 'SDKROOT': 'macosx<(mac_sdk)', # -isysroot | |
| 461 # See comment in Chromium's common.gypi for why this is needed. | |
| 462 'SYMROOT': '<(DEPTH)/xcodebuild', | |
| 463 }, | |
| 464 }], # OS=="mac" | |
| 465 ['v8_use_external_startup_data==1', { | |
| 466 'defines': [ | |
| 467 'V8_USE_EXTERNAL_STARTUP_DATA', | |
| 468 ], | |
| 469 }], # v8_use_external_startup_data==1 | |
| 470 ['clang==1 or host_clang==1', { | |
| 471 # This is here so that all files get recompiled after a clang roll and | |
| 472 # when turning clang on or off. | |
| 473 # (defines are passed via the command line, and build systems rebuild | |
| 474 # things when their commandline changes). Nothing should ever read this | |
| 475 # define. | |
| 476 'defines': ['CR_CLANG_REVISION=<!(python <(DEPTH)/tools/clang/scripts/up
date.py --print-revision)'], | |
| 477 }], | |
| 478 ], | |
| 479 }, | |
| 480 'conditions': [ | |
| 481 ['OS=="linux" or OS=="mac"', { | |
| 482 'conditions': [ | |
| 483 ['clang==1', { | |
| 484 'make_global_settings': [ | |
| 485 ['CC', '<(clang_dir)/bin/clang'], | |
| 486 ['CXX', '<(clang_dir)/bin/clang++'], | |
| 487 ], | |
| 488 }], | |
| 489 ], | |
| 490 }], # OS=="linux" or OS=="mac" | |
| 491 ['OS=="win"', { | |
| 492 'conditions': [ | |
| 493 ['clang==1', { | |
| 494 'make_global_settings': [ | |
| 495 ['CC', '<(clang_dir)/bin/clang-cl'], | |
| 496 ], | |
| 497 }], | |
| 498 ], | |
| 499 }], # OS=="win" | |
| 500 ["use_goma==1", { | |
| 501 'make_global_settings': [ | |
| 502 ['CC_wrapper', '<(gomadir)/gomacc'], | |
| 503 ['CXX_wrapper', '<(gomadir)/gomacc'], | |
| 504 ], | |
| 505 }], # use_goma==1 | |
| 506 ], | |
| 507 } | |
| OLD | NEW |