Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(99)

Side by Side Diff: build/common.gypi

Issue 430383002: Use clang as default host compiler when cross-compiling (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: . Created 6 years, 4 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « no previous file | build/set_clang_warning_flags.gypi » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 # Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 # Copyright (c) 2012 The Chromium Authors. All rights reserved.
2 # Use of this source code is governed by a BSD-style license that can be 2 # Use of this source code is governed by a BSD-style license that can be
3 # found in the LICENSE file. 3 # found in the LICENSE file.
4 4
5 # IMPORTANT: 5 # IMPORTANT:
6 # Please don't directly include this file if you are building via gyp_chromium, 6 # Please don't directly include this file if you are building via gyp_chromium,
7 # since gyp_chromium is automatically forcing its inclusion. 7 # since gyp_chromium is automatically forcing its inclusion.
8 { 8 {
9 # Variables expected to be overriden on the GYP command line (-D) or by 9 # Variables expected to be overriden on the GYP command line (-D) or by
10 # ~/.gyp/include.gypi. 10 # ~/.gyp/include.gypi.
(...skipping 525 matching lines...) Expand 10 before | Expand all | Expand 10 after
536 # 536 #
537 # This variable may be explicitly set to 1 (enabled) or 0 537 # This variable may be explicitly set to 1 (enabled) or 0
538 # (disabled) in ~/.gyp/include.gypi or via the GYP command line. 538 # (disabled) in ~/.gyp/include.gypi or via the GYP command line.
539 # This setting will override the default. 539 # This setting will override the default.
540 # 540 #
541 # See 541 # See
542 # http://code.google.com/p/chromium/wiki/WindowsPrecompiledHeaders 542 # http://code.google.com/p/chromium/wiki/WindowsPrecompiledHeaders
543 # for details. 543 # for details.
544 'chromium_win_pch%': 0, 544 'chromium_win_pch%': 0,
545 545
546 # Clang stuff.
547 'make_clang_dir%': 'third_party/llvm-build/Release+Asserts',
546 # Set this to true when building with Clang. 548 # Set this to true when building with Clang.
547 # See http://code.google.com/p/chromium/wiki/Clang for details. 549 # See http://code.google.com/p/chromium/wiki/Clang for details.
550 # If this is set, clang is used as both host and target compiler in
551 # cross-compile builds.
548 'clang%': 0, 552 'clang%': 0,
549 553
550 # Enable plug-in installation by default. 554 # Enable plug-in installation by default.
551 'enable_plugin_installation%': 1, 555 'enable_plugin_installation%': 1,
552 556
553 # Specifies whether to use canvas_skia.cc in place of platform 557 # Specifies whether to use canvas_skia.cc in place of platform
554 # specific implementations of gfx::Canvas. Affects text drawing in the 558 # specific implementations of gfx::Canvas. Affects text drawing in the
555 # Chrome UI. 559 # Chrome UI.
556 # TODO(asvitkine): Enable this on all platforms and delete this flag. 560 # TODO(asvitkine): Enable this on all platforms and delete this flag.
557 # http://crbug.com/105550 561 # http://crbug.com/105550
(...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after
597 'syzygy_optimize%': 0, 601 'syzygy_optimize%': 0,
598 602
599 # Enable hole punching for the protected video. 603 # Enable hole punching for the protected video.
600 'video_hole%': 0, 604 'video_hole%': 0,
601 605
602 # Automatically select platforms under ozone. Turn this off to 606 # Automatically select platforms under ozone. Turn this off to
603 # build only explicitly selected platforms. 607 # build only explicitly selected platforms.
604 'ozone_auto_platforms%': 1, 608 'ozone_auto_platforms%': 1,
605 609
606 'conditions': [ 610 'conditions': [
611 ['android_webview_build==0', {
612 # If this is set clang is used as host compiler, but not as target
613 # compiler. Always do this by default, except when building for AOSP.
614 'host_clang%': 1,
615 }, {
616 # See http://crbug.com/377684
617 'host_clang%': 0,
618 }],
607 # A flag for POSIX platforms 619 # A flag for POSIX platforms
608 ['OS=="win"', { 620 ['OS=="win"', {
609 'os_posix%': 0, 621 'os_posix%': 0,
610 }, { 622 }, {
611 'os_posix%': 1, 623 'os_posix%': 1,
612 }], 624 }],
613 625
614 # A flag for BSD platforms 626 # A flag for BSD platforms
615 ['OS=="freebsd" or OS=="openbsd"', { 627 ['OS=="freebsd" or OS=="openbsd"', {
616 'os_bsd%': 1, 628 'os_bsd%': 1,
(...skipping 630 matching lines...) Expand 10 before | Expand all | Expand 10 after
1247 1259
1248 # Experimental setting to break chrome.dll into multiple pieces based on 1260 # Experimental setting to break chrome.dll into multiple pieces based on
1249 # process type. 1261 # process type.
1250 'chrome_multiple_dll%': '0', 1262 'chrome_multiple_dll%': '0',
1251 1263
1252 # Experimental setting to optimize Chrome's DLLs with PGO. 1264 # Experimental setting to optimize Chrome's DLLs with PGO.
1253 'chrome_pgo_phase%': '0', 1265 'chrome_pgo_phase%': '0',
1254 1266
1255 # Clang stuff. 1267 # Clang stuff.
1256 'clang%': '<(clang)', 1268 'clang%': '<(clang)',
1257 'make_clang_dir%': 'third_party/llvm-build/Release+Asserts', 1269 'host_clang%': '<(host_clang)',
1270 'make_clang_dir%': '<(make_clang_dir)',
1258 1271
1259 # Control which version of clang to use when building for iOS. If set to 1272 # Control which version of clang to use when building for iOS. If set to
1260 # '1', uses the version of clang that ships with Xcode. If set to '0', uses 1273 # '1', uses the version of clang that ships with Xcode. If set to '0', uses
1261 # the version of clang that ships with the Chromium source. This variable 1274 # the version of clang that ships with the Chromium source. This variable
1262 # is automatically set to '1' when using the Xcode generator. 1275 # is automatically set to '1' when using the Xcode generator.
1263 'clang_xcode%': 0, 1276 'clang_xcode%': 0,
1264 1277
1265 # These two variables can be set in GYP_DEFINES while running 1278 # These two variables can be set in GYP_DEFINES while running
1266 # |gclient runhooks| to let clang run a plugin in every compilation. 1279 # |gclient runhooks| to let clang run a plugin in every compilation.
1267 # Only has an effect if 'clang=1' is in GYP_DEFINES as well. 1280 # Only has an effect if 'clang=1' is in GYP_DEFINES as well.
(...skipping 998 matching lines...) Expand 10 before | Expand all | Expand 10 after
2266 ['win_z7==0', { 2279 ['win_z7==0', {
2267 'fastbuild': 1, 2280 'fastbuild': 1,
2268 }], 2281 }],
2269 ], 2282 ],
2270 }], 2283 }],
2271 2284
2272 ['OS=="win" and (clang==1 or asan==1)', { 2285 ['OS=="win" and (clang==1 or asan==1)', {
2273 'chromium_win_pch': 0, 2286 'chromium_win_pch': 0,
2274 }], 2287 }],
2275 2288
2289 ['host_clang==1', {
2290 'host_cc': '<(make_clang_dir)/bin/clang',
2291 'host_cxx': '<(make_clang_dir)/bin/clang++',
2292 }, {
2293 'host_cc': '<!(which gcc)',
2294 'host_cxx': '<!(which g++)',
2295 }],
2296
2276 # The seccomp-bpf sandbox is only supported on four architectures 2297 # The seccomp-bpf sandbox is only supported on four architectures
2277 # currently. 2298 # currently.
2278 # Do not disable seccomp_bpf anywhere without talking to 2299 # Do not disable seccomp_bpf anywhere without talking to
2279 # security@chromium.org! 2300 # security@chromium.org!
2280 ['((OS=="linux" or OS=="android") and ' 2301 ['((OS=="linux" or OS=="android") and '
2281 '(target_arch=="ia32" or target_arch=="x64" or ' 2302 '(target_arch=="ia32" or target_arch=="x64" or '
2282 'target_arch=="arm" or target_arch=="mipsel"))', { 2303 'target_arch=="arm" or target_arch=="mipsel"))', {
2283 'use_seccomp_bpf%': 1, 2304 'use_seccomp_bpf%': 1,
2284 }, { 2305 }, {
2285 'use_seccomp_bpf%': 0, 2306 'use_seccomp_bpf%': 0,
(...skipping 1614 matching lines...) Expand 10 before | Expand all | Expand 10 after
3900 'cflags': [ 3921 'cflags': [
3901 # TODO(thakis): Remove, http://crbug.com/263960 3922 # TODO(thakis): Remove, http://crbug.com/263960
3902 '-Wno-reserved-user-defined-literal', 3923 '-Wno-reserved-user-defined-literal',
3903 ], 3924 ],
3904 'cflags_cc': [ 3925 'cflags_cc': [
3905 # See the comment in the Mac section for what it takes to move 3926 # See the comment in the Mac section for what it takes to move
3906 # this to -std=c++11. 3927 # this to -std=c++11.
3907 '-std=gnu++11', 3928 '-std=gnu++11',
3908 ], 3929 ],
3909 }], 3930 }],
3931 ['clang==0 and host_clang==1', {
3932 'target_conditions': [
3933 ['_toolset=="host"', {
3934 'cflags_cc': [ '-std=gnu++11', ],
3935 }],
3936 ],
3937 }],
3910 ['clang==1 and clang_use_chrome_plugins==1', { 3938 ['clang==1 and clang_use_chrome_plugins==1', {
3911 'cflags': [ 3939 'cflags': [
3912 '<@(clang_chrome_plugins_flags)', 3940 '<@(clang_chrome_plugins_flags)',
3913 ], 3941 ],
3914 }], 3942 }],
3915 ['clang==1 and clang_load!=""', { 3943 ['clang==1 and clang_load!=""', {
3916 'cflags': [ 3944 'cflags': [
3917 '-Xclang', '-load', '-Xclang', '<(clang_load)', 3945 '-Xclang', '-load', '-Xclang', '<(clang_load)',
3918 ], 3946 ],
3919 }], 3947 }],
(...skipping 327 matching lines...) Expand 10 before | Expand all | Expand 10 after
4247 'cflags_cc': [ 4275 'cflags_cc': [
4248 '-std=gnu++11', 4276 '-std=gnu++11',
4249 # See comment for -Wno-c++11-narrowing. 4277 # See comment for -Wno-c++11-narrowing.
4250 '-Wno-narrowing', 4278 '-Wno-narrowing',
4251 # TODO(thakis): Remove, http://crbug.com/263960 4279 # TODO(thakis): Remove, http://crbug.com/263960
4252 '-Wno-literal-suffix', 4280 '-Wno-literal-suffix',
4253 ], 4281 ],
4254 }], 4282 }],
4255 ], 4283 ],
4256 }], 4284 }],
4257 ['host_gcc_version>=47 and clang==0', { 4285 ['host_gcc_version>=47 and clang==0 and host_clang==0', {
4258 'target_conditions': [ 4286 'target_conditions': [
4259 ['_toolset=="host"', { 4287 ['_toolset=="host"', {
4260 'cflags_cc': [ 4288 'cflags_cc': [
4261 '-std=gnu++11', 4289 '-std=gnu++11',
4262 # See comment for -Wno-c++11-narrowing. 4290 # See comment for -Wno-c++11-narrowing.
4263 '-Wno-narrowing', 4291 '-Wno-narrowing',
4264 # TODO(thakis): Remove, http://crbug.com/263960 4292 # TODO(thakis): Remove, http://crbug.com/263960
4265 '-Wno-literal-suffix', 4293 '-Wno-literal-suffix',
4266 ], 4294 ],
4267 }], 4295 }],
(...skipping 1243 matching lines...) Expand 10 before | Expand all | Expand 10 after
5511 # Don't warn about the "typedef 'foo' locally defined but not used" 5539 # Don't warn about the "typedef 'foo' locally defined but not used"
5512 # for gcc 4.8. 5540 # for gcc 4.8.
5513 # TODO: remove this flag once all builds work. See crbug.com/227506 5541 # TODO: remove this flag once all builds work. See crbug.com/227506
5514 ['gcc_version>=48 and clang==0', { 5542 ['gcc_version>=48 and clang==0', {
5515 'target_defaults': { 5543 'target_defaults': {
5516 'cflags': [ 5544 'cflags': [
5517 '-Wno-unused-local-typedefs', 5545 '-Wno-unused-local-typedefs',
5518 ], 5546 ],
5519 }, 5547 },
5520 }], 5548 }],
5549 ['gcc_version>=48 and clang==0 and host_clang==1', {
5550 'target_defaults': {
5551 'target_conditions': [
5552 ['_toolset=="host"', { 'cflags!': [ '-Wno-unused-local-typedefs' ]}],
5553 ],
5554 },
5555 }],
5521 # We need a special case to handle the android webview build on mac because 5556 # We need a special case to handle the android webview build on mac because
5522 # the host gcc there doesn't accept this flag, but the target gcc may 5557 # the host gcc there doesn't accept this flag, but the target gcc may
5523 # require it. 5558 # require it.
5524 ['gcc_version>=48 and android_webview_build==1 and host_os=="mac"', { 5559 ['gcc_version>=48 and android_webview_build==1 and host_os=="mac"', {
5525 'target_defaults': { 5560 'target_defaults': {
5526 'target_conditions': [ 5561 'target_conditions': [
5527 ['_toolset=="host"', { 5562 ['_toolset=="host"', {
5528 'cflags!': [ 5563 'cflags!': [
5529 '-Wno-unused-local-typedefs', 5564 '-Wno-unused-local-typedefs',
5530 ], 5565 ],
(...skipping 15 matching lines...) Expand all
5546 # On Windows, gyp's ninja generator only looks at CC. 5581 # On Windows, gyp's ninja generator only looks at CC.
5547 ['CC', '<(make_clang_dir)/bin/clang-cl'], 5582 ['CC', '<(make_clang_dir)/bin/clang-cl'],
5548 ], 5583 ],
5549 }], 5584 }],
5550 ['OS=="android" and clang==0', { 5585 ['OS=="android" and clang==0', {
5551 # Hardcode the compiler names in the Makefile so that 5586 # Hardcode the compiler names in the Makefile so that
5552 # it won't depend on the environment at make time. 5587 # it won't depend on the environment at make time.
5553 'make_global_settings': [ 5588 'make_global_settings': [
5554 ['CC', '<!(/bin/echo -n <(android_toolchain)/*-gcc)'], 5589 ['CC', '<!(/bin/echo -n <(android_toolchain)/*-gcc)'],
5555 ['CXX', '<!(/bin/echo -n <(android_toolchain)/*-g++)'], 5590 ['CXX', '<!(/bin/echo -n <(android_toolchain)/*-g++)'],
5556 ['CC.host', '<!(which gcc)'], 5591 ['CC.host', '<(host_cc)'],
5557 ['CXX.host', '<!(which g++)'], 5592 ['CXX.host', '<(host_cxx)'],
5558 ], 5593 ],
5559 }], 5594 }],
5560 ['OS=="linux" and target_arch=="mipsel"', { 5595 ['OS=="linux" and target_arch=="mipsel"', {
5561 'make_global_settings': [ 5596 'make_global_settings': [
5562 ['CC', '<(sysroot)/../bin/mipsel-linux-gnu-gcc'], 5597 ['CC', '<(sysroot)/../bin/mipsel-linux-gnu-gcc'],
5563 ['CXX', '<(sysroot)/../bin/mipsel-linux-gnu-g++'], 5598 ['CXX', '<(sysroot)/../bin/mipsel-linux-gnu-g++'],
5564 ['CC.host', '<!(which gcc)'], 5599 ['CC.host', '<(host_cc)'],
5565 ['CXX.host', '<!(which g++)'], 5600 ['CXX.host', '<(host_cxx)'],
5566 ], 5601 ],
5567 }], 5602 }],
5568 ['OS=="linux" and target_arch=="arm" and host_arch!="arm" and chromeos==0 an d clang==0', { 5603 ['OS=="linux" and target_arch=="arm" and host_arch!="arm" and chromeos==0 an d clang==0', {
5569 # Set default ARM cross compiling on linux. These can be overridden 5604 # Set default ARM cross compiling on linux. These can be overridden
5570 # using CC/CXX/etc environment variables. 5605 # using CC/CXX/etc environment variables.
5571 'make_global_settings': [ 5606 'make_global_settings': [
5572 ['CC', '<!(which arm-linux-gnueabihf-gcc)'], 5607 ['CC', '<!(which arm-linux-gnueabihf-gcc)'],
5573 ['CXX', '<!(which arm-linux-gnueabihf-g++)'], 5608 ['CXX', '<!(which arm-linux-gnueabihf-g++)'],
5574 ['CC.host', '<!(which gcc)'], 5609 ['CC.host', '<(host_cc)'],
5575 ['CXX.host', '<!(which g++)'], 5610 ['CXX.host', '<(host_cxx)'],
5576 ], 5611 ],
5577 }], 5612 }],
5578 5613
5579 # TODO(yyanagisawa): supports GENERATOR==make 5614 # TODO(yyanagisawa): supports GENERATOR==make
5580 # make generator doesn't support CC_wrapper without CC 5615 # make generator doesn't support CC_wrapper without CC
5581 # in make_global_settings yet. 5616 # in make_global_settings yet.
5582 ['use_goma==1 and ("<(GENERATOR)"=="ninja" or clang==1)', { 5617 ['use_goma==1 and ("<(GENERATOR)"=="ninja" or clang==1)', {
5583 'make_global_settings': [ 5618 'make_global_settings': [
5584 ['CC_wrapper', '<(gomadir)/gomacc'], 5619 ['CC_wrapper', '<(gomadir)/gomacc'],
5585 ['CXX_wrapper', '<(gomadir)/gomacc'], 5620 ['CXX_wrapper', '<(gomadir)/gomacc'],
(...skipping 64 matching lines...) Expand 10 before | Expand all | Expand 10 after
5650 # settings in target dicts. SYMROOT is a special case, because many other 5685 # settings in target dicts. SYMROOT is a special case, because many other
5651 # Xcode variables depend on it, including variables such as 5686 # Xcode variables depend on it, including variables such as
5652 # PROJECT_DERIVED_FILE_DIR. When a source group corresponding to something 5687 # PROJECT_DERIVED_FILE_DIR. When a source group corresponding to something
5653 # like PROJECT_DERIVED_FILE_DIR is added to a project, in order for the 5688 # like PROJECT_DERIVED_FILE_DIR is added to a project, in order for the
5654 # files to appear (when present) in the UI as actual files and not red 5689 # files to appear (when present) in the UI as actual files and not red
5655 # red "missing file" proxies, the correct path to PROJECT_DERIVED_FILE_DIR, 5690 # red "missing file" proxies, the correct path to PROJECT_DERIVED_FILE_DIR,
5656 # and therefore SYMROOT, needs to be set at the project level. 5691 # and therefore SYMROOT, needs to be set at the project level.
5657 'SYMROOT': '<(DEPTH)/xcodebuild', 5692 'SYMROOT': '<(DEPTH)/xcodebuild',
5658 }, 5693 },
5659 } 5694 }
OLDNEW
« no previous file with comments | « no previous file | build/set_clang_warning_flags.gypi » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698