1 # Copyright 2012 the V8 project authors. All rights reserved.
2 # Redistribution and use in source and binary forms, with or without
3 # modification, are permitted provided that the following conditions are
6 # * Redistributions of source code must retain the above copyright
7 # notice, this list of conditions and the following disclaimer.
8 # * Redistributions in binary form must reproduce the above
9 # copyright notice, this list of conditions and the following
10 # disclaimer in the documentation and/or other materials provided
11 # with the distribution.
12 # * Neither the name of Google Inc. nor the names of its
13 # contributors may be used to endorse or promote products derived
14 # from this software without specific prior written permission.
16 # THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
17 # "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
18 # LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
19 # A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
20 # OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
21 # SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
22 # LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
23 # DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
24 # THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
25 # (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
26 # OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
28 # Definitions to be used when building stand-alone V8 binaries.
31 # We need to include toolchain.gypi here for third-party sources that don't
32 # directly include it themselves.
33 'includes': ['toolchain.gypi'],
35 'component%': 'static_library',
36 'clang_dir%': 'third_party/llvm-build/Release+Asserts',
38 'visibility%': 'hidden',
39 'v8_enable_backtrace%': 0,
40 'v8_enable_i18n_support%': 1,
41 'v8_deprecation_warnings': 1,
42 'msvs_multi_core_compile%': '1',
43 'mac_deployment_target%': '10.5',
48 ['OS=="linux" or OS=="freebsd" or OS=="openbsd" or \
49 OS=="netbsd" or OS=="mac" or OS=="qnx" or OS=="aix"', {
50 # This handles the Unix platforms we generally deal with.
51 # Anything else gets passed through, which probably won't work
52 # very well; such hosts should pass an explicit target_arch
54 'host_arch%': '<!pymod_do_main(detect_v8_host_arch)',
56 # OS!="linux" and OS!="freebsd" and OS!="openbsd" and
57 # OS!="netbsd" and OS!="mac" and OS!="aix"
62 'host_arch%': '<(host_arch)',
63 'target_arch%': '<(host_arch)',
65 'host_arch%': '<(host_arch)',
66 'target_arch%': '<(target_arch)',
67 'v8_target_arch%': '<(target_arch)',
71 # If no gomadir is set, it uses the default gomadir.
75 # Set default gomadir.
77 'gomadir': 'c:\\goma\\goma-win',
79 'gomadir': '<!(/bin/echo -n ${HOME}/goma)',
83 'host_arch%': '<(host_arch)',
84 'target_arch%': '<(target_arch)',
85 'v8_target_arch%': '<(v8_target_arch)',
87 'use_goma%': '<(use_goma)',
88 'gomadir%': '<(gomadir)',
90 # .gyp files or targets should set v8_code to 1 if they build V8 specific
91 # code, as opposed to external code. This variable is used to control such
92 # things as the set of warnings to enable, and whether warnings are treated
96 # Speeds up Debug builds:
97 # 0 - Compiler optimizations off (debuggable) (default). This may
98 # be 5x slower than Release (or worse).
99 # 1 - Turn on optimizations and disable slow DCHECKs, but leave
100 # V8_ENABLE_CHECKS and most other assertions enabled. This may cause
101 # some v8 tests to fail in the Debug configuration. This roughly
102 # matches the performance of a Release build and can be used by
103 # embedders that need to build their own code as debug but don't want
104 # or need a debug version of V8. This should produce near-release
106 'v8_optimized_debug%': 0,
108 # Use external files for startup data blobs:
109 # the JS builtins sources and the start snapshot.
110 # Embedders that don't use standalone.gypi will need to add
111 # their own default value.
112 'v8_use_external_startup_data%': 0,
114 # Relative path to icu.gyp from this file.
115 'icu_gyp_path': '../third_party/icu/icu.gyp',
118 ['(v8_target_arch=="arm" and host_arch!="arm") or \
119 (v8_target_arch=="arm64" and host_arch!="arm64") or \
120 (v8_target_arch=="mipsel" and host_arch!="mipsel") or \
121 (v8_target_arch=="mips64el" and host_arch!="mips64el") or \
122 (v8_target_arch=="x64" and host_arch!="x64") or \
123 (OS=="android" or OS=="qnx")', {
124 'want_separate_host_toolset': 1,
126 'want_separate_host_toolset': 0,
133 ['OS=="win" and use_goma==1', {
134 # goma doesn't support pch yet.
135 'chromium_win_pch': 0,
136 # goma doesn't support PDB yet, so win_z7=1 or fastbuild=1.
138 ['win_z7==0 and fastbuild==0', {
143 ['(v8_target_arch=="ia32" or v8_target_arch=="x64" or v8_target_arch=="x87") and \
144 (OS=="linux" or OS=="mac")', {
145 'v8_enable_gdbjit%': 1,
147 'v8_enable_gdbjit%': 0,
149 ['(OS=="linux" or OS=="mac") and (target_arch=="ia32" or target_arch=="x64") and \
150 (v8_target_arch!="x87")', {
155 ['host_arch!="ppc" and host_arch!="ppc64" and host_arch!="ppc64le"', {
161 # Default ARM variable settings.
162 'arm_version%': 'default',
164 'arm_float_abi%': 'default',
165 'arm_thumb': 'default',
167 # Default MIPS variable settings.
168 'mips_arch_variant%': 'r2',
169 # Possible values fp32, fp64, fpxx.
170 # fp32 - 32 32-bit FPU registers are available, doubles are placed in
172 # fp64 - 32 64-bit FPU registers are available.
173 # fpxx - compatibility mode, it chooses fp32 or fp64 depending on runtime
175 'mips_fpu_mode%': 'fp32',
179 'v8_code%': '<(v8_code)',
181 'default_configuration': 'Debug',
186 'cflags': [ '-g', '-Og', '-gxcoff' ],
188 'cflags': [ '-g', '-O0' ],
193 'inherit_from': [ 'DebugBaseCommon', 'DebugBase1' ],
196 # Xcode insists on this empty entry.
199 # Xcode insists on this empty entry.
203 ['(clang==1 or host_clang==1) and OS!="win"', {
204 # This is here so that all files get recompiled after a clang roll and
205 # when turning clang on or off.
206 # (defines are passed via the command line, and build systems rebuild
207 # things when their commandline changes). Nothing should ever read this
209 'defines': ['CR_CLANG_REVISION=<!(<(DEPTH)/tools/clang/scripts/update.sh --print-revision)'],
211 '-Wno-format-pedantic',
215 'target_conditions': [
221 ['os_posix == 1 and OS != "mac"', {
222 # We don't want to get warnings from third-party code,
223 # so remove any existing warning-enabling flags like -Wall.
231 # Clang considers the `register` keyword as deprecated, but
232 # ICU uses it all over the place.
233 '-Wno-deprecated-register',
234 # ICU uses its own deprecated functions.
235 '-Wno-deprecated-declarations',
236 # ICU prefers `a && b || c` over `(a && b) || c`.
237 '-Wno-logical-op-parentheses',
238 # ICU has some `unsigned < 0` checks.
239 '-Wno-tautological-compare',
240 # uresdata.c has switch(RES_GET_TYPE(x)) code. The
241 # RES_GET_TYPE macro returns an UResType enum, but some switch
242 # statement contains case values that aren't part of that
243 # enum (e.g. URES_TABLE32 which is in UResInternalType). This
248 '-Wnon-virtual-dtor',
253 'GCC_TREAT_WARNINGS_AS_ERRORS': 'NO', # -Werror
258 'VCCLCompilerTool': {
259 'WarnAsError': 'false',
268 ['asan==1 and OS!="mac"', {
271 '-fno-omit-frame-pointer',
272 '-gline-tables-only',
273 '-fsanitize=address',
274 '-w', # http://crbug.com/162783
277 '-fomit-frame-pointer',
280 '-fsanitize=address',
284 ['tsan==1 and OS!="mac"', {
287 '-fno-omit-frame-pointer',
288 '-gline-tables-only',
291 '-Wno-c++11-extensions',
294 '-fomit-frame-pointer',
305 ['asan==1 and OS=="mac"', {
309 '-fno-omit-frame-pointer',
310 '-gline-tables-only',
311 '-fsanitize=address',
312 '-w', # http://crbug.com/162783
315 '-fomit-frame-pointer',
318 'target_conditions': [
319 ['_type!="static_library"', {
320 'xcode_settings': {'OTHER_LDFLAGS': ['-fsanitize=address']},
324 '<(DEPTH)/build/mac/asan.gyp:asan_dynamic_runtime',
328 ['OS=="linux" or OS=="freebsd" or OS=="openbsd" or OS=="solaris" \
329 or OS=="netbsd" or OS=="aix"', {
334 '-Wno-unused-parameter',
339 # Don't warn about the "struct foo f = {0};" initialization pattern.
340 '-Wno-missing-field-initializers',
342 'cflags_cc': [ '-Wnon-virtual-dtor', '-fno-rtti', '-std=gnu++0x' ],
343 'ldflags': [ '-pthread', ],
345 [ 'host_arch=="ppc64" and OS!="aix"', {
346 'cflags': [ '-mminimal-toc' ],
348 [ 'visibility=="hidden" and v8_enable_backtrace==0', {
349 'cflags': [ '-fvisibility=hidden' ],
351 [ 'component=="shared_library"', {
352 'cflags': [ '-fPIC', ],
357 # 'OS=="linux" or OS=="freebsd" or OS=="openbsd" or OS=="solaris"
364 '-Wno-unused-parameter',
366 # Don't warn about the "struct foo f = {0};" initialization pattern.
367 '-Wno-missing-field-initializers',
369 'cflags_cc': [ '-Wnon-virtual-dtor', '-fno-rtti', '-std=gnu++0x' ],
371 [ 'visibility=="hidden"', {
372 'cflags': [ '-fvisibility=hidden' ],
374 [ 'component=="shared_library"', {
375 'cflags': [ '-fPIC' ],
378 'target_conditions': [
379 [ '_toolset=="host" and host_os=="linux"', {
380 'cflags': [ '-pthread' ],
381 'ldflags': [ '-pthread' ],
382 'libraries': [ '-lrt' ],
384 [ '_toolset=="target"', {
385 'cflags': [ '-Wno-psabi' ],
386 'libraries': [ '-lbacktrace', '-lsocket', '-lm' ],
394 '_CRT_SECURE_NO_DEPRECATE',
395 '_CRT_NONSTDC_NO_DEPRECATE',
396 '_USING_V110_SDK71_',
399 ['component=="static_library"', {
405 'msvs_cygwin_dirs': ['<(DEPTH)/third_party/cygwin'],
406 'msvs_disabled_warnings': [4355, 4800],
408 'VCCLCompilerTool': {
409 'MinimalRebuild': 'false',
410 'BufferSecurityCheck': 'true',
411 'EnableFunctionLevelLinking': 'true',
412 'RuntimeTypeInfo': 'false',
414 'WarnAsError': 'true',
415 'DebugInformationFormat': '3',
416 'Detect64BitPortabilityProblems': 'false',
418 [ 'msvs_multi_core_compile', {
419 'AdditionalOptions': ['/MP'],
421 ['component=="shared_library"', {
422 'ExceptionHandling': '1', # /EHsc
424 'ExceptionHandling': '0',
429 'AdditionalOptions': ['/ignore:4221'],
431 ['v8_target_arch=="x64"', {
432 'TargetMachine': '17', # x64
434 'TargetMachine': '1', # ia32
439 'AdditionalDependencies': [
442 'GenerateDebugInformation': 'true',
443 'MapFileName': '$(OutDir)\\$(TargetName).map',
444 'ImportLibrary': '$(OutDir)\\lib\\$(TargetName).lib',
445 'FixedBaseAddress': '1',
446 # LinkIncremental values:
448 # 1 == /INCREMENTAL:NO
450 'LinkIncremental': '1',
453 # 1 == /SUBSYSTEM:CONSOLE
454 # 2 == /SUBSYSTEM:WINDOWS
458 ['v8_enable_i18n_support==1', {
459 'AdditionalDependencies': [
463 ['v8_target_arch=="x64"', {
464 'MinimumRequiredVersion': '5.02', # Server 2003.
465 'TargetMachine': '17', # x64
467 'MinimumRequiredVersion': '5.01', # XP.
468 'TargetMachine': '1', # ia32
478 'SYMROOT': '<(DEPTH)/xcodebuild',
482 'ALWAYS_SEARCH_USER_PATHS': 'NO',
483 'GCC_C_LANGUAGE_STANDARD': 'c99', # -std=c99
484 'GCC_CW_ASM_SYNTAX': 'NO', # No -fasm-blocks
485 'GCC_DYNAMIC_NO_PIC': 'NO', # No -mdynamic-no-pic
486 # (Equivalent to -fPIC)
487 'GCC_ENABLE_CPP_EXCEPTIONS': 'NO', # -fno-exceptions
488 'GCC_ENABLE_CPP_RTTI': 'NO', # -fno-rtti
489 'GCC_ENABLE_PASCAL_STRINGS': 'NO', # No -mpascal-strings
490 # GCC_INLINES_ARE_PRIVATE_EXTERN maps to -fvisibility-inlines-hidden
491 'GCC_INLINES_ARE_PRIVATE_EXTERN': 'YES',
492 'GCC_SYMBOLS_PRIVATE_EXTERN': 'YES', # -fvisibility=hidden
493 'GCC_THREADSAFE_STATICS': 'NO', # -fno-threadsafe-statics
494 'GCC_WARN_NON_VIRTUAL_DESTRUCTOR': 'YES', # -Wnon-virtual-dtor
495 # MACOSX_DEPLOYMENT_TARGET maps to -mmacosx-version-min
496 'MACOSX_DEPLOYMENT_TARGET': '<(mac_deployment_target)',
497 'PREBINDING': 'NO', # No -Wl,-prebind
498 'SYMROOT': '<(DEPTH)/xcodebuild',
499 'USE_HEADERMAP': 'NO',
501 '-fno-strict-aliasing',
506 '-Wno-unused-parameter',
507 # Don't warn about the "struct foo f = {0};" initialization pattern.
508 '-Wno-missing-field-initializers',
513 'xcode_settings': {'GCC_TREAT_WARNINGS_AS_ERRORS': 'NO'},
515 'xcode_settings': {'GCC_TREAT_WARNINGS_AS_ERRORS': 'YES'},
519 'GCC_VERSION': 'com.apple.compilers.llvm.clang.1_0',
520 'CLANG_CXX_LANGUAGE_STANDARD': 'gnu++0x', # -std=gnu++0x
524 'target_conditions': [
525 ['_type!="static_library"', {
526 'xcode_settings': {'OTHER_LDFLAGS': ['-Wl,-search_paths_first']},
528 ], # target_conditions
531 ['clang!=1 and host_clang==1 and target_arch!="ia32" and target_arch!="x64"', {
532 'make_global_settings': [
533 ['CC.host', '../<(clang_dir)/bin/clang'],
534 ['CXX.host', '../<(clang_dir)/bin/clang++'],
537 ['clang==0 and host_clang==1 and target_arch!="ia32" and target_arch!="x64"', {
538 'target_conditions': [
539 ['_toolset=="host"', {
540 'cflags_cc': [ '-std=gnu++11', ],
544 'target_conditions': [
545 ['_toolset=="host"', { 'cflags!': [ '-Wno-unused-local-typedefs' ]}],
549 ['clang==1 and "<(GENERATOR)"=="ninja"', {
550 # See http://crbug.com/110262
552 'cflags': [ '-fcolor-diagnostics' ],
553 'xcode_settings': { 'OTHER_CFLAGS': [ '-fcolor-diagnostics' ] },
556 ['clang==1 and ((OS!="mac" and OS!="ios") or clang_xcode==0) '
557 'and OS!="win" and "<(GENERATOR)"=="make"', {
558 'make_global_settings': [
559 ['CC', '../<(clang_dir)/bin/clang'],
560 ['CXX', '../<(clang_dir)/bin/clang++'],
561 ['CC.host', '$(CC)'],
562 ['CXX.host', '$(CXX)'],
565 ['clang==1 and ((OS!="mac" and OS!="ios") or clang_xcode==0) '
566 'and OS!="win" and "<(GENERATOR)"=="ninja"', {
567 'make_global_settings': [
568 ['CC', '<(clang_dir)/bin/clang'],
569 ['CXX', '<(clang_dir)/bin/clang++'],
570 ['CC.host', '$(CC)'],
571 ['CXX.host', '$(CXX)'],
574 ['clang==1 and OS=="win"', {
575 'make_global_settings': [
576 # On Windows, gyp's ninja generator only looks at CC.
577 ['CC', '../<(clang_dir)/bin/clang-cl'],
580 # TODO(yyanagisawa): supports GENERATOR==make
581 # make generator doesn't support CC_wrapper without CC
582 # in make_global_settings yet.
583 ['use_goma==1 and ("<(GENERATOR)"=="ninja" or clang==1)', {
584 'make_global_settings': [
585 ['CC_wrapper', '<(gomadir)/gomacc'],
586 ['CXX_wrapper', '<(gomadir)/gomacc'],
587 ['CC.host_wrapper', '<(gomadir)/gomacc'],
588 ['CXX.host_wrapper', '<(gomadir)/gomacc'],