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