1 # Copyright (c) 2010, Google Inc.
4 # Redistribution and use in source and binary forms, with or without
5 # modification, are permitted provided that the following conditions are
8 # * Redistributions of source code must retain the above copyright
9 # notice, this list of conditions and the following disclaimer.
10 # * Redistributions in binary form must reproduce the above
11 # copyright notice, this list of conditions and the following disclaimer
12 # in the documentation and/or other materials provided with the
14 # * Neither the name of Google Inc. nor the names of its
15 # contributors may be used to endorse or promote products derived from
16 # this software without specific prior written permission.
18 # THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
19 # "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
20 # LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
21 # A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
22 # OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
23 # SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
24 # LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
25 # DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
26 # THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
27 # (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
28 # OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
31 # Please don't directly include this file if you are building via gyp_chromium,
32 # since gyp_chromium is automatically forcing its inclusion.
35 # .gyp files or targets should set chromium_code to 1 if they build
36 # Chromium-specific code, as opposed to external code. This variable is
37 # used to control such things as the set of warnings to enable, and
38 # whether warnings are treated as errors.
41 # Variables expected to be overriden on the GYP command line (-D) or by
42 # ~/.gyp/include.gypi.
44 # Putting a variables dict inside another variables dict looks kind of
45 # weird. This is done so that "branding" and "buildtype" are defined as
46 # variables within the outer variables dict here. This is necessary
47 # to get these variables defined for the conditions within this variables
48 # dict that operate on these variables.
50 # Override branding to select the desired branding flavor.
51 'branding%': 'Chromium',
53 # Override buildtype to select the desired build flavor.
54 # Dev - everyday build for development/testing
55 # Official - release build (generally implies additional processing)
56 # TODO(mmoss) Once 'buildtype' is fully supported (e.g. Windows gyp
57 # conversion is done), some of the things which are now controlled by
58 # 'branding', such as symbol generation, will need to be refactored based
59 # on 'buildtype' (i.e. we don't care about saving symbols for non-Official
64 # Compute the architecture that we're building on.
66 [ 'OS=="linux" or OS=="freebsd" or OS=="openbsd"', {
67 # This handles the Linux platforms we generally deal with. Anything
68 # else gets passed through, which probably won't work very well; such
69 # hosts should pass an explicit target_arch to gyp.
71 '<!(uname -m | sed -e "s/i.86/ia32/;s/x86_64/x64/;s/amd64/x64/;s/arm.*/arm/")',
77 # Whether we're building a ChromeOS build. We set the initial
78 # value at this level of nesting so it's available for the
79 # toolkit_views test below.
83 # Set default value of toolkit_views on for Windows and Chrome OS.
84 # We set it at this level of nesting so the value is available for
85 # other conditionals below.
87 ['OS=="win" or chromeos==1', {
94 'host_arch%': '<(host_arch)',
96 # Default architecture we're building for is the architecture we're
98 'target_arch%': '<(host_arch)',
100 # We do want to build Chromium with Breakpad support in certain
101 # situations. I.e. for Chrome bot.
102 'linux_chromium_breakpad%': 0,
103 # And if we want to dump symbols.
104 'linux_chromium_dump_symbols%': 0,
105 # Also see linux_strip_binary below.
107 # Copy conditionally-set chromeos variable out one scope.
108 'chromeos%': '<(chromeos)',
110 # This variable tells WebCore.gyp and JavaScriptCore.gyp whether they are
111 # are built under a chromium full build (1) or a webkit.org chromium
113 'inside_chromium_build%': 1,
115 # Set to 1 to enable fast builds. It disables debug info for fastest
119 # Set to 1 compile with -fPIC cflag on linux. This is a must for shared
120 # libraries on linux x86-64 and arm.
124 'python_ver%': '2.5',
126 # Determine ARM compilation flags.
129 # Set Neon compilation flags (only meaningful if arm_version==7).
132 # The system root for cross-compiles. Default: none.
135 # On Linux, we build with sse2 for Chromium builds.
139 # Define branding and buildtype on the basis of their settings within the
140 # variables sub-dict above, unless overridden.
141 'branding%': '<(branding)',
142 'buildtype%': '<(buildtype)',
143 'target_arch%': '<(target_arch)',
144 'host_arch%': '<(host_arch)',
145 'toolkit_views%': '<(toolkit_views)',
146 'chromeos%': '<(chromeos)',
147 'inside_chromium_build%': '<(inside_chromium_build)',
148 'fastbuild%': '<(fastbuild)',
149 'linux_fpic%': '<(linux_fpic)',
150 'python_ver%': '<(python_ver)',
151 'arm_version%': '<(arm_version)',
152 'arm_neon%': '<(arm_neon)',
153 'sysroot%': '<(sysroot)',
154 'disable_sse2%': '<(disable_sse2)',
156 # The release channel that this build targets. This is used to restrict
157 # channel-specific build options, like which installer packages to create.
158 # The default is 'all', which does no channel-specific filtering.
161 # Override chromium_mac_pch and set it to 0 to suppress the use of
162 # precompiled headers on the Mac. Prefix header injection may still be
163 # used, but prefix headers will not be precompiled. This is useful when
164 # using distcc to distribute a build to compile slaves that don't
165 # share the same compiler executable as the system driving the compilation,
166 # because precompiled headers rely on pointers into a specific compiler
167 # executable's image. Setting this to 0 is needed to use an experimental
168 # Linux-Mac cross compiler distcc farm.
169 'chromium_mac_pch%': 1,
171 # Mac OS X SDK and deployment target support.
172 # The SDK identifies the version of the system headers that will be used,
173 # and corresponds to the MAC_OS_X_VERSION_MAX_ALLOWED compile-time macro.
174 # "Maximum allowed" refers to the operating system version whose APIs are
175 # available in the headers.
176 # The deployment target identifies the minimum system version that the
177 # built products are expected to function on. It corresponds to the
178 # MAC_OS_X_VERSION_MIN_REQUIRED compile-time macro.
179 # To ensure these macros are available, #include <AvailabilityMacros.h>.
180 # Additional documentation on these macros is available at
181 # http://developer.apple.com/mac/library/technotes/tn2002/tn2064.html#SECTION3
182 # Chrome normally builds with the Mac OS X 10.5 SDK and sets the
183 # deployment target to 10.5. Other projects, such as O3D, may override
186 'mac_deployment_target%': '10.5',
188 # Set to 1 to enable code coverage. In addition to build changes
189 # (e.g. extra CFLAGS), also creates a new target in the src/chrome
190 # project file called "coverage".
191 # Currently ignored on Windows.
194 # Although base/allocator lets you select a heap library via an
195 # environment variable, the libcmt shim it uses sometimes gets in
196 # the way. To disable it entirely, and switch to normal msvcrt, do e.g.
197 # 'win_use_allocator_shim': 0,
198 # 'win_release_RuntimeLibrary': 2
199 # to ~/.gyp/include.gypi, gclient runhooks --force, and do a release build.
200 'win_use_allocator_shim%': 1, # 0 = shim allocator via libcmt; 1 = msvcrt
202 # Whether usage of OpenMAX is enabled.
203 'enable_openmax%': 0,
205 # TODO(bradnelson): eliminate this when possible.
206 # To allow local gyp files to prevent release.vsprops from being included.
207 # Yes(1) means include release.vsprops.
208 # Once all vsprops settings are migrated into gyp, this can go away.
209 'msvs_use_common_release%': 1,
211 # TODO(bradnelson): eliminate this when possible.
212 # To allow local gyp files to override additional linker options for msvs.
213 # Yes(1) means set use the common linker options.
214 'msvs_use_common_linker_extras%': 1,
216 # TODO(sgk): eliminate this if possible.
217 # It would be nicer to support this via a setting in 'target_defaults'
218 # in chrome/app/locales/locales.gypi overriding the setting in the
219 # 'Debug' configuration in the 'target_defaults' dict below,
220 # but that doesn't work as we'd like.
221 'msvs_debug_link_incremental%': '2',
223 # This is the location of the sandbox binary. Chrome looks for this before
224 # running the zygote process. If found, and SUID, it will be used to
225 # sandbox the zygote process and, thus, all renderer processes.
226 'linux_sandbox_path%': '',
228 # Set this to true to enable SELinux support.
231 # Strip the binary after dumping symbols.
232 'linux_strip_binary%': 0,
235 'linux_use_tcmalloc%': 1,
237 # Disable TCMalloc's debugallocation.
238 'linux_use_debugallocation%': 0,
240 # Disable TCMalloc's heapchecker.
241 'linux_use_heapchecker%': 0,
243 # Set to 1 to turn on seccomp sandbox by default.
244 # (Note: this is ignored for official builds.)
245 'linux_use_seccomp_sandbox%': 0,
247 # Set to select the Title Case versions of strings in GRD files.
248 'use_titlecase_in_grd_files%': 0,
250 # Used to disable Native Client at compile time, for platforms where it
254 # Set Thumb compilation flags.
257 # Set ARM fpu compilation flags (only meaningful if arm_version==7 and
261 # Enable new NPDevice API.
262 'enable_new_npdevice_api%': 0,
265 ['OS=="linux" or OS=="freebsd" or OS=="openbsd"', {
266 # This will set gcc_version to XY if you are running gcc X.Y.*.
267 # This is used to tweak build flags for gcc 4.4.
268 'gcc_version%': '<!(python <(DEPTH)/build/compiler_version.py)',
269 # Figure out the python architecture to decide if we build pyauto.
270 'python_arch%': '<!(<(DEPTH)/build/linux/python_arch.sh <(sysroot)/usr/lib/libpython<(python_ver).so.1.0)',
272 ['branding=="Chrome" or linux_chromium_breakpad==1', {
273 'linux_breakpad%': 1,
275 'linux_breakpad%': 0,
277 # All Chrome builds have breakpad symbols, but only process the
278 # symbols from official builds.
279 # TODO(mmoss) dump_syms segfaults on x64. Enable once dump_syms and
280 # crash server handle 64-bit symbols.
281 ['linux_chromium_dump_symbols==1 or '
282 '(branding=="Chrome" and buildtype=="Official" and '
283 'target_arch=="ia32")', {
284 'linux_dump_symbols%': 1,
286 'linux_dump_symbols%': 0,
288 ['toolkit_views==0', {
289 # GTK wants Title Case strings
290 'use_titlecase_in_grd_files%': 1,
293 }], # OS=="linux" or OS=="freebsd" or OS=="openbsd"
295 # Mac wants Title Case strings
296 'use_titlecase_in_grd_files%': 1,
298 # mac_product_name is set to the name of the .app bundle as it should
299 # appear on disk. This duplicates data from
300 # chrome/app/theme/chromium/BRANDING and
301 # chrome/app/theme/google_chrome/BRANDING, but is necessary to get
302 # these names into the build system.
303 ['branding=="Chrome"', {
304 'mac_product_name%': 'Google Chrome',
305 }, { # else: branding!="Chrome"
306 'mac_product_name%': 'Chromium',
309 # Feature variables for enabling Mac Breakpad and Keystone auto-update
310 # support. Both features are on by default in official builds with
312 ['branding=="Chrome" and buildtype=="Official"', {
315 }, { # else: branding!="Chrome" or buildtype!="Official"
321 # Whether to use multiple cores to compile with visual studio. This is
322 # optional because it sometimes causes corruption on VS 2005.
323 # It is on by default on VS 2008 and off on VS 2005.
326 ['MSVS_VERSION=="2005"', {
327 'msvs_multi_core_compile%': 0,
329 'msvs_multi_core_compile%': 1,
331 # Don't do incremental linking for large modules on 32-bit.
332 ['MSVS_OS_BITS==32', {
333 'msvs_large_module_debug_link_mode%': '1', # No
335 'msvs_large_module_debug_link_mode%': '2', # Yes
338 'nacl_win64_defines': [
339 # This flag is used to minimize dependencies when building
340 # Native Client loader for 64-bit Windows.
344 # Compute based on OS and target architecture whether the GPU
345 # plugin / process is supported.
346 [ 'OS=="win" or (OS=="linux" and target_arch!="arm") or OS=="mac"', {
347 # Enable a variable used elsewhere throughout the GYP files to determine
348 # whether to compile in the sources for the GPU plugin / process.
350 }, { # GPU plugin not supported
353 # Compute based on OS, target architecture and device whether GLES
355 [ 'OS=="linux" and target_arch=="arm" and chromeos==1', {
356 # Enable a variable used elsewhere throughout the GYP files to determine
357 # whether to compile in the sources for the GLES support.
359 }, { # GLES not supported
364 # NOTE: When these end up in the Mac bundle, we need to replace '-' for '_'
365 # so Cocoa is happy (http://crbug.com/20441).
367 'am', 'ar', 'bg', 'bn', 'ca', 'cs', 'da', 'de', 'el', 'en-GB',
368 'en-US', 'es-419', 'es', 'et', 'fi', 'fil', 'fr', 'gu', 'he',
369 'hi', 'hr', 'hu', 'id', 'it', 'ja', 'kn', 'ko', 'lt', 'lv',
370 'ml', 'mr', 'nb', 'nl', 'pl', 'pt-BR', 'pt-PT', 'ro', 'ru',
371 'sk', 'sl', 'sr', 'sv', 'sw', 'ta', 'te', 'th', 'tr', 'uk',
372 'vi', 'zh-CN', 'zh-TW',
377 # The condition that operates on chromium_code is in a target_conditions
378 # section, and will not have access to the default fallback value of
379 # chromium_code at the top of this file, or to the chromium_code
380 # variable placed at the root variables scope of .gyp files, because
381 # those variables are not set at target scope. As a workaround,
382 # if chromium_code is not set at target scope, define it in target scope
383 # to contain whatever value it has during early variable expansion.
384 # That's enough to make it available during target conditional
386 'chromium_code%': '<(chromium_code)',
388 # See http://gcc.gnu.org/onlinedocs/gcc-4.4.2/gcc/Optimize-Options.html
389 'mac_release_optimization%': '3', # Use -O3 unless overridden
390 'mac_debug_optimization%': '0', # Use -O0 unless overridden
391 # See http://msdn.microsoft.com/en-us/library/aa652360(VS.71).aspx
392 'win_release_Optimization%': '2', # 2 = /Os
393 'win_debug_Optimization%': '0', # 0 = /Od
394 # See http://msdn.microsoft.com/en-us/library/aa652367(VS.71).aspx
395 'win_release_RuntimeLibrary%': '0', # 0 = /MT (nondebug static)
396 'win_debug_RuntimeLibrary%': '1', # 1 = /MTd (debug static)
398 'release_extra_cflags%': '',
399 'debug_extra_cflags%': '',
400 'release_valgrind_build%': 0,
403 ['branding=="Chrome"', {
404 'defines': ['GOOGLE_CHROME_BUILD'],
405 }, { # else: branding!="Chrome"
406 'defines': ['CHROMIUM_BUILD'],
408 ['toolkit_views==1', {
409 'defines': ['TOOLKIT_VIEWS=1'],
412 'defines': ['OS_CHROMEOS=1'],
416 # Finally, for Windows, we simply turn on profiling.
420 'GenerateDebugInformation': 'false',
422 'VCCLCompilerTool': {
423 'DebugInformationFormat': '0',
426 }, { # else: OS != "win"
429 ], # conditions for fastbuild.
432 'defines': ['CHROMIUM_SELINUX=1'],
434 ['win_use_allocator_shim==0', {
437 'defines': ['NO_TCMALLOC'],
455 'GCC_INSTRUMENT_PROGRAM_FLOW_ARCS': 'YES', # -fprofile-arcs
456 'GCC_GENERATE_TEST_COVERAGE_FILES': 'YES', # -ftest-coverage
458 # Add -lgcov for types executable, shared_library, and
459 # loadable_module; not for static_library.
460 # This is a delayed conditional.
461 'target_conditions': [
462 ['_type!="static_library"', {
463 'xcode_settings': { 'OTHER_LDFLAGS': [ '-lgcov' ] },
467 # Linux gyp (into scons) doesn't like target_conditions?
468 # TODO(???): track down why 'target_conditions' doesn't work
469 # on Linux gyp into scons like it does on Mac gyp into xcodeproj.
471 'cflags': [ '-ftest-coverage',
473 'link_settings': { 'libraries': [ '-lgcov' ] },
475 # Finally, for Windows, we simply turn on profiling.
481 'VCCLCompilerTool': {
482 # /Z7, not /Zi, so coverage is happyb
483 'DebugInformationFormat': '1',
484 'AdditionalOptions': ['/Yd'],
488 ], # conditions for coverage
490 ], # conditions for 'target_defaults'
491 'target_conditions': [
492 ['chromium_code==0', {
494 [ 'OS=="linux" or OS=="freebsd" or OS=="openbsd"', {
503 '_CRT_SECURE_NO_DEPRECATE',
504 '_CRT_NONSTDC_NO_WARNINGS',
505 '_CRT_NONSTDC_NO_DEPRECATE',
507 'msvs_disabled_warnings': [4800],
509 'VCCLCompilerTool': {
510 'WarnAsError': 'true',
511 'Detect64BitPortabilityProblems': 'false',
517 'GCC_TREAT_WARNINGS_AS_ERRORS': 'NO',
518 'WARNING_CFLAGS!': ['-Wall'],
523 # In Chromium code, we define __STDC_FORMAT_MACROS in order to get the
524 # C99 macros on Mac and Linux.
526 '__STDC_FORMAT_MACROS',
530 'sources/': [ ['exclude', '_win(_unittest)?\\.cc$'],
531 ['exclude', '/win/'],
532 ['exclude', '/win_[^/]*\\.cc$'] ],
535 'sources/': [ ['exclude', '_(cocoa|mac)(_unittest)?\\.cc$'],
536 ['exclude', '/(cocoa|mac)/'],
537 ['exclude', '\.mm?$' ] ],
539 ['OS!="linux" and OS!="freebsd" and OS!="openbsd"', {
541 ['exclude', '_(chromeos|gtk|x|x11|xdg)(_unittest)?\\.cc$'],
542 ['exclude', '/gtk/'],
543 ['exclude', '/(gtk|x11)_[^/]*\\.cc$'],
548 ['exclude', '_linux(_unittest)?\\.cc$'],
549 ['exclude', '/linux/'],
552 # We use "POSIX" to refer to all non-Windows operating systems.
554 'sources/': [ ['exclude', '_posix\\.cc$'] ],
556 # Though Skia is conceptually shared by Linux and Windows,
557 # the only _skia files in our tree are Linux-specific.
558 ['OS!="linux" and OS!="freebsd" and OS!="openbsd"', {
559 'sources/': [ ['exclude', '_skia\\.cc$'] ],
562 'sources/': [ ['exclude', '_chromeos\\.cc$'] ]
564 ['toolkit_views==0', {
565 'sources/': [ ['exclude', '_views\\.cc$'] ]
569 ], # target_conditions for 'target_defaults'
570 'default_configuration': 'Debug',
572 # VCLinkerTool LinkIncremental values below:
574 # 1 == /INCREMENTAL:NO
576 # Debug links incremental, Release does not.
578 # Abstract base configurations to cover common
583 'msvs_configuration_attributes': {
584 'OutputDirectory': '$(SolutionDir)$(ConfigurationName)',
585 'IntermediateDirectory': '$(OutDir)\\obj\\$(ProjectName)',
593 'TargetMachine': '1',
596 'msvs_configuration_platform': 'Win32',
600 'msvs_configuration_platform': 'x64',
603 'TargetMachine': '17', # x86 - 64
604 'AdditionalLibraryDirectories!':
605 ['<(DEPTH)/third_party/platformsdk_win7/files/Lib'],
606 'AdditionalLibraryDirectories':
607 ['<(DEPTH)/third_party/platformsdk_win7/files/Lib/x64'],
610 'AdditionalLibraryDirectories!':
611 ['<(DEPTH)/third_party/platformsdk_win7/files/Lib'],
612 'AdditionalLibraryDirectories':
613 ['<(DEPTH)/third_party/platformsdk_win7/files/Lib/x64'],
617 # Not sure if tcmalloc works on 64-bit Windows.
624 'COPY_PHASE_STRIP': 'NO',
625 'GCC_OPTIMIZATION_LEVEL': '<(mac_debug_optimization)',
626 'OTHER_CFLAGS': [ '<@(debug_extra_cflags)', ],
629 'VCCLCompilerTool': {
630 'Optimization': '<(win_debug_Optimization)',
631 'PreprocessorDefinitions': ['_DEBUG'],
632 'BasicRuntimeChecks': '3',
633 'RuntimeLibrary': '<(win_debug_RuntimeLibrary)',
636 'LinkIncremental': '<(msvs_debug_link_incremental)',
638 'VCResourceCompilerTool': {
639 'PreprocessorDefinitions': ['_DEBUG'],
645 '<@(debug_extra_cflags)',
656 'DEAD_CODE_STRIPPING': 'YES', # -Wl,-dead_strip
657 'GCC_OPTIMIZATION_LEVEL': '<(mac_release_optimization)',
658 'OTHER_CFLAGS': [ '<@(release_extra_cflags)', ],
661 'VCCLCompilerTool': {
662 'Optimization': '<(win_release_Optimization)',
663 'RuntimeLibrary': '<(win_release_RuntimeLibrary)',
666 'LinkIncremental': '1',
670 ['release_valgrind_build==0', {
671 'defines': ['NVALGRIND'],
673 ['win_use_allocator_shim==0', {
674 'defines': ['NO_TCMALLOC'],
676 ['win_release_RuntimeLibrary==2', {
677 # Visual C++ 2008 barfs when building anything with /MD (msvcrt):
678 # VC\include\typeinfo(139) : warning C4275: non dll-interface
679 # class 'stdext::exception' used as base for dll-interface
680 # class 'std::bad_cast'
681 'msvs_disabled_warnings': [4275],
685 '<@(release_extra_cflags)',
697 'VCCLCompilerTool': {
699 'RuntimeLibrary': '0',
700 'BufferSecurityCheck': 'false',
703 'EnableCOMDATFolding': '1',
704 'LinkIncremental': '1',
709 # Concrete configurations
712 'inherit_from': ['Common_Base', 'x86_Base', 'Debug_Base'],
715 'inherit_from': ['Common_Base', 'x86_Base', 'Release_Base'],
717 ['msvs_use_common_release', {
718 'includes': ['release.gypi'],
724 # TODO(bradnelson): add a gyp mechanism to make this more graceful.
726 'inherit_from': ['Common_Base', 'x86_Base', 'Release_Base', 'Purify'],
729 'inherit_from': ['Common_Base', 'x64_Base', 'Debug_Base'],
732 'inherit_from': ['Common_Base', 'x64_Base', 'Release_Base'],
735 'inherit_from': ['Common_Base', 'x64_Base', 'Release_Base', 'Purify_Base'],
742 ['OS=="linux" or OS=="freebsd" or OS=="openbsd" or OS=="solaris"', {
744 # Enable -Werror by default, but put it in a variable so it can
745 # be disabled in ~/.gyp/include.gypi on the valgrind builders.
747 # Use -fno-strict-aliasing by default since gcc 4.4 has periodic
748 # issues that slip through the cracks. We could do this just for
749 # gcc 4.4 but it makes more sense to be consistent on all
750 # compilers in use. TODO(Craig): turn this off again when
751 # there is some 4.4 test infrastructure in place and existing
752 # aliasing issues have been fixed.
753 'no_strict_aliasing%': 1,
754 'conditions': [['OS=="linux"', {'werror%': '-Werror',}],
755 ['OS=="freebsd"', {'werror%': '',}],
756 ['OS=="openbsd"', {'werror%': '',}],
760 '<(werror)', # See note above about the werror variable.
764 # TODO(evan): turn this back on once all the builds work.
766 # Don't warn about unused function params. We use those everywhere.
767 '-Wno-unused-parameter',
768 # Don't warn about the "struct foo f = {0};" initialization pattern.
769 '-Wno-missing-field-initializers',
770 '-D_FILE_OFFSET_BITS=64',
771 # Don't export any symbols (for example, to plugins we dlopen()).
772 # Note: this is *required* to make some plugins work.
773 '-fvisibility=hidden',
777 '-fno-threadsafe-statics',
778 # Make inline functions have hidden visiblity by default.
779 # Surprisingly, not covered by -fvisibility=hidden.
780 '-fvisibility-inlines-hidden',
783 '-pthread', '-Wl,-z,noexecstack',
785 'scons_variable_settings': {
786 'LIBPATH': ['$LIB_DIR'],
787 # Linking of large files uses lots of RAM, so serialize links
788 # using the handy flock command from util-linux.
789 'FLOCK_LINK': ['flock', '$TOP_BUILDDIR/linker.lock', '$LINK'],
790 'FLOCK_SHLINK': ['flock', '$TOP_BUILDDIR/linker.lock', '$SHLINK'],
791 'FLOCK_LDMODULE': ['flock', '$TOP_BUILDDIR/linker.lock', '$LDMODULE'],
793 # We have several cases where archives depend on each other in
794 # a cyclic fashion. Since the GNU linker does only a single
795 # pass over the archives we surround the libraries with
796 # --start-group and --end-group (aka -( and -) ). That causes
797 # ld to loop over the group until no more undefined symbols
798 # are found. In an ideal world we would only make groups from
799 # those libraries which we knew to be in cycles. However,
800 # that's tough with SCons, so we bodge it by making all the
801 # archives a group by redefining the linking command here.
803 # TODO: investigate whether we still have cycles that
804 # require --{start,end}-group. There has been a lot of
805 # refactoring since this was first coded, which might have
806 # eliminated the circular dependencies.
808 # Note: $_LIBDIRFLAGS comes before ${LINK,SHLINK,LDMODULE}FLAGS
809 # so that we prefer our own built libraries (e.g. -lpng) to
810 # system versions of libraries that pkg-config might turn up.
811 # TODO(sgk): investigate handling this not by re-ordering the
812 # flags this way, but by adding a hook to use the SCons
813 # ParseFlags() option on the output from pkg-config.
814 'LINKCOM': [['$FLOCK_LINK', '-o', '$TARGET',
815 '$_LIBDIRFLAGS', '$LINKFLAGS', '$SOURCES',
816 '-Wl,--start-group', '$_LIBFLAGS', '-Wl,--end-group']],
817 'SHLINKCOM': [['$FLOCK_SHLINK', '-o', '$TARGET',
818 '$_LIBDIRFLAGS', '$SHLINKFLAGS', '$SOURCES',
819 '-Wl,--start-group', '$_LIBFLAGS', '-Wl,--end-group']],
820 'LDMODULECOM': [['$FLOCK_LDMODULE', '-o', '$TARGET',
821 '$_LIBDIRFLAGS', '$LDMODULEFLAGS', '$SOURCES',
822 '-Wl,--start-group', '$_LIBFLAGS', '-Wl,--end-group']],
823 'IMPLICIT_COMMAND_DEPENDENCIES': 0,
824 # -rpath is only used when building with shared libraries.
826 [ 'component=="shared_library"', {
831 'scons_import_variables': [
837 'scons_propagate_variables': [
845 'INCLUDE_SERVER_ARGS',
846 'INCLUDE_SERVER_PORT',
855 'debug_optimize%': '0',
861 '-O>(debug_optimize)',
863 # One can use '-gstabs' to enable building the debugging
864 # information in STABS format for breakpad's dumpsyms.
867 '-rdynamic', # Allows backtrace to resolve symbols.
872 'release_optimize%': '2',
875 '-O>(release_optimize)',
876 # Don't emit the GCC version ident directives, they just end up
877 # in the .comment section taking up binary size.
879 # Put data and code in their own sections, so that unused symbols
880 # can be removed at link time with --gc-sections.
882 '-ffunction-sections',
891 'cflags': ['-fprofile-arcs', '-ftest-coverage'],
892 'ldflags': ['-fprofile-arcs'],
895 'cflags': ['-pg', '-g'],
903 [ 'target_arch=="ia32"', {
905 # Needed so that libs with .s files (e.g. libicudata.a)
906 # are compatible with the general 32-bit-ness.
909 # All floating-point computations on x87 happens in 80-bit
910 # precision. Because the C and C++ language standards allow
911 # the compiler to keep the floating-point values in higher
912 # precision than what's specified in the source and doing so
913 # is more efficient than constantly rounding up to 64-bit or
914 # 32-bit precision as specified in the source, the compiler,
915 # especially in the optimized mode, tries very hard to keep
916 # values in x87 floating-point stack (in 80-bit precision)
917 # as long as possible. This has important side effects, that
918 # the real value used in computation may change depending on
919 # how the compiler did the optimization - that is, the value
920 # kept in 80-bit is different than the value rounded down to
921 # 64-bit or 32-bit. There are possible compiler options to make
922 # this behavior consistent (e.g. -ffloat-store would keep all
923 # floating-values in the memory, thus force them to be rounded
924 # to its original precision) but they have significant runtime
925 # performance penalty.
927 # -mfpmath=sse -msse2 makes the compiler use SSE instructions
928 # which keep floating-point values in SSE registers in its
929 # native precision (32-bit for single precision, and 64-bit for
930 # double precision values). This means the floating-point value
931 # used during computation does not change depending on how the
932 # compiler optimized the code, since the value is always kept
933 # in its specified precision.
935 ['branding=="Chromium" and disable_sse2==0', {
942 # ChromeOS targets Pinetrail, which is sse3, but most of the
943 # benefit comes from sse2 so this setting allows ChromeOS
944 # to build on other CPUs. In the future -march=atom would help
945 # but requires a newer compiler.
946 ['chromeos==1 and disable_sse2==0', {
952 # -mmmx allows mmintrin.h to be used for mmx intrinsics.
953 # video playback is mmx and sse2 optimized.
962 ['target_arch=="arm"', {
963 'target_conditions': [
964 ['_toolset=="target"', {
966 # The codesourcery arm-2009q3 toolchain warns at that the ABI
967 # has changed whenever it encounters a varargs function. This
968 # silences those warnings, as they are not helpful and
969 # clutter legitimate warnings.
976 # TODO(piman): -Wa,-mimplicit-it=thumb is needed for
977 # inline assembly that uses condition codes but it's
978 # suboptimal. Better would be to #ifdef __thumb__ at the
979 # right place and have a separate thumb path.
980 '-Wa,-mimplicit-it=thumb',
987 '-mfloat-abi=softfp',
991 'cflags': [ '-mfpu=neon', ],
993 'cflags': [ '-mfpu=<(arm_fpu)', ],
1007 'target_conditions': [
1008 ['_toolset=="target"', {
1010 '--sysroot=<(sysroot)',
1013 '--sysroot=<(sysroot)',
1017 ['no_strict_aliasing==1', {
1019 '-fno-strict-aliasing',
1022 ['linux_breakpad==1', {
1023 'cflags': [ '-gstabs' ],
1024 'defines': ['USE_LINUX_BREAKPAD'],
1026 ['linux_use_seccomp_sandbox==1 and buildtype!="Official"', {
1027 'defines': ['USE_SECCOMP_SANDBOX'],
1029 ['library=="shared_library"', {
1030 # When building with shared libraries, remove the visiblity-hiding
1032 'cflags!': [ '-fvisibility=hidden' ],
1034 ['target_arch=="x64" or target_arch=="arm"', {
1035 # Shared libraries need -fPIC on x86-64 and arm
1040 ['linux_use_heapchecker==1', {
1041 'variables': {'linux_use_tcmalloc%': 1},
1043 ['linux_use_tcmalloc==0', {
1044 'defines': ['NO_TCMALLOC'],
1046 ['linux_use_heapchecker==0', {
1047 'defines': ['NO_HEAPCHECKER'],
1052 # FreeBSD-specific options; note that most FreeBSD options are set above,
1055 'target_defaults': {
1057 '-Wl,--no-keep-memory',
1062 'cflags!': ['-fvisibility=hidden'],
1063 'cflags_cc!': ['-fvisibility-inlines-hidden'],
1066 'target_defaults': {
1068 # This should be 'mac_real_dsym%', but there seems to be a bug
1069 # with % in variables that are intended to be set to different
1070 # values in different targets, like this one.
1071 'mac_real_dsym': 0, # Fake .dSYMs are fine in most cases.
1075 'ALWAYS_SEARCH_USER_PATHS': 'NO',
1076 'GCC_C_LANGUAGE_STANDARD': 'c99', # -std=c99
1077 'GCC_CW_ASM_SYNTAX': 'NO', # No -fasm-blocks
1078 'GCC_DYNAMIC_NO_PIC': 'NO', # No -mdynamic-no-pic
1079 # (Equivalent to -fPIC)
1080 'GCC_ENABLE_CPP_EXCEPTIONS': 'NO', # -fno-exceptions
1081 'GCC_ENABLE_CPP_RTTI': 'NO', # -fno-rtti
1082 'GCC_ENABLE_PASCAL_STRINGS': 'NO', # No -mpascal-strings
1083 # GCC_INLINES_ARE_PRIVATE_EXTERN maps to -fvisibility-inlines-hidden
1084 'GCC_INLINES_ARE_PRIVATE_EXTERN': 'YES',
1085 'GCC_OBJC_CALL_CXX_CDTORS': 'YES', # -fobjc-call-cxx-cdtors
1086 'GCC_SYMBOLS_PRIVATE_EXTERN': 'YES', # -fvisibility=hidden
1087 'GCC_THREADSAFE_STATICS': 'NO', # -fno-threadsafe-statics
1088 'GCC_TREAT_WARNINGS_AS_ERRORS': 'YES', # -Werror
1089 'GCC_VERSION': '4.2',
1090 'GCC_WARN_ABOUT_MISSING_NEWLINE': 'YES', # -Wnewline-eof
1091 # MACOSX_DEPLOYMENT_TARGET maps to -mmacosx-version-min
1092 'MACOSX_DEPLOYMENT_TARGET': '<(mac_deployment_target)',
1093 'PREBINDING': 'NO', # No -Wl,-prebind
1094 'USE_HEADERMAP': 'NO',
1095 'WARNING_CFLAGS': ['-Wall', '-Wendif-labels'],
1097 ['chromium_mac_pch', {'GCC_PRECOMPILE_PREFIX_HEADER': 'YES'},
1098 {'GCC_PRECOMPILE_PREFIX_HEADER': 'NO'}
1102 'target_conditions': [
1103 ['_type!="static_library"', {
1104 'xcode_settings': {'OTHER_LDFLAGS': ['-Wl,-search_paths_first']},
1107 'xcode_settings': {'OTHER_LDFLAGS': ['-Wl,-ObjC']},
1109 ['_type=="executable" or _type=="shared_library"', {
1110 'target_conditions': [
1111 ['mac_real_dsym == 1', {
1112 # To get a real .dSYM bundle produced by dsymutil, set the
1113 # debug information format to dwarf-with-dsym. Since
1114 # strip_from_xcode will not be used, set Xcode to do the
1115 # stripping as well.
1119 'DEBUG_INFORMATION_FORMAT': 'dwarf-with-dsym',
1120 'DEPLOYMENT_POSTPROCESSING': 'YES',
1121 'STRIP_INSTALLED_PRODUCT': 'YES',
1122 'target_conditions': [
1123 ['_type=="shared_library"', {
1124 # The Xcode default is to strip debugging symbols
1125 # only (-S). Local symbols should be stripped as
1126 # well, which will be handled by -x. Xcode will
1127 # continue to insert -S when stripping even when
1128 # additional flags are added with STRIPFLAGS.
1130 }], # _type=="shared_library"
1131 ], # target_conditions
1133 }, # configuration "Release"
1135 }, { # mac_real_dsym != 1
1136 # To get a fast fake .dSYM bundle, use a post-build step to
1137 # produce the .dSYM and strip the executable. strip_from_xcode
1138 # only operates in the Release configuration.
1142 # Define strip_from_xcode in a variable ending in _path
1143 # so that gyp understands it's a path and performs proper
1144 # relativization during dict merging.
1145 'strip_from_xcode_path': 'mac/strip_from_xcode',
1147 'postbuild_name': 'Strip If Needed',
1148 'action': ['<(strip_from_xcode_path)'],
1152 ], # target_conditions
1153 }], # _type=="executable" or _type=="shared_library"
1154 ], # target_conditions
1155 }, # target_defaults
1158 'target_defaults': {
1160 '_WIN32_WINNT=0x0600',
1164 '_HAS_EXCEPTIONS=0',
1167 'CERT_CHAIN_PARA_HAS_EXTRA_FIELDS',
1168 'WIN32_LEAN_AND_MEAN',
1172 'msvs_system_include_dirs': [
1173 '<(DEPTH)/third_party/platformsdk_win7/files/Include',
1174 '$(VSInstallDir)/VC/atlmfc/include',
1176 'msvs_cygwin_dirs': ['<(DEPTH)/third_party/cygwin'],
1177 'msvs_disabled_warnings': [4100, 4127, 4396, 4503, 4512, 4819, 4995],
1179 'VCCLCompilerTool': {
1180 'MinimalRebuild': 'false',
1181 'ExceptionHandling': '0',
1182 'BufferSecurityCheck': 'true',
1183 'EnableFunctionLevelLinking': 'true',
1184 'RuntimeTypeInfo': 'false',
1185 'WarningLevel': '4',
1186 'WarnAsError': 'true',
1187 'DebugInformationFormat': '3',
1189 [ 'msvs_multi_core_compile', {
1190 'AdditionalOptions': ['/MP'],
1194 'VCLibrarianTool': {
1195 'AdditionalOptions': ['/ignore:4221'],
1196 'AdditionalLibraryDirectories':
1197 ['<(DEPTH)/third_party/platformsdk_win7/files/Lib'],
1200 'AdditionalDependencies': [
1209 'AdditionalLibraryDirectories':
1210 ['<(DEPTH)/third_party/platformsdk_win7/files/Lib'],
1211 'GenerateDebugInformation': 'true',
1212 'MapFileName': '$(OutDir)\\$(TargetName).map',
1213 'ImportLibrary': '$(OutDir)\\lib\\$(TargetName).lib',
1214 'FixedBaseAddress': '1',
1217 # 1 == /SUBSYSTEM:CONSOLE
1218 # 2 == /SUBSYSTEM:WINDOWS
1219 # Most of the executables we'll ever create are tests
1220 # and utilities with console output.
1224 'GenerateStublessProxies': 'true',
1225 'TypeLibraryName': '$(InputName).tlb',
1226 'OutputDirectory': '$(IntDir)',
1227 'HeaderFileName': '$(InputName).h',
1228 'DLLDataFileName': 'dlldata.c',
1229 'InterfaceIdentifierFileName': '$(InputName)_i.c',
1230 'ProxyFileName': '$(InputName)_p.c',
1232 'VCResourceCompilerTool': {
1234 'AdditionalIncludeDirectories': ['<(DEPTH)'],
1239 ['disable_nacl==1 or OS=="freebsd" or OS=="openbsd" or OS=="solaris"', {
1240 'target_defaults': {
1246 ['OS=="win" and msvs_use_common_linker_extras', {
1247 'target_defaults': {
1261 'AdditionalOptions': [
1274 'AdditionalOptions': [
1275 # safeseh is not compatible with x64
1287 ['enable_new_npdevice_api==1', {
1288 'target_defaults': {
1290 'ENABLE_NEW_NPDEVICE_API',
1296 'sconsbuild_dir': '<(DEPTH)/sconsbuild',
1297 'tools': ['ar', 'as', 'gcc', 'g++', 'gnulink', 'chromium_builders'],
1300 # DON'T ADD ANYTHING NEW TO THIS BLOCK UNLESS YOU REALLY REALLY NEED IT!
1301 # This block adds *project-wide* configuration settings to each project
1302 # file. It's almost always wrong to put things here. Specify your
1303 # custom xcode_settings in target_defaults to add them to targets instead.
1305 # In an Xcode Project Info window, the "Base SDK for All Configurations"
1306 # setting sets the SDK on a project-wide basis. In order to get the
1307 # configured SDK to show properly in the Xcode UI, SDKROOT must be set
1308 # here at the project level.
1309 'SDKROOT': 'macosx<(mac_sdk)', # -isysroot
1311 # The Xcode generator will look for an xcode_settings section at the root
1312 # of each dict and use it to apply settings on a file-wide basis. Most
1313 # settings should not be here, they should be in target-specific
1314 # xcode_settings sections, or better yet, should use non-Xcode-specific
1315 # settings in target dicts. SYMROOT is a special case, because many other
1316 # Xcode variables depend on it, including variables such as
1317 # PROJECT_DERIVED_FILE_DIR. When a source group corresponding to something
1318 # like PROJECT_DERIVED_FILE_DIR is added to a project, in order for the
1319 # files to appear (when present) in the UI as actual files and not red
1320 # red "missing file" proxies, the correct path to PROJECT_DERIVED_FILE_DIR,
1321 # and therefore SYMROOT, needs to be set at the project level.
1322 'SYMROOT': '<(DEPTH)/xcodebuild',
1328 # indent-tabs-mode:nil
1330 # vim: set expandtab tabstop=2 shiftwidth=2: