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")', {
155 # Default ARM variable settings.
156 'arm_version%': 'default',
158 'arm_float_abi%': 'default',
159 'arm_thumb': 'default',
161 # Default MIPS variable settings.
162 'mips_arch_variant%': 'r2',
163 # Possible values fp32, fp64, fpxx.
164 # fp32 - 32 32-bit FPU registers are available, doubles are placed in
166 # fp64 - 32 64-bit FPU registers are available.
167 # fpxx - compatibility mode, it chooses fp32 or fp64 depending on runtime
169 'mips_fpu_mode%': 'fp32',
173 'v8_code%': '<(v8_code)',
175 'default_configuration': 'Debug',
178 'cflags': [ '-g', '-O0' ],
180 ['(v8_target_arch=="ia32" or v8_target_arch=="x87") and \
187 'cflags': [ '-gxcoff' ],
192 'inherit_from': [ 'DebugBaseCommon', 'DebugBase1' ],
195 # Xcode insists on this empty entry.
198 # Xcode insists on this empty entry.
201 'target_conditions': [
207 ['os_posix == 1 and OS != "mac"', {
214 'GCC_TREAT_WARNINGS_AS_ERRORS': 'NO', # -Werror
219 'VCCLCompilerTool': {
220 'WarnAsError': 'false',
229 ['asan==1 and OS!="mac"', {
232 '-fno-omit-frame-pointer',
233 '-gline-tables-only',
234 '-fsanitize=address',
235 '-w', # http://crbug.com/162783
238 '-fomit-frame-pointer',
241 '-fsanitize=address',
245 ['tsan==1 and OS!="mac"', {
248 '-fno-omit-frame-pointer',
249 '-gline-tables-only',
252 '-Wno-c++11-extensions',
255 '-fomit-frame-pointer',
266 ['asan==1 and OS=="mac"', {
270 '-fno-omit-frame-pointer',
271 '-gline-tables-only',
272 '-fsanitize=address',
273 '-w', # http://crbug.com/162783
276 '-fomit-frame-pointer',
279 'target_conditions': [
280 ['_type!="static_library"', {
281 'xcode_settings': {'OTHER_LDFLAGS': ['-fsanitize=address']},
285 '<(DEPTH)/build/mac/asan.gyp:asan_dynamic_runtime',
289 ['OS=="linux" or OS=="freebsd" or OS=="openbsd" or OS=="solaris" \
290 or OS=="netbsd" or OS=="aix"', {
296 '-Wno-unused-parameter',
301 # Don't warn about the "struct foo f = {0};" initialization pattern.
302 '-Wno-missing-field-initializers',
304 'cflags_cc': [ '-Wnon-virtual-dtor', '-fno-rtti', '-std=gnu++0x' ],
305 'ldflags': [ '-pthread', ],
307 [ 'host_arch=="ppc64"', {
308 'cflags': [ '-mminimal-toc' ],
310 [ 'visibility=="hidden" and v8_enable_backtrace==0', {
311 'cflags': [ '-fvisibility=hidden' ],
313 [ 'component=="shared_library"', {
314 'cflags': [ '-fPIC', ],
319 # 'OS=="linux" or OS=="freebsd" or OS=="openbsd" or OS=="solaris"
327 '-Wno-unused-parameter',
329 # Don't warn about the "struct foo f = {0};" initialization pattern.
330 '-Wno-missing-field-initializers',
332 'cflags_cc': [ '-Wnon-virtual-dtor', '-fno-rtti', '-std=gnu++0x' ],
334 [ 'visibility=="hidden"', {
335 'cflags': [ '-fvisibility=hidden' ],
337 [ 'component=="shared_library"', {
338 'cflags': [ '-fPIC' ],
341 'target_conditions': [
342 [ '_toolset=="host" and host_os=="linux"', {
343 'cflags': [ '-pthread' ],
344 'ldflags': [ '-pthread' ],
345 'libraries': [ '-lrt' ],
347 [ '_toolset=="target"', {
348 'cflags': [ '-Wno-psabi' ],
349 'libraries': [ '-lbacktrace', '-lsocket', '-lm' ],
357 '_CRT_SECURE_NO_DEPRECATE',
358 '_CRT_NONSTDC_NO_DEPRECATE',
359 '_USING_V110_SDK71_',
362 ['component=="static_library"', {
368 'msvs_cygwin_dirs': ['<(DEPTH)/third_party/cygwin'],
369 'msvs_disabled_warnings': [4355, 4800],
371 'VCCLCompilerTool': {
372 'MinimalRebuild': 'false',
373 'BufferSecurityCheck': 'true',
374 'EnableFunctionLevelLinking': 'true',
375 'RuntimeTypeInfo': 'false',
377 'WarnAsError': 'true',
378 'DebugInformationFormat': '3',
379 'Detect64BitPortabilityProblems': 'false',
381 [ 'msvs_multi_core_compile', {
382 'AdditionalOptions': ['/MP'],
384 ['component=="shared_library"', {
385 'ExceptionHandling': '1', # /EHsc
387 'ExceptionHandling': '0',
392 'AdditionalOptions': ['/ignore:4221'],
394 ['v8_target_arch=="x64"', {
395 'TargetMachine': '17', # x64
397 'TargetMachine': '1', # ia32
402 'AdditionalDependencies': [
405 'GenerateDebugInformation': 'true',
406 'MapFileName': '$(OutDir)\\$(TargetName).map',
407 'ImportLibrary': '$(OutDir)\\lib\\$(TargetName).lib',
408 'FixedBaseAddress': '1',
409 # LinkIncremental values:
411 # 1 == /INCREMENTAL:NO
413 'LinkIncremental': '1',
416 # 1 == /SUBSYSTEM:CONSOLE
417 # 2 == /SUBSYSTEM:WINDOWS
421 ['v8_enable_i18n_support==1', {
422 'AdditionalDependencies': [
426 ['v8_target_arch=="x64"', {
427 'MinimumRequiredVersion': '5.02', # Server 2003.
428 'TargetMachine': '17', # x64
430 'MinimumRequiredVersion': '5.01', # XP.
431 'TargetMachine': '1', # ia32
441 'SYMROOT': '<(DEPTH)/xcodebuild',
445 'ALWAYS_SEARCH_USER_PATHS': 'NO',
446 'GCC_C_LANGUAGE_STANDARD': 'c99', # -std=c99
447 'GCC_CW_ASM_SYNTAX': 'NO', # No -fasm-blocks
448 'GCC_DYNAMIC_NO_PIC': 'NO', # No -mdynamic-no-pic
449 # (Equivalent to -fPIC)
450 'GCC_ENABLE_CPP_EXCEPTIONS': 'NO', # -fno-exceptions
451 'GCC_ENABLE_CPP_RTTI': 'NO', # -fno-rtti
452 'GCC_ENABLE_PASCAL_STRINGS': 'NO', # No -mpascal-strings
453 # GCC_INLINES_ARE_PRIVATE_EXTERN maps to -fvisibility-inlines-hidden
454 'GCC_INLINES_ARE_PRIVATE_EXTERN': 'YES',
455 'GCC_SYMBOLS_PRIVATE_EXTERN': 'YES', # -fvisibility=hidden
456 'GCC_THREADSAFE_STATICS': 'NO', # -fno-threadsafe-statics
457 'GCC_WARN_NON_VIRTUAL_DESTRUCTOR': 'YES', # -Wnon-virtual-dtor
458 # MACOSX_DEPLOYMENT_TARGET maps to -mmacosx-version-min
459 'MACOSX_DEPLOYMENT_TARGET': '<(mac_deployment_target)',
460 'PREBINDING': 'NO', # No -Wl,-prebind
461 'SYMROOT': '<(DEPTH)/xcodebuild',
462 'USE_HEADERMAP': 'NO',
464 '-fno-strict-aliasing',
470 '-Wno-unused-parameter',
471 # Don't warn about the "struct foo f = {0};" initialization pattern.
472 '-Wno-missing-field-initializers',
477 'xcode_settings': {'GCC_TREAT_WARNINGS_AS_ERRORS': 'NO'},
479 'xcode_settings': {'GCC_TREAT_WARNINGS_AS_ERRORS': 'YES'},
483 'GCC_VERSION': 'com.apple.compilers.llvm.clang.1_0',
484 'CLANG_CXX_LANGUAGE_STANDARD': 'gnu++0x', # -std=gnu++0x
488 'target_conditions': [
489 ['_type!="static_library"', {
490 'xcode_settings': {'OTHER_LDFLAGS': ['-Wl,-search_paths_first']},
492 ], # target_conditions
495 ['clang==1 and ((OS!="mac" and OS!="ios") or clang_xcode==0) '
496 'and OS!="win" and "<(GENERATOR)"=="make"', {
497 'make_global_settings': [
498 ['CC', '../<(clang_dir)/bin/clang'],
499 ['CXX', '../<(clang_dir)/bin/clang++'],
500 ['CC.host', '$(CC)'],
501 ['CXX.host', '$(CXX)'],
504 ['clang==1 and ((OS!="mac" and OS!="ios") or clang_xcode==0) '
505 'and OS!="win" and "<(GENERATOR)"=="ninja"', {
506 'make_global_settings': [
507 ['CC', '<(clang_dir)/bin/clang'],
508 ['CXX', '<(clang_dir)/bin/clang++'],
509 ['CC.host', '$(CC)'],
510 ['CXX.host', '$(CXX)'],
513 ['clang==1 and OS=="win"', {
514 'make_global_settings': [
515 # On Windows, gyp's ninja generator only looks at CC.
516 ['CC', '../<(clang_dir)/bin/clang-cl'],
519 # TODO(yyanagisawa): supports GENERATOR==make
520 # make generator doesn't support CC_wrapper without CC
521 # in make_global_settings yet.
522 ['use_goma==1 and ("<(GENERATOR)"=="ninja" or clang==1)', {
523 'make_global_settings': [
524 ['CC_wrapper', '<(gomadir)/gomacc'],
525 ['CXX_wrapper', '<(gomadir)/gomacc'],
526 ['CC.host_wrapper', '<(gomadir)/gomacc'],
527 ['CXX.host_wrapper', '<(gomadir)/gomacc'],