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

Side by Side Diff: build/config/compiler/BUILD.gn

Issue 1418653002: Synchronize GN build configuration with Chrome (Closed) Base URL: https://github.com/domokit/mojo.git@master
Patch Set: Review feedback addressed Created 5 years, 2 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 | « build/config/android/rules.gni ('k') | build/config/mac/BUILD.gn » ('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) 2013 The Chromium Authors. All rights reserved. 1 # Copyright (c) 2013 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 import("//build/config/android/config.gni") 5 import("//build/config/android/config.gni")
6 import("//build/config/chrome_build.gni") 6 import("//build/config/chrome_build.gni")
7 if (current_cpu == "arm") { 7 if (current_cpu == "arm") {
8 import("//build/config/arm.gni") 8 import("//build/config/arm.gni")
9 } 9 }
10 if (current_cpu == "mipsel" || current_cpu == "mips64el") { 10 if (current_cpu == "mipsel" || current_cpu == "mips64el") {
11 import("//build/config/mips.gni") 11 import("//build/config/mips.gni")
12 } 12 }
13 if (is_posix) { 13 if (is_posix) {
14 import("//build/config/gcc/gcc_version.gni") 14 import("//build/config/gcc/gcc_version.gni")
15 } 15 }
16 16 import("//build/config/nacl/config.gni")
17 import("//build/toolchain/ccache.gni") 17 import("//build/toolchain/ccache.gni")
18 import("//build/config/sanitizers/sanitizers.gni") 18 import("//build/config/sanitizers/sanitizers.gni")
19 19
20 declare_args() { 20 declare_args() {
21 # Normally, Android builds are lightly optimized, even for debug builds, to 21 # Normally, Android builds are lightly optimized, even for debug builds, to
22 # keep binary size down. Setting this flag to true disables such optimization 22 # keep binary size down. Setting this flag to true disables such optimization
23 android_full_debug = false 23 android_full_debug = false
24 24
25 # Whether to use the binary binutils checked into third_party/binutils. 25 # Whether to use the binary binutils checked into third_party/binutils.
26 # These are not multi-arch so cannot be used except on x86 and x86-64 (the 26 # These are not multi-arch so cannot be used except on x86 and x86-64 (the
(...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after
77 } 77 }
78 78
79 # compiler --------------------------------------------------------------------- 79 # compiler ---------------------------------------------------------------------
80 # 80 #
81 # Base compiler configuration. 81 # Base compiler configuration.
82 # 82 #
83 # See also "runtime_library" below for related stuff and a discussion about 83 # See also "runtime_library" below for related stuff and a discussion about
84 # where stuff should go. Put warning related stuff in the "warnings" config. 84 # where stuff should go. Put warning related stuff in the "warnings" config.
85 85
86 config("compiler") { 86 config("compiler") {
87 asmflags = []
87 cflags = [] 88 cflags = []
88 cflags_c = [] 89 cflags_c = []
89 cflags_cc = [] 90 cflags_cc = []
90 ldflags = [] 91 ldflags = []
91 defines = [] 92 defines = []
92 93
93 # In general, Windows is totally different, but all the other builds share 94 # In general, Windows is totally different, but all the other builds share
94 # some common GCC configuration. This section sets up Windows and the common 95 # some common GCC configuration. This section sets up Windows and the common
95 # GCC flags, and then we handle the other non-Windows platforms specifically 96 # GCC flags, and then we handle the other non-Windows platforms specifically
96 # below. 97 # below.
(...skipping 470 matching lines...) Expand 10 before | Expand all | Expand 10 after
567 if (is_clang) { 568 if (is_clang) {
568 if (current_cpu == "arm") { 569 if (current_cpu == "arm") {
569 cflags += [ "-target arm-linux-androideabi" ] 570 cflags += [ "-target arm-linux-androideabi" ]
570 ldflags += [ "-target arm-linux-androideabi" ] 571 ldflags += [ "-target arm-linux-androideabi" ]
571 } else if (current_cpu == "x86") { 572 } else if (current_cpu == "x86") {
572 cflags += [ "-target x86-linux-androideabi" ] 573 cflags += [ "-target x86-linux-androideabi" ]
573 ldflags += [ "-target x86-linux-androideabi" ] 574 ldflags += [ "-target x86-linux-androideabi" ]
574 } 575 }
575 } 576 }
576 } 577 }
578
579 # Assign any flags set for the C compiler to asmflags so that they are sent
580 # to the assembler.
581 asmflags += cflags
582 asmflags += cflags_c
583 }
584
585 # This provides the basic options to select the target CPU and ABI.
586 # It is factored out of "compiler" so that special cases can use this
587 # without using everything that "compiler" brings in. Options that
588 # tweak code generation for a particular CPU do not belong here!
589 # See "compiler_codegen", below.
590 config("compiler_cpu_abi") {
591 cflags = []
592 ldflags = []
593
594 if (is_posix && !(is_mac || is_ios)) {
595 # CPU architecture. We may or may not be doing a cross compile now, so for
596 # simplicity we always explicitly set the architecture.
597 if (current_cpu == "x64") {
598 cflags += [
599 "-m64",
600 "-march=x86-64",
601 ]
602 ldflags += [ "-m64" ]
603 } else if (current_cpu == "x86") {
604 cflags += [ "-m32" ]
605 ldflags += [ "-m32" ]
606 } else if (current_cpu == "arm") {
607 if (is_clang && !is_android && !is_nacl) {
608 cflags += [
609 "-target",
610 "arm-linux-gnueabihf",
611 ]
612 ldflags += [
613 "-target",
614 "arm-linux-gnueabihf",
615 ]
616 }
617 if (!is_nacl) {
618 cflags += [
619 "-march=$arm_arch",
620 "-mfloat-abi=$arm_float_abi",
621 ]
622 if (arm_use_thumb) {
623 cflags += [ "-mthumb" ]
624 if (is_android && !is_clang) {
625 # Clang doesn't support this option.
626 cflags += [ "-mthumb-interwork" ]
627 }
628 }
629 }
630 if (arm_tune != "") {
631 cflags += [ "-mtune=$arm_tune" ]
632 }
633 } else if (current_cpu == "mipsel") {
634 if (mips_arch_variant == "r6") {
635 cflags += [
636 "-mips32r6",
637 "-Wa,-mips32r6",
638 ]
639 if (is_android) {
640 ldflags += [
641 "-mips32r6",
642 "-Wl,-melf32ltsmip",
643 ]
644 }
645 } else if (mips_arch_variant == "r2") {
646 cflags += [
647 "-mips32r2",
648 "-Wa,-mips32r2",
649 ]
650 if (mips_float_abi == "hard" && mips_fpu_mode != "") {
651 cflags += [ "-m$mips_fpu_mode" ]
652 }
653 } else if (mips_arch_variant == "r1") {
654 cflags += [
655 "-mips32",
656 "-Wa,-mips32",
657 ]
658 }
659
660 if (mips_dsp_rev == 1) {
661 cflags += [ "-mdsp" ]
662 } else if (mips_dsp_rev == 2) {
663 cflags += [ "-mdspr2" ]
664 }
665
666 cflags += [ "-m${mips_float_abi}-float" ]
667 } else if (current_cpu == "mips64el") {
668 if (mips_arch_variant == "r6") {
669 cflags += [
670 "-mips64r6",
671 "-Wa,-mips64r6",
672 ]
673 ldflags += [ "-mips64r6" ]
674 } else if (mips_arch_variant == "r2") {
675 cflags += [
676 "-mips64r2",
677 "-Wa,-mips64r2",
678 ]
679 ldflags += [ "-mips64r2" ]
680 }
681 }
682 }
683
684 asmflags = cflags
577 } 685 }
578 686
579 config("compiler_arm_fpu") { 687 config("compiler_arm_fpu") {
580 if (current_cpu == "arm" && !is_ios) { 688 if (current_cpu == "arm" && !is_ios) {
581 cflags = [ "-mfpu=$arm_fpu" ] 689 cflags = [ "-mfpu=$arm_fpu" ]
690 asmflags = cflags
582 } 691 }
583 } 692 }
584 693
585 # runtime_library ------------------------------------------------------------- 694 # runtime_library -------------------------------------------------------------
586 # 695 #
587 # Sets the runtime library and associated options. 696 # Sets the runtime library and associated options.
588 # 697 #
589 # How do you determine what should go in here vs. "compiler" above? Consider if 698 # How do you determine what should go in here vs. "compiler" above? Consider if
590 # a target might choose to use a different runtime library (ignore for a moment 699 # a target might choose to use a different runtime library (ignore for a moment
591 # if this is possible or reasonable on your system). If such a target would want 700 # if this is possible or reasonable on your system). If such a target would want
(...skipping 635 matching lines...) Expand 10 before | Expand all | Expand 10 after
1227 # value of C4702 for PGO builds is likely very small. 1336 # value of C4702 for PGO builds is likely very small.
1228 "/wd4702", 1337 "/wd4702",
1229 ] 1338 ]
1230 ldflags += [ "/LTCG" ] 1339 ldflags += [ "/LTCG" ]
1231 } 1340 }
1232 } else { 1341 } else {
1233 cflags += [ "-O2" ] 1342 cflags += [ "-O2" ]
1234 } 1343 }
1235 } 1344 }
1236 1345
1346 # The default optimization applied to all targets. This will be equivalent to
1347 # either "optimize" or "no_optimize", depending on the build flags.
1348 config("default_optimization") {
1349 if (is_nacl_irt) {
1350 # The NaCl IRT is a special case and always wants its own config.
1351 # It gets optimized the same way regardless of the type of build.
1352 configs = [ "//build/config/nacl:irt_optimize" ]
1353 } else if (is_debug) {
1354 configs = [ ":no_optimize" ]
1355 } else {
1356 configs = [ ":optimize" ]
1357 }
1358 }
1359
1237 # Symbols ---------------------------------------------------------------------- 1360 # Symbols ----------------------------------------------------------------------
1238 1361
1239 config("symbols") { 1362 config("symbols") {
1240 if (is_win) { 1363 if (is_win) {
1241 import("//build/toolchain/goma.gni") 1364 import("//build/toolchain/goma.gni")
1242 if (use_goma) { 1365 if (use_goma) {
1243 cflags = [ "/Z7" ] # No PDB file 1366 cflags = [ "/Z7" ] # No PDB file
1244 } else { 1367 } else {
1245 cflags = [ "/Zi" ] # Produce PDB file, no edit and continue. 1368 cflags = [ "/Zi" ] # Produce PDB file, no edit and continue.
1246 } 1369 }
1247 ldflags = [ "/DEBUG" ] 1370 ldflags = [ "/DEBUG" ]
1248 } else { 1371 } else {
1249 cflags = [ "-g2" ] 1372 cflags = [ "-g2" ]
1250 if (use_debug_fission) { 1373 if (use_debug_fission) {
1251 cflags += [ "-gsplit-dwarf" ] 1374 cflags += [ "-gsplit-dwarf" ]
1252 } 1375 }
1376 asmflags = cflags
1377 ldflags = []
1253 } 1378 }
1254 } 1379 }
1255 1380
1256 config("minimal_symbols") { 1381 config("minimal_symbols") {
1257 if (is_win) { 1382 if (is_win) {
1258 # Linker symbols for backtraces only. 1383 # Linker symbols for backtraces only.
1259 ldflags = [ "/DEBUG" ] 1384 ldflags = [ "/DEBUG" ]
1260 } else { 1385 } else {
1261 cflags = [ "-g1" ] 1386 cflags = [ "-g1" ]
1262 if (use_debug_fission) { 1387 if (use_debug_fission) {
1263 cflags += [ "-gsplit-dwarf" ] 1388 cflags += [ "-gsplit-dwarf" ]
1264 } 1389 }
1390 asmflags = cflags
1391 ldflags = []
1265 } 1392 }
1266 } 1393 }
1267 1394
1268 config("no_symbols") { 1395 config("no_symbols") {
1269 if (!is_win) { 1396 if (!is_win) {
1270 cflags = [ "-g0" ] 1397 cflags = [ "-g0" ]
1398 asmflags = cflags
1271 } 1399 }
1272 } 1400 }
1401
1402 # Default symbols.
1403 config("default_symbols") {
1404 if (symbol_level == 0) {
1405 configs = [ ":no_symbols" ]
1406 } else if (symbol_level == 1) {
1407 configs = [ ":minimal_symbols" ]
1408 } else if (symbol_level == 2) {
1409 configs = [ ":symbols" ]
1410 } else {
1411 assert(false)
1412 }
1413 }
OLDNEW
« no previous file with comments | « build/config/android/rules.gni ('k') | build/config/mac/BUILD.gn » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698