Home | History | Annotate | Download | only in build
      1 # Copyright (c) 2010 The Chromium 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 # IMPORTANT:
      6 # Please don't directly include this file if you are building via gyp_chromium,
      7 # since gyp_chromium is automatically forcing its inclusion.
      8 {
      9   # Variables expected to be overriden on the GYP command line (-D) or by
     10   # ~/.gyp/include.gypi.
     11   'variables': {
     12     # Putting a variables dict inside another variables dict looks kind of
     13     # weird.  This is done so that 'host_arch', 'chromeos', etc are defined as
     14     # variables within the outer variables dict here.  This is necessary
     15     # to get these variables defined for the conditions within this variables
     16     # dict that operate on these variables (e.g., for setting 'toolkit_views',
     17     # we need to have 'chromeos' already set).
     18     'variables': {
     19       'variables': {
     20         'variables': {
     21           # Whether we're building a ChromeOS build.
     22           'chromeos%': 0,
     23 
     24           # Disable touch support by default.
     25           'touchui%': 0,
     26         },
     27         # Copy conditionally-set variables out one scope.
     28         'chromeos%': '<(chromeos)',
     29         'touchui%': '<(touchui)',
     30 
     31         # To do a shared build on linux we need to be able to choose between
     32         # type static_library and shared_library. We default to doing a static
     33         # build but you can override this with "gyp -Dlibrary=shared_library"
     34         # or you can add the following line (without the #) to
     35         # ~/.gyp/include.gypi {'variables': {'library': 'shared_library'}}
     36         # to compile as shared by default
     37         'library%': 'static_library',
     38 
     39         # Compute the architecture that we're building on.
     40         'conditions': [
     41           [ 'OS=="linux" or OS=="freebsd" or OS=="openbsd"', {
     42             # This handles the Linux platforms we generally deal with. Anything
     43             # else gets passed through, which probably won't work very well; such
     44             # hosts should pass an explicit target_arch to gyp.
     45             'host_arch%':
     46               '<!(uname -m | sed -e "s/i.86/ia32/;s/x86_64/x64/;s/amd64/x64/;s/arm.*/arm/")',
     47           }, {  # OS!="linux"
     48             'host_arch%': 'ia32',
     49           }],
     50 
     51           # Set default value of toolkit_views on for Windows, Chrome OS
     52           # and the touch UI.
     53           ['OS=="win" or chromeos==1 or touchui==1', {
     54             'toolkit_views%': 1,
     55           }, {
     56             'toolkit_views%': 0,
     57           }],
     58         ],
     59       },
     60 
     61       # Copy conditionally-set variables out one scope.
     62       'chromeos%': '<(chromeos)',
     63       'touchui%': '<(touchui)',
     64       'host_arch%': '<(host_arch)',
     65       'library%': '<(library)',
     66       'toolkit_views%': '<(toolkit_views)',
     67 
     68       # Override branding to select the desired branding flavor.
     69       'branding%': 'Chromium',
     70 
     71       # Override buildtype to select the desired build flavor.
     72       # Dev - everyday build for development/testing
     73       # Official - release build (generally implies additional processing)
     74       # TODO(mmoss) Once 'buildtype' is fully supported (e.g. Windows gyp
     75       # conversion is done), some of the things which are now controlled by
     76       # 'branding', such as symbol generation, will need to be refactored based
     77       # on 'buildtype' (i.e. we don't care about saving symbols for non-Official
     78       # builds).
     79       'buildtype%': 'Dev',
     80 
     81       # Default architecture we're building for is the architecture we're
     82       # building on.
     83       'target_arch%': '<(host_arch)',
     84 
     85       # This variable tells WebCore.gyp and JavaScriptCore.gyp whether they are
     86       # are built under a chromium full build (1) or a webkit.org chromium
     87       # build (0).
     88       'inside_chromium_build%': 1,
     89 
     90       # Set to 1 to enable fast builds. It disables debug info for fastest
     91       # compilation.
     92       'fastbuild%': 0,
     93 
     94        # Disable file manager component extension by default.
     95       'file_manager_extension%': 0,
     96 
     97       # Python version.
     98       'python_ver%': '2.5',
     99 
    100       # Set ARM-v7 compilation flags
    101       'armv7%': 0,
    102 
    103       # Set Neon compilation flags (only meaningful if armv7==1).
    104       'arm_neon%': 1,
    105 
    106       # The system root for cross-compiles. Default: none.
    107       'sysroot%': '',
    108 
    109       # On Linux, we build with sse2 for Chromium builds.
    110       'disable_sse2%': 0,
    111 
    112       # Use libjpeg-turbo as the JPEG codec used by Chromium.
    113       'use_libjpeg_turbo%': 1,
    114 
    115       # Variable 'component' is for cases where we would like to build some
    116       # components as dynamic shared libraries but still need variable
    117       # 'library' for static libraries.
    118       # By default, component is set to whatever library is set to and
    119       # it can be overriden by the GYP command line or by ~/.gyp/include.gypi.
    120       'component%': '<(library)',
    121 
    122       # Set to select the Title Case versions of strings in GRD files.
    123       'use_titlecase_in_grd_files%': 0,
    124 
    125       # Use translations provided by volunteers at launchpad.net.  This
    126       # currently only works on Linux.
    127       'use_third_party_translations%': 0,
    128 
    129       # Remoting compilation is enabled by default. Set to 0 to disable.
    130       'remoting%': 1,
    131 
    132       # If this is set, the clang plugins used on the buildbot will be used.
    133       # Run tools/clang/scripts/update.sh to make sure they are compiled.
    134       # This causes 'clang_chrome_plugins_flags' to be set.
    135       # Has no effect if 'clang' is not set as well.
    136       'clang_use_chrome_plugins%': 0,
    137 
    138       'conditions': [
    139         # A flag to enable or disable our compile-time dependency
    140         # on gnome-keyring. If that dependency is disabled, no gnome-keyring
    141         # support will be available. This option is useful
    142         # for Linux distributions.
    143         ['chromeos==1', {
    144           'use_gnome_keyring%': 0,
    145         }, {
    146           'use_gnome_keyring%': 1,
    147         }],
    148 
    149         # Set to 1 compile with -fPIC cflag on linux. This is a must for shared
    150         # libraries on linux x86-64 and arm.
    151         ['host_arch=="ia32"', {
    152           'linux_fpic%': 0,
    153         }, {
    154           'linux_fpic%': 1,
    155         }],
    156 
    157         ['toolkit_views==0 or OS=="mac"', {
    158           # GTK+ and Mac wants Title Case strings
    159           'use_titlecase_in_grd_files%': 1,
    160         }],
    161 
    162         # Enable some hacks to support Flapper only on Chrome OS.
    163         ['chromeos==1', {
    164           'enable_flapper_hacks%': 1,
    165         }, {
    166           'enable_flapper_hacks%': 0,
    167         }],
    168 
    169         # Enable file manager extension by default on Chrome OS.
    170         ['chromeos==1', {
    171           'file_manager_extension%': 1,
    172         }, {
    173           'file_manager_extension%': 0,
    174         }],
    175       ],
    176     },
    177 
    178     # Copy conditionally-set variables out one scope.
    179     'branding%': '<(branding)',
    180     'buildtype%': '<(buildtype)',
    181     'target_arch%': '<(target_arch)',
    182     'host_arch%': '<(host_arch)',
    183     'toolkit_views%': '<(toolkit_views)',
    184     'use_gnome_keyring%': '<(use_gnome_keyring)',
    185     'linux_fpic%': '<(linux_fpic)',
    186     'enable_flapper_hacks%': '<(enable_flapper_hacks)',
    187     'chromeos%': '<(chromeos)',
    188     'touchui%': '<(touchui)',
    189     'file_manager_extension%': '<(file_manager_extension)',
    190     'inside_chromium_build%': '<(inside_chromium_build)',
    191     'fastbuild%': '<(fastbuild)',
    192     'python_ver%': '<(python_ver)',
    193     'armv7%': '<(armv7)',
    194     'arm_neon%': '<(arm_neon)',
    195     'sysroot%': '<(sysroot)',
    196     'disable_sse2%': '<(disable_sse2)',
    197     'library%': '<(library)',
    198     'component%': '<(component)',
    199     'use_titlecase_in_grd_files%': '<(use_titlecase_in_grd_files)',
    200     'use_third_party_translations%': '<(use_third_party_translations)',
    201     'remoting%': '<(remoting)',
    202     'clang_use_chrome_plugins%': '<(clang_use_chrome_plugins)',
    203 
    204     # The release channel that this build targets. This is used to restrict
    205     # channel-specific build options, like which installer packages to create.
    206     # The default is 'all', which does no channel-specific filtering.
    207     'channel%': 'all',
    208 
    209     # Override chromium_mac_pch and set it to 0 to suppress the use of
    210     # precompiled headers on the Mac.  Prefix header injection may still be
    211     # used, but prefix headers will not be precompiled.  This is useful when
    212     # using distcc to distribute a build to compile slaves that don't
    213     # share the same compiler executable as the system driving the compilation,
    214     # because precompiled headers rely on pointers into a specific compiler
    215     # executable's image.  Setting this to 0 is needed to use an experimental
    216     # Linux-Mac cross compiler distcc farm.
    217     'chromium_mac_pch%': 1,
    218 
    219     # Mac OS X SDK and deployment target support.
    220     # The SDK identifies the version of the system headers that will be used,
    221     # and corresponds to the MAC_OS_X_VERSION_MAX_ALLOWED compile-time macro.
    222     # "Maximum allowed" refers to the operating system version whose APIs are
    223     # available in the headers.
    224     # The deployment target identifies the minimum system version that the
    225     # built products are expected to function on.  It corresponds to the
    226     # MAC_OS_X_VERSION_MIN_REQUIRED compile-time macro.
    227     # To ensure these macros are available, #include <AvailabilityMacros.h>.
    228     # Additional documentation on these macros is available at
    229     # http://developer.apple.com/mac/library/technotes/tn2002/tn2064.html#SECTION3
    230     # Chrome normally builds with the Mac OS X 10.5 SDK and sets the
    231     # deployment target to 10.5.  Other projects, such as O3D, may override
    232     # these defaults.
    233     'mac_sdk%': '10.5',
    234     'mac_deployment_target%': '10.5',
    235 
    236     # Set to 1 to enable code coverage.  In addition to build changes
    237     # (e.g. extra CFLAGS), also creates a new target in the src/chrome
    238     # project file called "coverage".
    239     # Currently ignored on Windows.
    240     'coverage%': 0,
    241 
    242     # Overridable specification for potential use of alternative
    243     # JavaScript engines.
    244     'javascript_engine%': 'v8',
    245 
    246     # Although base/allocator lets you select a heap library via an
    247     # environment variable, the libcmt shim it uses sometimes gets in
    248     # the way.  To disable it entirely, and switch to normal msvcrt, do e.g.
    249     #  'win_use_allocator_shim': 0,
    250     #  'win_release_RuntimeLibrary': 2
    251     # to ~/.gyp/include.gypi, gclient runhooks --force, and do a release build.
    252     'win_use_allocator_shim%': 1, # 1 = shim allocator via libcmt; 0 = msvcrt
    253 
    254     # Whether usage of OpenMAX is enabled.
    255     'enable_openmax%': 0,
    256 
    257     # Whether proprietary audio/video codecs are assumed to be included with
    258     # this build (only meaningful if branding!=Chrome).
    259     'proprietary_codecs%': 0,
    260 
    261     # TODO(bradnelson): eliminate this when possible.
    262     # To allow local gyp files to prevent release.vsprops from being included.
    263     # Yes(1) means include release.vsprops.
    264     # Once all vsprops settings are migrated into gyp, this can go away.
    265     'msvs_use_common_release%': 1,
    266 
    267     # TODO(bradnelson): eliminate this when possible.
    268     # To allow local gyp files to override additional linker options for msvs.
    269     # Yes(1) means set use the common linker options.
    270     'msvs_use_common_linker_extras%': 1,
    271 
    272     # TODO(sgk): eliminate this if possible.
    273     # It would be nicer to support this via a setting in 'target_defaults'
    274     # in chrome/app/locales/locales.gypi overriding the setting in the
    275     # 'Debug' configuration in the 'target_defaults' dict below,
    276     # but that doesn't work as we'd like.
    277     'msvs_debug_link_incremental%': '2',
    278 
    279     # Needed for some of the largest modules.
    280     'msvs_debug_link_nonincremental%': '1',
    281 
    282     # This is the location of the sandbox binary. Chrome looks for this before
    283     # running the zygote process. If found, and SUID, it will be used to
    284     # sandbox the zygote process and, thus, all renderer processes.
    285     'linux_sandbox_path%': '',
    286 
    287     # Set this to true to enable SELinux support.
    288     'selinux%': 0,
    289 
    290     # Set this to true when building with Clang.
    291     # See http://code.google.com/p/chromium/wiki/Clang for details.
    292     # TODO: eventually clang should behave identically to gcc, and this
    293     # won't be necessary.
    294     'clang%': 0,
    295 
    296     # These two variables can be set in GYP_DEFINES while running
    297     # |gclient runhooks| to let clang run a plugin in every compilation.
    298     # Only has an effect if 'clang=1' is in GYP_DEFINES as well.
    299     # Example:
    300     #     GYP_DEFINES='clang=1 clang_load=/abs/path/to/libPrintFunctionNames.dylib clang_add_plugin=print-fns' gclient runhooks
    301 
    302     'clang_load%': '',
    303     'clang_add_plugin%': '',
    304 
    305     # Enable sampling based profiler.
    306     # See http://google-perftools.googlecode.com/svn/trunk/doc/cpuprofile.html
    307     'profiling%': '0',
    308 
    309     # Override whether we should use Breakpad on Linux. I.e. for Chrome bot.
    310     'linux_breakpad%': 0,
    311     # And if we want to dump symbols for Breakpad-enabled builds.
    312     'linux_dump_symbols%': 0,
    313     # And if we want to strip the binary after dumping symbols.
    314     'linux_strip_binary%': 0,
    315     # Strip the test binaries needed for Linux reliability tests.
    316     'linux_strip_reliability_tests%': 0,
    317 
    318     # Enable TCMalloc.
    319     'linux_use_tcmalloc%': 1,
    320 
    321     # Disable TCMalloc's debugallocation.
    322     'linux_use_debugallocation%': 0,
    323 
    324     # Disable TCMalloc's heapchecker.
    325     'linux_use_heapchecker%': 0,
    326 
    327     # Disable shadow stack keeping used by heapcheck to unwind the stacks
    328     # better.
    329     'linux_keep_shadow_stacks%': 0,
    330 
    331     # Set to 1 to turn on seccomp sandbox by default.
    332     # (Note: this is ignored for official builds.)
    333     'linux_use_seccomp_sandbox%': 0,
    334 
    335     # Set to 1 to link against libgnome-keyring instead of using dlopen().
    336     'linux_link_gnome_keyring%': 0,
    337 
    338     # Used to disable Native Client at compile time, for platforms where it
    339     # isn't supported
    340     'disable_nacl%': 0,
    341 
    342     # Set Thumb compilation flags.
    343     'arm_thumb%': 0,
    344 
    345     # Set ARM fpu compilation flags (only meaningful if armv7==1 and
    346     # arm_neon==0).
    347     'arm_fpu%': 'vfpv3',
    348 
    349     # Enable new NPDevice API.
    350     'enable_new_npdevice_api%': 0,
    351 
    352     # Enable EGLImage support in OpenMAX
    353     'enable_eglimage%': 1,
    354 
    355     # Enable a variable used elsewhere throughout the GYP files to determine
    356     # whether to compile in the sources for the GPU plugin / process.
    357     'enable_gpu%': 1,
    358 
    359     # Use OpenSSL instead of NSS. Under development: see http://crbug.com/62803
    360     'use_openssl%': 0,
    361 
    362     # .gyp files or targets should set chromium_code to 1 if they build
    363     # Chromium-specific code, as opposed to external code.  This variable is
    364     # used to control such things as the set of warnings to enable, and
    365     # whether warnings are treated as errors.
    366     'chromium_code%': 0,
    367 
    368     # Set to 1 to compile with the built in pdf viewer.
    369     'internal_pdf%': 0,
    370 
    371     # This allows to use libcros from the current system, ie. /usr/lib/
    372     # The cros_api will be pulled in as a static library, and all headers
    373     # from the system include dirs.
    374     'system_libcros%': 0,
    375 
    376     # NOTE: When these end up in the Mac bundle, we need to replace '-' for '_'
    377     # so Cocoa is happy (http://crbug.com/20441).
    378     'locales': [
    379       'am', 'ar', 'bg', 'bn', 'ca', 'cs', 'da', 'de', 'el', 'en-GB',
    380       'en-US', 'es-419', 'es', 'et', 'fa', 'fi', 'fil', 'fr', 'gu', 'he',
    381       'hi', 'hr', 'hu', 'id', 'it', 'ja', 'kn', 'ko', 'lt', 'lv',
    382       'ml', 'mr', 'nb', 'nl', 'pl', 'pt-BR', 'pt-PT', 'ro', 'ru',
    383       'sk', 'sl', 'sr', 'sv', 'sw', 'ta', 'te', 'th', 'tr', 'uk',
    384       'vi', 'zh-CN', 'zh-TW',
    385     ],
    386 
    387     'grit_defines': [],
    388 
    389     # Use Harfbuzz-NG instead of Harfbuzz.
    390     # Under development: http://crbug.com/68551
    391     'use_harfbuzz_ng%': 0,
    392 
    393     # If debug_devtools is set to 1, JavaScript files for DevTools are
    394     # stored as is and loaded from disk. Otherwise, a concatenated file
    395     # is stored in resources.pak. It is still possible to load JS files
    396     # from disk by passing --debug-devtools cmdline switch.
    397     'debug_devtools%': 0,
    398 
    399     # Point to ICU directory.
    400     'icu_src_dir': '../third_party/icu',
    401 
    402     'conditions': [
    403       ['OS=="linux" or OS=="freebsd" or OS=="openbsd"', {
    404         # This will set gcc_version to XY if you are running gcc X.Y.*.
    405         # This is used to tweak build flags for gcc 4.4.
    406         'gcc_version%': '<!(python <(DEPTH)/build/compiler_version.py)',
    407         # Figure out the python architecture to decide if we build pyauto.
    408         'python_arch%': '<!(<(DEPTH)/build/linux/python_arch.sh <(sysroot)/usr/lib/libpython<(python_ver).so.1.0)',
    409         'conditions': [
    410           ['branding=="Chrome"', {
    411             'linux_breakpad%': 1,
    412           }],
    413           # All Chrome builds have breakpad symbols, but only process the
    414           # symbols from official builds.
    415           ['(branding=="Chrome" and buildtype=="Official")', {
    416             'linux_dump_symbols%': 1,
    417           }],
    418         ],
    419       }],  # OS=="linux" or OS=="freebsd" or OS=="openbsd"
    420 
    421       ['OS=="mac"', {
    422         'conditions': [
    423           # mac_product_name is set to the name of the .app bundle as it should
    424           # appear on disk.  This duplicates data from
    425           # chrome/app/theme/chromium/BRANDING and
    426           # chrome/app/theme/google_chrome/BRANDING, but is necessary to get
    427           # these names into the build system.
    428           ['branding=="Chrome"', {
    429             'mac_product_name%': 'Google Chrome',
    430           }, { # else: branding!="Chrome"
    431             'mac_product_name%': 'Chromium',
    432           }],
    433 
    434           # Feature variables for enabling Mac Breakpad and Keystone auto-update
    435           # support.  Both features are on by default in official builds with
    436           # Chrome branding.
    437           ['branding=="Chrome" and buildtype=="Official"', {
    438             'mac_breakpad%': 1,
    439             'mac_keystone%': 1,
    440           }, { # else: branding!="Chrome" or buildtype!="Official"
    441             'mac_breakpad%': 0,
    442             'mac_keystone%': 0,
    443           }],
    444         ],
    445       }],  # OS=="mac"
    446 
    447       # Whether to use multiple cores to compile with visual studio. This is
    448       # optional because it sometimes causes corruption on VS 2005.
    449       # It is on by default on VS 2008 and off on VS 2005.
    450       ['OS=="win"', {
    451         'conditions': [
    452           ['component=="shared_library"', {
    453             'win_use_allocator_shim%': 0,
    454           }],
    455           ['MSVS_VERSION=="2005"', {
    456             'msvs_multi_core_compile%': 0,
    457           },{
    458             'msvs_multi_core_compile%': 1,
    459           }],
    460           # Don't do incremental linking for large modules on 32-bit.
    461           ['MSVS_OS_BITS==32', {
    462             'msvs_large_module_debug_link_mode%': '1',  # No
    463           },{
    464             'msvs_large_module_debug_link_mode%': '2',  # Yes
    465           }],
    466           ['MSVS_VERSION=="2010e" or MSVS_VERSION=="2008e" or MSVS_VERSION=="2005e"', {
    467             'msvs_express%': 1,
    468             'secure_atl%': 0,
    469           },{
    470             'msvs_express%': 0,
    471             'secure_atl%': 1,
    472           }],
    473         ],
    474         'nacl_win64_defines': [
    475           # This flag is used to minimize dependencies when building
    476           # Native Client loader for 64-bit Windows.
    477           'NACL_WIN64',
    478         ],
    479       }],
    480 
    481       ['OS=="mac" or (OS=="linux" and chromeos==0 and target_arch!="arm")', {
    482         'use_cups%': 1,
    483       }, {
    484         'use_cups%': 0,
    485       }],
    486 
    487       # Set the relative path from this file to the GYP file of the JPEG
    488       # library used by Chromium.
    489       ['use_libjpeg_turbo==1', {
    490         'libjpeg_gyp_path': '../third_party/libjpeg_turbo/libjpeg.gyp',
    491       }, {
    492         'libjpeg_gyp_path': '../third_party/libjpeg/libjpeg.gyp',
    493       }],  # use_libjpeg_turbo==1
    494 
    495       # Use GConf, the GNOME configuration system.
    496       ['chromeos==1', {
    497         'use_gconf%': 0,
    498       }, {
    499         'use_gconf%': 1,
    500       }],
    501 
    502       # Set up -D and -E flags passed into grit.
    503       ['branding=="Chrome"', {
    504         # TODO(mmoss) The .grd files look for _google_chrome, but for
    505         # consistency they should look for google_chrome_build like C++.
    506         'grit_defines': ['-D', '_google_chrome',
    507                          '-E', 'CHROMIUM_BUILD=google_chrome'],
    508       }, {
    509         'grit_defines': ['-D', '_chromium',
    510                          '-E', 'CHROMIUM_BUILD=chromium'],
    511       }],
    512       ['chromeos==1', {
    513         'grit_defines': ['-D', 'chromeos'],
    514       }],
    515       ['toolkit_views==1', {
    516         'grit_defines': ['-D', 'toolkit_views'],
    517       }],
    518       ['touchui==1', {
    519         'grit_defines': ['-D', 'touchui'],
    520       }],
    521       ['file_manager_extension==1', {
    522         'grit_defines': ['-D', 'file_manager_extension'],
    523       }],
    524       ['remoting==1', {
    525         'grit_defines': ['-D', 'remoting'],
    526       }],
    527       ['use_titlecase_in_grd_files==1', {
    528         'grit_defines': ['-D', 'use_titlecase'],
    529       }],
    530       ['use_third_party_translations==1', {
    531         'grit_defines': ['-D', 'use_third_party_translations'],
    532         'locales': ['ast', 'eu', 'gl', 'ka', 'ku', 'ug'],
    533       }],
    534 
    535       ['clang_use_chrome_plugins==1', {
    536         'clang_chrome_plugins_flags':
    537             '<!(<(DEPTH)/tools/clang/scripts/plugin_flags.sh)',
    538       }],
    539     ],
    540   },
    541   'target_defaults': {
    542     'variables': {
    543       # The condition that operates on chromium_code is in a target_conditions
    544       # section, and will not have access to the default fallback value of
    545       # chromium_code at the top of this file, or to the chromium_code
    546       # variable placed at the root variables scope of .gyp files, because
    547       # those variables are not set at target scope.  As a workaround,
    548       # if chromium_code is not set at target scope, define it in target scope
    549       # to contain whatever value it has during early variable expansion.
    550       # That's enough to make it available during target conditional
    551       # processing.
    552       'chromium_code%': '<(chromium_code)',
    553 
    554       # See http://gcc.gnu.org/onlinedocs/gcc-4.4.2/gcc/Optimize-Options.html
    555       'mac_release_optimization%': '3', # Use -O3 unless overridden
    556       'mac_debug_optimization%': '0',   # Use -O0 unless overridden
    557       # See http://msdn.microsoft.com/en-us/library/aa652360(VS.71).aspx
    558       'win_release_Optimization%': '2', # 2 = /Os
    559       'win_debug_Optimization%': '0',   # 0 = /Od
    560       # See http://msdn.microsoft.com/en-us/library/8wtf2dfz(VS.71).aspx
    561       'win_debug_RuntimeChecks%': '3',    # 3 = all checks enabled, 0 = off
    562       # See http://msdn.microsoft.com/en-us/library/47238hez(VS.71).aspx
    563       'win_debug_InlineFunctionExpansion%': '',    # empty = default, 0 = off,
    564       'win_release_InlineFunctionExpansion%': '2', # 1 = only __inline, 2 = max
    565       # VS inserts quite a lot of extra checks to algorithms like
    566       # std::partial_sort in Debug build which make them O(N^2)
    567       # instead of O(N*logN). This is particularly slow under memory
    568       # tools like ThreadSanitizer so we want it to be disablable.
    569       # See http://msdn.microsoft.com/en-us/library/aa985982(v=VS.80).aspx
    570       'win_debug_disable_iterator_debugging%': '0',
    571 
    572       'release_extra_cflags%': '',
    573       'debug_extra_cflags%': '',
    574       'release_valgrind_build%': 0,
    575 
    576       'conditions': [
    577         ['OS=="win" and component=="shared_library"', {
    578           # See http://msdn.microsoft.com/en-us/library/aa652367.aspx
    579           'win_release_RuntimeLibrary%': '2', # 2 = /MT (nondebug DLL)
    580           'win_debug_RuntimeLibrary%': '3',   # 3 = /MTd (debug DLL)
    581         }, {
    582           # See http://msdn.microsoft.com/en-us/library/aa652367.aspx
    583           'win_release_RuntimeLibrary%': '0', # 0 = /MT (nondebug static)
    584           'win_debug_RuntimeLibrary%': '1',   # 1 = /MTd (debug static)
    585         }],
    586       ],
    587     },
    588     'conditions': [
    589       ['branding=="Chrome"', {
    590         'defines': ['GOOGLE_CHROME_BUILD'],
    591       }, {  # else: branding!="Chrome"
    592         'defines': ['CHROMIUM_BUILD'],
    593       }],
    594       ['toolkit_views==1', {
    595         'defines': ['TOOLKIT_VIEWS=1'],
    596       }],
    597       ['chromeos==1', {
    598         'defines': ['OS_CHROMEOS=1'],
    599       }],
    600       ['touchui==1', {
    601         'defines': ['TOUCH_UI=1'],
    602       }],
    603       ['file_manager_extension==1', {
    604         'defines': ['FILE_MANAGER_EXTENSION=1'],
    605       }],
    606       ['profiling==1', {
    607         'defines': ['ENABLE_PROFILING=1'],
    608       }],
    609       ['remoting==1', {
    610         'defines': ['ENABLE_REMOTING=1'],
    611       }],
    612       ['proprietary_codecs==1', {
    613         'defines': ['USE_PROPRIETARY_CODECS'],
    614       }],
    615       ['enable_flapper_hacks==1', {
    616         'defines': ['ENABLE_FLAPPER_HACKS=1'],
    617       }],
    618       ['fastbuild!=0', {
    619         'conditions': [
    620           # For Windows, we don't genererate debug information.
    621           ['OS=="win"', {
    622             'msvs_settings': {
    623               'VCLinkerTool': {
    624                 'GenerateDebugInformation': 'false',
    625               },
    626               'VCCLCompilerTool': {
    627                 'DebugInformationFormat': '0',
    628               }
    629             }
    630           }, { # else: OS != "win", generate less debug information.
    631             'variables': {
    632               'debug_extra_cflags': '-g1',
    633             },
    634           }],
    635           # Clang creates chubby debug information, which makes linking very
    636           # slow. For now, don't create debug information with clang.  See
    637           # http://crbug.com/70000
    638           ['OS=="linux" and clang==1', {
    639             'variables': {
    640               'debug_extra_cflags': '-g0',
    641             },
    642           }],
    643         ],  # conditions for fastbuild.
    644       }],  # fastbuild!=0
    645       ['selinux==1', {
    646         'defines': ['CHROMIUM_SELINUX=1'],
    647       }],
    648       ['win_use_allocator_shim==0', {
    649         'conditions': [
    650           ['OS=="win"', {
    651             'defines': ['NO_TCMALLOC'],
    652           }],
    653         ],
    654       }],
    655       ['enable_gpu==1', {
    656         'defines': [
    657           'ENABLE_GPU=1',
    658         ],
    659       }],
    660       ['use_openssl==1', {
    661         'defines': [
    662           'USE_OPENSSL=1',
    663         ],
    664       }],
    665       ['enable_eglimage==1', {
    666         'defines': [
    667           'ENABLE_EGLIMAGE=1',
    668         ],
    669       }],
    670       ['coverage!=0', {
    671         'conditions': [
    672           ['OS=="mac"', {
    673             'xcode_settings': {
    674               'GCC_INSTRUMENT_PROGRAM_FLOW_ARCS': 'YES',  # -fprofile-arcs
    675               'GCC_GENERATE_TEST_COVERAGE_FILES': 'YES',  # -ftest-coverage
    676             },
    677             # Add -lgcov for types executable, shared_library, and
    678             # loadable_module; not for static_library.
    679             # This is a delayed conditional.
    680             'target_conditions': [
    681               ['_type!="static_library"', {
    682                 'xcode_settings': { 'OTHER_LDFLAGS': [ '-lgcov' ] },
    683               }],
    684             ],
    685           }],
    686           ['OS=="linux"', {
    687             'cflags': [ '-ftest-coverage',
    688                         '-fprofile-arcs' ],
    689             'link_settings': { 'libraries': [ '-lgcov' ] },
    690           }],
    691           # Finally, for Windows, we simply turn on profiling.
    692           ['OS=="win"', {
    693             'msvs_settings': {
    694               'VCLinkerTool': {
    695                 'Profile': 'true',
    696               },
    697               'VCCLCompilerTool': {
    698                 # /Z7, not /Zi, so coverage is happyb
    699                 'DebugInformationFormat': '1',
    700                 'AdditionalOptions': ['/Yd'],
    701               }
    702             }
    703          }],  # OS==win
    704         ],  # conditions for coverage
    705       }],  # coverage!=0
    706       ['OS=="win"', {
    707         'defines': [
    708           '__STD_C',
    709           '_CRT_SECURE_NO_DEPRECATE',
    710           '_SCL_SECURE_NO_DEPRECATE',
    711         ],
    712         'include_dirs': [
    713           '<(DEPTH)/third_party/wtl/include',
    714         ],
    715       }],  # OS==win
    716     ],  # conditions for 'target_defaults'
    717     'target_conditions': [
    718       ['chromium_code==0', {
    719         'conditions': [
    720           [ 'OS=="linux" or OS=="freebsd" or OS=="openbsd"', {
    721             # We don't want to get warnings from third-party code,
    722             # so remove any existing warning-enabling flags like -Wall.
    723             'cflags!': [
    724               '-Wall',
    725               '-Wextra',
    726               '-Werror',
    727             ],
    728             'cflags': [
    729               # Don't warn about hash_map in third-party code.
    730               '-Wno-deprecated',
    731               # Don't warn about printf format problems.
    732               # This is off by default in gcc but on in Ubuntu's gcc(!).
    733               '-Wno-format',
    734             ],
    735           }],
    736           [ 'OS=="win"', {
    737             'defines': [
    738               '_CRT_SECURE_NO_DEPRECATE',
    739               '_CRT_NONSTDC_NO_WARNINGS',
    740               '_CRT_NONSTDC_NO_DEPRECATE',
    741               '_SCL_SECURE_NO_DEPRECATE',
    742             ],
    743             'msvs_disabled_warnings': [4800],
    744             'msvs_settings': {
    745               'VCCLCompilerTool': {
    746                 'WarnAsError': 'false',
    747                 'Detect64BitPortabilityProblems': 'false',
    748               },
    749             },
    750           }],
    751           [ 'OS=="mac"', {
    752             'xcode_settings': {
    753               'GCC_TREAT_WARNINGS_AS_ERRORS': 'NO',
    754               'WARNING_CFLAGS!': ['-Wall', '-Wextra'],
    755             },
    756           }],
    757         ],
    758       }, {
    759         # In Chromium code, we define __STDC_FORMAT_MACROS in order to get the
    760         # C99 macros on Mac and Linux.
    761         'defines': [
    762           '__STDC_FORMAT_MACROS',
    763         ],
    764         'conditions': [
    765           ['OS!="win"', {
    766             'sources/': [ ['exclude', '_win(_unittest)?\\.(h|cc)$'],
    767                           ['exclude', '(^|/)win/'],
    768                           ['exclude', '(^|/)win_[^/]*\\.(h|cc)$'] ],
    769           }],
    770           ['OS!="mac"', {
    771             'sources/': [ ['exclude', '_(cocoa|mac)(_unittest)?\\.(h|cc)$'],
    772                           ['exclude', '(^|/)(cocoa|mac)/'],
    773                           ['exclude', '\\.mm?$' ] ],
    774           }],
    775           ['OS!="linux" and OS!="freebsd" and OS!="openbsd"', {
    776             'sources/': [
    777               ['exclude', '_(chromeos|gtk|x|x11|xdg)(_unittest)?\\.(h|cc)$'],
    778               ['exclude', '(^|/)gtk/'],
    779               ['exclude', '(^|/)(gtk|x11)_[^/]*\\.(h|cc)$'],
    780             ],
    781           }],
    782           ['OS!="linux"', {
    783             'sources/': [
    784               ['exclude', '_linux(_unittest)?\\.(h|cc)$'],
    785               ['exclude', '(^|/)linux/'],
    786             ],
    787           }],
    788           # We use "POSIX" to refer to all non-Windows operating systems.
    789           ['OS=="win"', {
    790             'sources/': [ ['exclude', '_posix\\.(h|cc)$'] ],
    791             # turn on warnings for signed/unsigned mismatch on chromium code.
    792             'msvs_settings': {
    793               'VCCLCompilerTool': {
    794                 'AdditionalOptions': ['/we4389'],
    795               },
    796             },
    797           }],
    798           ['chromeos!=1', {
    799             'sources/': [ ['exclude', '_chromeos\\.(h|cc)$'] ]
    800           }],
    801           ['toolkit_views==0', {
    802             'sources/': [ ['exclude', '_views\\.(h|cc)$'] ]
    803           }],
    804         ],
    805       }],
    806     ],  # target_conditions for 'target_defaults'
    807     'default_configuration': 'Debug',
    808     'configurations': {
    809       # VCLinkerTool LinkIncremental values below:
    810       #   0 == default
    811       #   1 == /INCREMENTAL:NO
    812       #   2 == /INCREMENTAL
    813       # Debug links incremental, Release does not.
    814       #
    815       # Abstract base configurations to cover common attributes.
    816       #
    817       'Common_Base': {
    818         'abstract': 1,
    819         'msvs_configuration_attributes': {
    820           'OutputDirectory': '$(SolutionDir)$(ConfigurationName)',
    821           'IntermediateDirectory': '$(OutDir)\\obj\\$(ProjectName)',
    822           'CharacterSet': '1',
    823         },
    824       },
    825       'x86_Base': {
    826         'abstract': 1,
    827         'msvs_settings': {
    828           'VCLinkerTool': {
    829             'TargetMachine': '1',
    830           },
    831         },
    832         'msvs_configuration_platform': 'Win32',
    833       },
    834       'x64_Base': {
    835         'abstract': 1,
    836         'msvs_configuration_platform': 'x64',
    837         'msvs_settings': {
    838           'VCLinkerTool': {
    839             'TargetMachine': '17', # x86 - 64
    840             'AdditionalLibraryDirectories!':
    841               ['<(DEPTH)/third_party/platformsdk_win7/files/Lib'],
    842             'AdditionalLibraryDirectories':
    843               ['<(DEPTH)/third_party/platformsdk_win7/files/Lib/x64'],
    844           },
    845           'VCLibrarianTool': {
    846             'AdditionalLibraryDirectories!':
    847               ['<(DEPTH)/third_party/platformsdk_win7/files/Lib'],
    848             'AdditionalLibraryDirectories':
    849               ['<(DEPTH)/third_party/platformsdk_win7/files/Lib/x64'],
    850           },
    851         },
    852         'defines': [
    853           # Not sure if tcmalloc works on 64-bit Windows.
    854           'NO_TCMALLOC',
    855         ],
    856       },
    857       'Debug_Base': {
    858         'abstract': 1,
    859         'defines': [
    860           'DYNAMIC_ANNOTATIONS_ENABLED=1',
    861           'WTF_USE_DYNAMIC_ANNOTATIONS=1',
    862         ],
    863         'xcode_settings': {
    864           'COPY_PHASE_STRIP': 'NO',
    865           'GCC_OPTIMIZATION_LEVEL': '<(mac_debug_optimization)',
    866           'OTHER_CFLAGS': [ '<@(debug_extra_cflags)', ],
    867         },
    868         'msvs_settings': {
    869           'VCCLCompilerTool': {
    870             'Optimization': '<(win_debug_Optimization)',
    871             'PreprocessorDefinitions': ['_DEBUG'],
    872             'BasicRuntimeChecks': '<(win_debug_RuntimeChecks)',
    873             'RuntimeLibrary': '<(win_debug_RuntimeLibrary)',
    874             'conditions': [
    875               # According to MSVS, InlineFunctionExpansion=0 means
    876               # "default inlining", not "/Ob0".
    877               # Thus, we have to handle InlineFunctionExpansion==0 separately.
    878               ['win_debug_InlineFunctionExpansion==0', {
    879                 'AdditionalOptions': ['/Ob0'],
    880               }],
    881               ['win_debug_InlineFunctionExpansion!=""', {
    882                 'InlineFunctionExpansion':
    883                   '<(win_debug_InlineFunctionExpansion)',
    884               }],
    885               ['win_debug_disable_iterator_debugging==1', {
    886                 'PreprocessorDefinitions': ['_HAS_ITERATOR_DEBUGGING=0'],
    887               }],
    888             ],
    889           },
    890           'VCLinkerTool': {
    891             'LinkIncremental': '<(msvs_debug_link_incremental)',
    892           },
    893           'VCResourceCompilerTool': {
    894             'PreprocessorDefinitions': ['_DEBUG'],
    895           },
    896         },
    897         'conditions': [
    898           ['OS=="linux"', {
    899             'cflags': [
    900               '<@(debug_extra_cflags)',
    901             ],
    902           }],
    903         ],
    904       },
    905       'Release_Base': {
    906         'abstract': 1,
    907         'defines': [
    908           'NDEBUG',
    909         ],
    910         'xcode_settings': {
    911           'DEAD_CODE_STRIPPING': 'YES',  # -Wl,-dead_strip
    912           'GCC_OPTIMIZATION_LEVEL': '<(mac_release_optimization)',
    913           'OTHER_CFLAGS': [ '<@(release_extra_cflags)', ],
    914         },
    915         'msvs_settings': {
    916           'VCCLCompilerTool': {
    917             'Optimization': '<(win_release_Optimization)',
    918             'RuntimeLibrary': '<(win_release_RuntimeLibrary)',
    919             'conditions': [
    920               # According to MSVS, InlineFunctionExpansion=0 means
    921               # "default inlining", not "/Ob0".
    922               # Thus, we have to handle InlineFunctionExpansion==0 separately.
    923               ['win_release_InlineFunctionExpansion==0', {
    924                 'AdditionalOptions': ['/Ob0'],
    925               }],
    926               ['win_release_InlineFunctionExpansion!=""', {
    927                 'InlineFunctionExpansion':
    928                   '<(win_release_InlineFunctionExpansion)',
    929               }],
    930             ],
    931           },
    932           'VCLinkerTool': {
    933             'LinkIncremental': '1',
    934           },
    935         },
    936         'conditions': [
    937           ['release_valgrind_build==0', {
    938             'defines': [
    939               'NVALGRIND',
    940               'DYNAMIC_ANNOTATIONS_ENABLED=0',
    941             ],
    942           }, {
    943             'defines': [
    944               'DYNAMIC_ANNOTATIONS_ENABLED=1',
    945               'WTF_USE_DYNAMIC_ANNOTATIONS=1',
    946             ],
    947           }],
    948           ['win_use_allocator_shim==0', {
    949             'defines': ['NO_TCMALLOC'],
    950           }],
    951           ['OS=="linux"', {
    952             'cflags': [
    953              '<@(release_extra_cflags)',
    954             ],
    955           }],
    956         ],
    957       },
    958       'Purify_Base': {
    959         'abstract': 1,
    960         'defines': [
    961           'PURIFY',
    962           'NO_TCMALLOC',
    963         ],
    964         'msvs_settings': {
    965           'VCCLCompilerTool': {
    966             'Optimization': '0',
    967             'RuntimeLibrary': '0',
    968             'BufferSecurityCheck': 'false',
    969           },
    970           'VCLinkerTool': {
    971             'EnableCOMDATFolding': '1',
    972             'LinkIncremental': '1',
    973           },
    974         },
    975       },
    976       #
    977       # Concrete configurations
    978       #
    979       'Debug': {
    980         'inherit_from': ['Common_Base', 'x86_Base', 'Debug_Base'],
    981       },
    982       'Release': {
    983         'inherit_from': ['Common_Base', 'x86_Base', 'Release_Base'],
    984         'conditions': [
    985           ['msvs_use_common_release', {
    986             'includes': ['release.gypi'],
    987           }],
    988         ]
    989       },
    990       'conditions': [
    991         [ 'OS=="win"', {
    992           # TODO(bradnelson): add a gyp mechanism to make this more graceful.
    993           'Purify': {
    994             'inherit_from': ['Common_Base', 'x86_Base', 'Release_Base', 'Purify'],
    995           },
    996           'Debug_x64': {
    997             'inherit_from': ['Common_Base', 'x64_Base', 'Debug_Base'],
    998           },
    999           'Release_x64': {
   1000             'inherit_from': ['Common_Base', 'x64_Base', 'Release_Base'],
   1001           },
   1002           'Purify_x64': {
   1003             'inherit_from': ['Common_Base', 'x64_Base', 'Release_Base', 'Purify_Base'],
   1004           },
   1005         }],
   1006       ],
   1007     },
   1008   },
   1009   'conditions': [
   1010     ['OS=="linux" or OS=="freebsd" or OS=="openbsd" or OS=="solaris"', {
   1011       'target_defaults': {
   1012         # Enable -Werror by default, but put it in a variable so it can
   1013         # be disabled in ~/.gyp/include.gypi on the valgrind builders.
   1014         'variables': {
   1015           # Use -fno-strict-aliasing by default since gcc 4.4 has periodic
   1016           # issues that slip through the cracks. We could do this just for
   1017           # gcc 4.4 but it makes more sense to be consistent on all
   1018           # compilers in use. TODO(Craig): turn this off again when
   1019           # there is some 4.4 test infrastructure in place and existing
   1020           # aliasing issues have been fixed.
   1021           'no_strict_aliasing%': 1,
   1022           'conditions': [['OS=="linux"', {'werror%': '-Werror',}],
   1023                          ['OS=="freebsd"', {'werror%': '',}],
   1024                          ['OS=="openbsd"', {'werror%': '',}],
   1025           ],
   1026         },
   1027         'cflags': [
   1028           '<(werror)',  # See note above about the werror variable.
   1029           '-pthread',
   1030           '-fno-exceptions',
   1031           '-Wall',
   1032           # TODO(evan): turn this back on once all the builds work.
   1033           # '-Wextra',
   1034           # Don't warn about unused function params.  We use those everywhere.
   1035           '-Wno-unused-parameter',
   1036           # Don't warn about the "struct foo f = {0};" initialization pattern.
   1037           '-Wno-missing-field-initializers',
   1038           '-D_FILE_OFFSET_BITS=64',
   1039           # Don't export any symbols (for example, to plugins we dlopen()).
   1040           # Note: this is *required* to make some plugins work.
   1041           '-fvisibility=hidden',
   1042           '-pipe',
   1043         ],
   1044         'cflags_cc': [
   1045           '-fno-rtti',
   1046           '-fno-threadsafe-statics',
   1047           # Make inline functions have hidden visiblity by default.
   1048           # Surprisingly, not covered by -fvisibility=hidden.
   1049           '-fvisibility-inlines-hidden',
   1050         ],
   1051         'ldflags': [
   1052           '-pthread', '-Wl,-z,noexecstack',
   1053         ],
   1054         'configurations': {
   1055           'Debug_Base': {
   1056             'variables': {
   1057               'debug_optimize%': '0',
   1058             },
   1059             'defines': [
   1060               '_DEBUG',
   1061             ],
   1062             'cflags': [
   1063               '-O>(debug_optimize)',
   1064               '-g',
   1065             ],
   1066           },
   1067           'Release_Base': {
   1068             'variables': {
   1069               'release_optimize%': '2',
   1070               # Binaries become big and gold is unable to perform GC
   1071               # and remove unused sections for some of test targets
   1072               # on 32 bit platform.
   1073               # (This is currently observed only in chromeos valgrind bots)
   1074               # The following flag is to disable --gc-sections linker
   1075               # option for these bots.
   1076               'no_gc_sections%': 0,
   1077             },
   1078             'cflags': [
   1079               '-O>(release_optimize)',
   1080               # Don't emit the GCC version ident directives, they just end up
   1081               # in the .comment section taking up binary size.
   1082               '-fno-ident',
   1083               # Put data and code in their own sections, so that unused symbols
   1084               # can be removed at link time with --gc-sections.
   1085               '-fdata-sections',
   1086               '-ffunction-sections',
   1087             ],
   1088             'ldflags': [
   1089               # Specifically tell the linker to perform optimizations.
   1090               # See http://lwn.net/Articles/192624/ .
   1091               '-Wl,-O1',
   1092               '-Wl,--as-needed',
   1093             ],
   1094             'conditions' : [
   1095               ['no_gc_sections==0', {
   1096                 'ldflags': [
   1097                   '-Wl,--gc-sections',
   1098                 ],
   1099               }],
   1100               ['clang==1', {
   1101                 'cflags!': [
   1102                   '-fno-ident',
   1103                 ],
   1104               }],
   1105               ['profiling==1', {
   1106                 'cflags': [
   1107                   '-fno-omit-frame-pointer',
   1108                   '-g',
   1109                 ],
   1110               }],
   1111             ]
   1112           },
   1113         },
   1114         'variants': {
   1115           'coverage': {
   1116             'cflags': ['-fprofile-arcs', '-ftest-coverage'],
   1117             'ldflags': ['-fprofile-arcs'],
   1118           },
   1119           'profile': {
   1120             'cflags': ['-pg', '-g'],
   1121             'ldflags': ['-pg'],
   1122           },
   1123           'symbols': {
   1124             'cflags': ['-g'],
   1125           },
   1126         },
   1127         'conditions': [
   1128           [ 'target_arch=="ia32"', {
   1129             'asflags': [
   1130               # Needed so that libs with .s files (e.g. libicudata.a)
   1131               # are compatible with the general 32-bit-ness.
   1132               '-32',
   1133             ],
   1134             # All floating-point computations on x87 happens in 80-bit
   1135             # precision.  Because the C and C++ language standards allow
   1136             # the compiler to keep the floating-point values in higher
   1137             # precision than what's specified in the source and doing so
   1138             # is more efficient than constantly rounding up to 64-bit or
   1139             # 32-bit precision as specified in the source, the compiler,
   1140             # especially in the optimized mode, tries very hard to keep
   1141             # values in x87 floating-point stack (in 80-bit precision)
   1142             # as long as possible. This has important side effects, that
   1143             # the real value used in computation may change depending on
   1144             # how the compiler did the optimization - that is, the value
   1145             # kept in 80-bit is different than the value rounded down to
   1146             # 64-bit or 32-bit. There are possible compiler options to make
   1147             # this behavior consistent (e.g. -ffloat-store would keep all
   1148             # floating-values in the memory, thus force them to be rounded
   1149             # to its original precision) but they have significant runtime
   1150             # performance penalty.
   1151             #
   1152             # -mfpmath=sse -msse2 makes the compiler use SSE instructions
   1153             # which keep floating-point values in SSE registers in its
   1154             # native precision (32-bit for single precision, and 64-bit for
   1155             # double precision values). This means the floating-point value
   1156             # used during computation does not change depending on how the
   1157             # compiler optimized the code, since the value is always kept
   1158             # in its specified precision.
   1159             'conditions': [
   1160               ['branding=="Chromium" and disable_sse2==0', {
   1161                 'cflags': [
   1162                   '-march=pentium4',
   1163                   '-msse2',
   1164                   '-mfpmath=sse',
   1165                 ],
   1166               }],
   1167               # ChromeOS targets Pinetrail, which is sse3, but most of the
   1168               # benefit comes from sse2 so this setting allows ChromeOS
   1169               # to build on other CPUs.  In the future -march=atom would help
   1170               # but requires a newer compiler.
   1171               ['chromeos==1 and disable_sse2==0', {
   1172                 'cflags': [
   1173                   '-msse2',
   1174                 ],
   1175               }],
   1176               # Install packages have started cropping up with
   1177               # different headers between the 32-bit and 64-bit
   1178               # versions, so we have to shadow those differences off
   1179               # and make sure a 32-bit-on-64-bit build picks up the
   1180               # right files.
   1181               ['host_arch!="ia32"', {
   1182                 'include_dirs+': [
   1183                   '/usr/include32',
   1184                 ],
   1185               }],
   1186             ],
   1187             # -mmmx allows mmintrin.h to be used for mmx intrinsics.
   1188             # video playback is mmx and sse2 optimized.
   1189             'cflags': [
   1190               '-m32',
   1191               '-mmmx',
   1192             ],
   1193             'ldflags': [
   1194               '-m32',
   1195             ],
   1196           }],
   1197           ['target_arch=="arm"', {
   1198             'target_conditions': [
   1199               ['_toolset=="target"', {
   1200                 'cflags_cc': [
   1201                   # The codesourcery arm-2009q3 toolchain warns at that the ABI
   1202                   # has changed whenever it encounters a varargs function. This
   1203                   # silences those warnings, as they are not helpful and
   1204                   # clutter legitimate warnings.
   1205                   '-Wno-abi',
   1206                 ],
   1207                 'conditions': [
   1208                   ['arm_thumb == 1', {
   1209                     'cflags': [
   1210                     '-mthumb',
   1211                     # TODO(piman): -Wa,-mimplicit-it=thumb is needed for
   1212                     # inline assembly that uses condition codes but it's
   1213                     # suboptimal. Better would be to #ifdef __thumb__ at the
   1214                     # right place and have a separate thumb path.
   1215                     '-Wa,-mimplicit-it=thumb',
   1216                     ]
   1217                   }],
   1218                   ['armv7==1', {
   1219                     'cflags': [
   1220                       '-march=armv7-a',
   1221                       '-mtune=cortex-a8',
   1222                       '-mfloat-abi=softfp',
   1223                     ],
   1224                     'conditions': [
   1225                       ['arm_neon==1', {
   1226                         'cflags': [ '-mfpu=neon', ],
   1227                       }, {
   1228                         'cflags': [ '-mfpu=<(arm_fpu)', ],
   1229                       }]
   1230                     ],
   1231                   }],
   1232                 ],
   1233               }],
   1234             ],
   1235           }],
   1236           ['linux_fpic==1', {
   1237             'cflags': [
   1238               '-fPIC',
   1239             ],
   1240           }],
   1241           ['sysroot!=""', {
   1242             'target_conditions': [
   1243               ['_toolset=="target"', {
   1244                 'cflags': [
   1245                   '--sysroot=<(sysroot)',
   1246                 ],
   1247                 'ldflags': [
   1248                   '--sysroot=<(sysroot)',
   1249                 ],
   1250               }]]
   1251           }],
   1252           ['clang==1', {
   1253             'target_conditions': [
   1254               ['_toolset=="target"', {
   1255                 'cflags': [
   1256                   '-Wheader-hygiene',
   1257                   # Clang spots more unused functions.
   1258                   '-Wno-unused-function',
   1259                   # Don't die on dtoa code that uses a char as an array index.
   1260                   '-Wno-char-subscripts',
   1261                   # Survive EXPECT_EQ(unnamed_enum, unsigned int) -- see
   1262                   # http://code.google.com/p/googletest/source/detail?r=446 .
   1263                   # TODO(thakis): Use -isystem instead (http://crbug.com/58751 )
   1264                   '-Wno-unnamed-type-template-args',
   1265                 ],
   1266                 'cflags!': [
   1267                   # Clang doesn't seem to know know this flag.
   1268                   '-mfpmath=sse',
   1269                 ],
   1270               }]],
   1271           }],
   1272           ['clang==1 and clang_use_chrome_plugins==1', {
   1273             'target_conditions': [
   1274               ['_toolset=="target"', {
   1275                 'cflags': [
   1276                   '<(clang_chrome_plugins_flags)',
   1277                 ],
   1278               }]],
   1279           }],
   1280           ['clang==1 and clang_load!="" and clang_add_plugin!=""', {
   1281             'target_conditions': [
   1282               ['_toolset=="target"', {
   1283                 'cflags': [
   1284                   '-Xclang', '-load', '-Xclang', '<(clang_load)',
   1285                   '-Xclang', '-add-plugin', '-Xclang', '<(clang_add_plugin)',
   1286                 ],
   1287               }]],
   1288           }],
   1289           ['no_strict_aliasing==1', {
   1290             'cflags': [
   1291               '-fno-strict-aliasing',
   1292             ],
   1293           }],
   1294           ['linux_breakpad==1', {
   1295             'cflags': [ '-g' ],
   1296             'defines': ['USE_LINUX_BREAKPAD'],
   1297           }],
   1298           ['library=="shared_library"', {
   1299             # When building with shared libraries, remove the visiblity-hiding
   1300             # flag.
   1301             'cflags!': [ '-fvisibility=hidden' ],
   1302             'conditions': [
   1303               ['target_arch=="x64" or target_arch=="arm"', {
   1304                 # Shared libraries need -fPIC on x86-64 and arm
   1305                 'cflags': ['-fPIC']
   1306               }]
   1307             ],
   1308             'ldflags!': [
   1309               # --as-needed confuses library interdependencies.
   1310               # See http://code.google.com/p/chromium/issues/detail?id=61430
   1311               '-Wl,--as-needed',
   1312             ],
   1313           }],
   1314           ['linux_use_heapchecker==1', {
   1315             'variables': {'linux_use_tcmalloc%': 1},
   1316           }],
   1317           ['linux_use_tcmalloc==0', {
   1318             'defines': ['NO_TCMALLOC'],
   1319           }],
   1320           ['linux_use_heapchecker==0', {
   1321             'defines': ['NO_HEAPCHECKER'],
   1322           }],
   1323           ['linux_keep_shadow_stacks==1', {
   1324             'defines': ['KEEP_SHADOW_STACKS'],
   1325             'cflags': ['-finstrument-functions'],
   1326           }],
   1327         ],
   1328       },
   1329     }],
   1330     # FreeBSD-specific options; note that most FreeBSD options are set above,
   1331     # with Linux.
   1332     ['OS=="freebsd"', {
   1333       'target_defaults': {
   1334         'ldflags': [
   1335           '-Wl,--no-keep-memory',
   1336         ],
   1337       },
   1338     }],
   1339     ['OS=="solaris"', {
   1340       'cflags!': ['-fvisibility=hidden'],
   1341       'cflags_cc!': ['-fvisibility-inlines-hidden'],
   1342     }],
   1343     ['OS=="mac"', {
   1344       'target_defaults': {
   1345         'variables': {
   1346           # These should be 'mac_real_dsym%' and 'mac_strip%', but there
   1347           # seems to be a bug with % in variables that are intended to be
   1348           # set to different values in different targets, like these two.
   1349           'mac_strip': 1,      # Strip debugging symbols from the target.
   1350           'mac_real_dsym': 0,  # Fake .dSYMs are fine in most cases.
   1351         },
   1352         'mac_bundle': 0,
   1353         'xcode_settings': {
   1354           'ALWAYS_SEARCH_USER_PATHS': 'NO',
   1355           'GCC_C_LANGUAGE_STANDARD': 'c99',         # -std=c99
   1356           'GCC_CW_ASM_SYNTAX': 'NO',                # No -fasm-blocks
   1357           'GCC_DYNAMIC_NO_PIC': 'NO',               # No -mdynamic-no-pic
   1358                                                     # (Equivalent to -fPIC)
   1359           'GCC_ENABLE_CPP_EXCEPTIONS': 'NO',        # -fno-exceptions
   1360           'GCC_ENABLE_CPP_RTTI': 'NO',              # -fno-rtti
   1361           'GCC_ENABLE_PASCAL_STRINGS': 'NO',        # No -mpascal-strings
   1362           # GCC_INLINES_ARE_PRIVATE_EXTERN maps to -fvisibility-inlines-hidden
   1363           'GCC_INLINES_ARE_PRIVATE_EXTERN': 'YES',
   1364           'GCC_OBJC_CALL_CXX_CDTORS': 'YES',        # -fobjc-call-cxx-cdtors
   1365           'GCC_SYMBOLS_PRIVATE_EXTERN': 'YES',      # -fvisibility=hidden
   1366           'GCC_THREADSAFE_STATICS': 'NO',           # -fno-threadsafe-statics
   1367           'GCC_TREAT_WARNINGS_AS_ERRORS': 'YES',    # -Werror
   1368           'GCC_VERSION': '4.2',
   1369           'GCC_WARN_ABOUT_MISSING_NEWLINE': 'YES',  # -Wnewline-eof
   1370           # MACOSX_DEPLOYMENT_TARGET maps to -mmacosx-version-min
   1371           'MACOSX_DEPLOYMENT_TARGET': '<(mac_deployment_target)',
   1372           'PREBINDING': 'NO',                       # No -Wl,-prebind
   1373           'USE_HEADERMAP': 'NO',
   1374           'WARNING_CFLAGS': [
   1375             '-Wall',
   1376             '-Wendif-labels',
   1377             '-Wextra',
   1378             # Don't warn about unused function parameters.
   1379             '-Wno-unused-parameter',
   1380             # Don't warn about the "struct foo f = {0};" initialization
   1381             # pattern.
   1382             '-Wno-missing-field-initializers',
   1383           ],
   1384           'conditions': [
   1385             ['chromium_mac_pch', {'GCC_PRECOMPILE_PREFIX_HEADER': 'YES'},
   1386                                  {'GCC_PRECOMPILE_PREFIX_HEADER': 'NO'}
   1387             ],
   1388             ['clang==1', {
   1389               'WARNING_CFLAGS': [
   1390                 '-Wheader-hygiene',
   1391                 # Don't die on dtoa code that uses a char as an array index.
   1392                 # This is required solely for base/third_party/dmg_fp/dtoa.cc.
   1393                 '-Wno-char-subscripts',
   1394                 # Clang spots more unused functions.
   1395                 '-Wno-unused-function',
   1396                 # Survive EXPECT_EQ(unnamed_enum, unsigned int) -- see
   1397                 # http://code.google.com/p/googletest/source/detail?r=446 .
   1398                 # TODO(thakis): Use -isystem instead (http://crbug.com/58751 ).
   1399                 '-Wno-unnamed-type-template-args',
   1400               ],
   1401               'OTHER_CFLAGS': [
   1402                 # TODO(thakis): Causes many warnings - http://crbug.com/75001
   1403                 '-fobjc-exceptions',
   1404               ],
   1405             }],
   1406             ['clang==1 and clang_use_chrome_plugins==1', {
   1407               'OTHER_CFLAGS': [
   1408                 '<(clang_chrome_plugins_flags)',
   1409               ],
   1410             }],
   1411             ['clang==1 and clang_load!="" and clang_add_plugin!=""', {
   1412               'OTHER_CFLAGS': [
   1413                 '-Xclang', '-load', '-Xclang', '<(clang_load)',
   1414                 '-Xclang', '-add-plugin', '-Xclang', '<(clang_add_plugin)',
   1415               ],
   1416             }],
   1417           ],
   1418         },
   1419         'target_conditions': [
   1420           ['_type!="static_library"', {
   1421             'xcode_settings': {'OTHER_LDFLAGS': ['-Wl,-search_paths_first']},
   1422           }],
   1423           ['_mac_bundle', {
   1424             'xcode_settings': {'OTHER_LDFLAGS': ['-Wl,-ObjC']},
   1425           }],
   1426           ['(_type=="executable" or _type=="shared_library" or \
   1427              _type=="loadable_module") and mac_strip!=0', {
   1428             'target_conditions': [
   1429               ['mac_real_dsym == 1', {
   1430                 # To get a real .dSYM bundle produced by dsymutil, set the
   1431                 # debug information format to dwarf-with-dsym.  Since
   1432                 # strip_from_xcode will not be used, set Xcode to do the
   1433                 # stripping as well.
   1434                 'configurations': {
   1435                   'Release_Base': {
   1436                     'xcode_settings': {
   1437                       'DEBUG_INFORMATION_FORMAT': 'dwarf-with-dsym',
   1438                       'DEPLOYMENT_POSTPROCESSING': 'YES',
   1439                       'STRIP_INSTALLED_PRODUCT': 'YES',
   1440                       'target_conditions': [
   1441                         ['_type=="shared_library" or _type=="loadable_module"', {
   1442                           # The Xcode default is to strip debugging symbols
   1443                           # only (-S).  Local symbols should be stripped as
   1444                           # well, which will be handled by -x.  Xcode will
   1445                           # continue to insert -S when stripping even when
   1446                           # additional flags are added with STRIPFLAGS.
   1447                           'STRIPFLAGS': '-x',
   1448                         }],  # _type=="shared_library" or _type=="loadable_module"'
   1449                       ],  # target_conditions
   1450                     },  # xcode_settings
   1451                   },  # configuration "Release"
   1452                 },  # configurations
   1453               }, {  # mac_real_dsym != 1
   1454                 # To get a fast fake .dSYM bundle, use a post-build step to
   1455                 # produce the .dSYM and strip the executable.  strip_from_xcode
   1456                 # only operates in the Release configuration.
   1457                 'postbuilds': [
   1458                   {
   1459                     'variables': {
   1460                       # Define strip_from_xcode in a variable ending in _path
   1461                       # so that gyp understands it's a path and performs proper
   1462                       # relativization during dict merging.
   1463                       'strip_from_xcode_path': 'mac/strip_from_xcode',
   1464                     },
   1465                     'postbuild_name': 'Strip If Needed',
   1466                     'action': ['<(strip_from_xcode_path)'],
   1467                   },
   1468                 ],  # postbuilds
   1469               }],  # mac_real_dsym
   1470             ],  # target_conditions
   1471           }],  # (_type=="executable" or _type=="shared_library" or
   1472                #  _type=="loadable_module") and mac_strip!=0
   1473         ],  # target_conditions
   1474       },  # target_defaults
   1475     }],  # OS=="mac"
   1476     ['OS=="win"', {
   1477       'target_defaults': {
   1478         'defines': [
   1479           '_WIN32_WINNT=0x0600',
   1480           'WINVER=0x0600',
   1481           'WIN32',
   1482           '_WINDOWS',
   1483           'NOMINMAX',
   1484           '_CRT_RAND_S',
   1485           'CERT_CHAIN_PARA_HAS_EXTRA_FIELDS',
   1486           'WIN32_LEAN_AND_MEAN',
   1487           '_ATL_NO_OPENGL',
   1488           '_HAS_TR1=0',
   1489         ],
   1490         'conditions': [
   1491           ['component=="static_library"', {
   1492             'defines': [
   1493               '_HAS_EXCEPTIONS=0',
   1494             ],
   1495           }],
   1496           ['secure_atl', {
   1497             'defines': [
   1498               '_SECURE_ATL',
   1499             ],
   1500           }],
   1501         ],
   1502         'msvs_system_include_dirs': [
   1503           '<(DEPTH)/third_party/platformsdk_win7/files/Include',
   1504           '<(DEPTH)/third_party/directxsdk/files/Include',
   1505           '$(VSInstallDir)/VC/atlmfc/include',
   1506         ],
   1507         'msvs_cygwin_dirs': ['<(DEPTH)/third_party/cygwin'],
   1508         'msvs_disabled_warnings': [4351, 4396, 4503, 4819],
   1509         'msvs_settings': {
   1510           'VCCLCompilerTool': {
   1511             'MinimalRebuild': 'false',
   1512             'BufferSecurityCheck': 'true',
   1513             'EnableFunctionLevelLinking': 'true',
   1514             'RuntimeTypeInfo': 'false',
   1515             'WarningLevel': '3',
   1516             'WarnAsError': 'true',
   1517             'DebugInformationFormat': '3',
   1518             'conditions': [
   1519               ['msvs_multi_core_compile', {
   1520                 'AdditionalOptions': ['/MP'],
   1521               }],
   1522               ['MSVS_VERSION=="2005e"', {
   1523                 'AdditionalOptions': ['/w44068'], # Unknown pragma to 4 (ATL)
   1524               }],
   1525               ['component=="shared_library"', {
   1526                 'ExceptionHandling': '1',  # /EHsc
   1527               }, {
   1528                 'ExceptionHandling': '0',
   1529               }],
   1530             ],
   1531           },
   1532           'VCLibrarianTool': {
   1533             'AdditionalOptions': ['/ignore:4221'],
   1534             'AdditionalLibraryDirectories': [
   1535               '<(DEPTH)/third_party/platformsdk_win7/files/Lib',
   1536               '<(DEPTH)/third_party/directxsdk/files/Lib/x86',
   1537             ],
   1538           },
   1539           'VCLinkerTool': {
   1540             'AdditionalDependencies': [
   1541               'wininet.lib',
   1542               'dnsapi.lib',
   1543               'version.lib',
   1544               'msimg32.lib',
   1545               'ws2_32.lib',
   1546               'usp10.lib',
   1547               'psapi.lib',
   1548               'dbghelp.lib',
   1549             ],
   1550             'conditions': [
   1551               ['msvs_express', {
   1552                 # Explicitly required when using the ATL with express
   1553                 'AdditionalDependencies': [
   1554                   'atlthunk.lib',
   1555                 ],
   1556               }],
   1557               ['MSVS_VERSION=="2005e"', {
   1558                 # Non-express versions link automatically to these
   1559                 'AdditionalDependencies': [
   1560                   'advapi32.lib',
   1561                   'comdlg32.lib',
   1562                   'ole32.lib',
   1563                   'shell32.lib',
   1564                   'user32.lib',
   1565                   'winspool.lib',
   1566                 ],
   1567               }],
   1568             ],
   1569             'AdditionalLibraryDirectories': [
   1570               '<(DEPTH)/third_party/platformsdk_win7/files/Lib',
   1571               '<(DEPTH)/third_party/directxsdk/files/Lib/x86',
   1572             ],
   1573             'GenerateDebugInformation': 'true',
   1574             'MapFileName': '$(OutDir)\\$(TargetName).map',
   1575             'ImportLibrary': '$(OutDir)\\lib\\$(TargetName).lib',
   1576             'FixedBaseAddress': '1',
   1577             # SubSystem values:
   1578             #   0 == not set
   1579             #   1 == /SUBSYSTEM:CONSOLE
   1580             #   2 == /SUBSYSTEM:WINDOWS
   1581             # Most of the executables we'll ever create are tests
   1582             # and utilities with console output.
   1583             'SubSystem': '1',
   1584           },
   1585           'VCMIDLTool': {
   1586             'GenerateStublessProxies': 'true',
   1587             'TypeLibraryName': '$(InputName).tlb',
   1588             'OutputDirectory': '$(IntDir)',
   1589             'HeaderFileName': '$(InputName).h',
   1590             'DLLDataFileName': 'dlldata.c',
   1591             'InterfaceIdentifierFileName': '$(InputName)_i.c',
   1592             'ProxyFileName': '$(InputName)_p.c',
   1593           },
   1594           'VCResourceCompilerTool': {
   1595             'Culture' : '1033',
   1596             'AdditionalIncludeDirectories': [
   1597               '<(DEPTH)',
   1598               '<(SHARED_INTERMEDIATE_DIR)',
   1599             ],
   1600           },
   1601         },
   1602       },
   1603     }],
   1604     ['disable_nacl==1 or OS=="freebsd" or OS=="openbsd" or OS=="solaris"', {
   1605       'target_defaults': {
   1606         'defines': [
   1607           'DISABLE_NACL',
   1608         ],
   1609       },
   1610     }],
   1611     ['OS=="win" and msvs_use_common_linker_extras', {
   1612       'target_defaults': {
   1613         'msvs_settings': {
   1614           'VCLinkerTool': {
   1615             'DelayLoadDLLs': [
   1616               'dbghelp.dll',
   1617               'dwmapi.dll',
   1618               'uxtheme.dll',
   1619             ],
   1620           },
   1621         },
   1622         'configurations': {
   1623           'x86_Base': {
   1624             'msvs_settings': {
   1625               'VCLinkerTool': {
   1626                 'AdditionalOptions': [
   1627                   '/safeseh',
   1628                   '/dynamicbase',
   1629                   '/ignore:4199',
   1630                   '/ignore:4221',
   1631                   '/nxcompat',
   1632                 ],
   1633               },
   1634             },
   1635           },
   1636           'x64_Base': {
   1637             'msvs_settings': {
   1638               'VCLinkerTool': {
   1639                 'AdditionalOptions': [
   1640                   # safeseh is not compatible with x64
   1641                   '/dynamicbase',
   1642                   '/ignore:4199',
   1643                   '/ignore:4221',
   1644                   '/nxcompat',
   1645                 ],
   1646               },
   1647             },
   1648           },
   1649         },
   1650       },
   1651     }],
   1652     ['enable_new_npdevice_api==1', {
   1653       'target_defaults': {
   1654         'defines': [
   1655           'ENABLE_NEW_NPDEVICE_API',
   1656         ],
   1657       },
   1658     }],
   1659   ],
   1660   'xcode_settings': {
   1661     # DON'T ADD ANYTHING NEW TO THIS BLOCK UNLESS YOU REALLY REALLY NEED IT!
   1662     # This block adds *project-wide* configuration settings to each project
   1663     # file.  It's almost always wrong to put things here.  Specify your
   1664     # custom xcode_settings in target_defaults to add them to targets instead.
   1665 
   1666     # In an Xcode Project Info window, the "Base SDK for All Configurations"
   1667     # setting sets the SDK on a project-wide basis.  In order to get the
   1668     # configured SDK to show properly in the Xcode UI, SDKROOT must be set
   1669     # here at the project level.
   1670     'SDKROOT': 'macosx<(mac_sdk)',  # -isysroot
   1671 
   1672     # The Xcode generator will look for an xcode_settings section at the root
   1673     # of each dict and use it to apply settings on a file-wide basis.  Most
   1674     # settings should not be here, they should be in target-specific
   1675     # xcode_settings sections, or better yet, should use non-Xcode-specific
   1676     # settings in target dicts.  SYMROOT is a special case, because many other
   1677     # Xcode variables depend on it, including variables such as
   1678     # PROJECT_DERIVED_FILE_DIR.  When a source group corresponding to something
   1679     # like PROJECT_DERIVED_FILE_DIR is added to a project, in order for the
   1680     # files to appear (when present) in the UI as actual files and not red
   1681     # red "missing file" proxies, the correct path to PROJECT_DERIVED_FILE_DIR,
   1682     # and therefore SYMROOT, needs to be set at the project level.
   1683     'SYMROOT': '<(DEPTH)/xcodebuild',
   1684   },
   1685 }
   1686 
   1687 # Local Variables:
   1688 # tab-width:2
   1689 # indent-tabs-mode:nil
   1690 # End:
   1691 # vim: set expandtab tabstop=2 shiftwidth=2:
   1692