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

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: Use public_deps instead of deps 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
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. The Windows assembler takes different types of flags
581 # so only do so for posix platforms
582 if (is_posix) {
jamesr 2015/10/21 00:32:10 kinda silly, all of the platforms we target are po
Petr Hosek 2015/10/21 02:23:42 Removed the check.
583 asmflags += cflags
584 asmflags += cflags_c
585 }
586 }
587
588 # This provides the basic options to select the target CPU and ABI.
589 # It is factored out of "compiler" so that special cases can use this
590 # without using everything that "compiler" brings in. Options that
591 # tweak code generation for a particular CPU do not belong here!
592 # See "compiler_codegen", below.
593 config("compiler_cpu_abi") {
594 cflags = []
595 ldflags = []
596
597 if (is_posix && !(is_mac || is_ios)) {
598 # CPU architecture. We may or may not be doing a cross compile now, so for
599 # simplicity we always explicitly set the architecture.
600 if (current_cpu == "x64") {
601 cflags += [
602 "-m64",
603 "-march=x86-64",
604 ]
605 ldflags += [ "-m64" ]
606 } else if (current_cpu == "x86") {
607 cflags += [ "-m32" ]
608 ldflags += [ "-m32" ]
609 } else if (current_cpu == "arm") {
610 if (is_clang && !is_android && !is_nacl) {
611 cflags += [
612 "-target",
613 "arm-linux-gnueabihf",
614 ]
615 ldflags += [
616 "-target",
617 "arm-linux-gnueabihf",
618 ]
619 }
620 if (!is_nacl) {
621 cflags += [
622 "-march=$arm_arch",
623 "-mfloat-abi=$arm_float_abi",
624 ]
625 if (arm_use_thumb) {
626 cflags += [ "-mthumb" ]
627 if (is_android && !is_clang) {
628 # Clang doesn't support this option.
629 cflags += [ "-mthumb-interwork" ]
630 }
631 }
632 }
633 if (arm_tune != "") {
634 cflags += [ "-mtune=$arm_tune" ]
635 }
636 } else if (current_cpu == "mipsel") {
637 if (mips_arch_variant == "r6") {
638 cflags += [
639 "-mips32r6",
640 "-Wa,-mips32r6",
641 ]
642 if (is_android) {
643 ldflags += [
644 "-mips32r6",
645 "-Wl,-melf32ltsmip",
646 ]
647 }
648 } else if (mips_arch_variant == "r2") {
649 cflags += [
650 "-mips32r2",
651 "-Wa,-mips32r2",
652 ]
653 if (mips_float_abi == "hard" && mips_fpu_mode != "") {
654 cflags += [ "-m$mips_fpu_mode" ]
655 }
656 } else if (mips_arch_variant == "r1") {
657 cflags += [
658 "-mips32",
659 "-Wa,-mips32",
660 ]
661 }
662
663 if (mips_dsp_rev == 1) {
664 cflags += [ "-mdsp" ]
665 } else if (mips_dsp_rev == 2) {
666 cflags += [ "-mdspr2" ]
667 }
668
669 cflags += [ "-m${mips_float_abi}-float" ]
670 } else if (current_cpu == "mips64el") {
671 if (mips_arch_variant == "r6") {
672 cflags += [
673 "-mips64r6",
674 "-Wa,-mips64r6",
675 ]
676 ldflags += [ "-mips64r6" ]
677 } else if (mips_arch_variant == "r2") {
678 cflags += [
679 "-mips64r2",
680 "-Wa,-mips64r2",
681 ]
682 ldflags += [ "-mips64r2" ]
683 }
684 }
685 }
686
687 asmflags = cflags
577 } 688 }
578 689
579 config("compiler_arm_fpu") { 690 config("compiler_arm_fpu") {
580 if (current_cpu == "arm" && !is_ios) { 691 if (current_cpu == "arm" && !is_ios) {
581 cflags = [ "-mfpu=$arm_fpu" ] 692 cflags = [ "-mfpu=$arm_fpu" ]
693 asmflags = cflags
582 } 694 }
583 } 695 }
584 696
585 # runtime_library ------------------------------------------------------------- 697 # runtime_library -------------------------------------------------------------
586 # 698 #
587 # Sets the runtime library and associated options. 699 # Sets the runtime library and associated options.
588 # 700 #
589 # How do you determine what should go in here vs. "compiler" above? Consider if 701 # 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 702 # 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 703 # 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. 1339 # value of C4702 for PGO builds is likely very small.
1228 "/wd4702", 1340 "/wd4702",
1229 ] 1341 ]
1230 ldflags += [ "/LTCG" ] 1342 ldflags += [ "/LTCG" ]
1231 } 1343 }
1232 } else { 1344 } else {
1233 cflags += [ "-O2" ] 1345 cflags += [ "-O2" ]
1234 } 1346 }
1235 } 1347 }
1236 1348
1349 # The default optimization applied to all targets. This will be equivalent to
1350 # either "optimize" or "no_optimize", depending on the build flags.
1351 config("default_optimization") {
1352 if (is_nacl_irt) {
1353 # The NaCl IRT is a special case and always wants its own config.
1354 # It gets optimized the same way regardless of the type of build.
1355 configs = [ "//build/config/nacl:irt_optimize" ]
1356 } else if (is_debug) {
1357 configs = [ ":no_optimize" ]
1358 } else {
1359 configs = [ ":optimize" ]
1360 }
1361 }
1362
1237 # Symbols ---------------------------------------------------------------------- 1363 # Symbols ----------------------------------------------------------------------
1238 1364
1239 config("symbols") { 1365 config("symbols") {
1240 if (is_win) { 1366 if (is_win) {
1241 import("//build/toolchain/goma.gni") 1367 import("//build/toolchain/goma.gni")
1242 if (use_goma) { 1368 if (use_goma) {
1243 cflags = [ "/Z7" ] # No PDB file 1369 cflags = [ "/Z7" ] # No PDB file
1244 } else { 1370 } else {
1245 cflags = [ "/Zi" ] # Produce PDB file, no edit and continue. 1371 cflags = [ "/Zi" ] # Produce PDB file, no edit and continue.
1246 } 1372 }
1247 ldflags = [ "/DEBUG" ] 1373 ldflags = [ "/DEBUG" ]
1248 } else { 1374 } else {
1249 cflags = [ "-g2" ] 1375 cflags = [ "-g2" ]
1250 if (use_debug_fission) { 1376 if (use_debug_fission) {
1251 cflags += [ "-gsplit-dwarf" ] 1377 cflags += [ "-gsplit-dwarf" ]
1252 } 1378 }
1379 asmflags = cflags
1380 ldflags = []
1253 } 1381 }
1254 } 1382 }
1255 1383
1256 config("minimal_symbols") { 1384 config("minimal_symbols") {
1257 if (is_win) { 1385 if (is_win) {
1258 # Linker symbols for backtraces only. 1386 # Linker symbols for backtraces only.
1259 ldflags = [ "/DEBUG" ] 1387 ldflags = [ "/DEBUG" ]
1260 } else { 1388 } else {
1261 cflags = [ "-g1" ] 1389 cflags = [ "-g1" ]
1262 if (use_debug_fission) { 1390 if (use_debug_fission) {
1263 cflags += [ "-gsplit-dwarf" ] 1391 cflags += [ "-gsplit-dwarf" ]
1264 } 1392 }
1393 asmflags = cflags
1394 ldflags = []
1265 } 1395 }
1266 } 1396 }
1267 1397
1268 config("no_symbols") { 1398 config("no_symbols") {
1269 if (!is_win) { 1399 if (!is_win) {
1270 cflags = [ "-g0" ] 1400 cflags = [ "-g0" ]
1401 asmflags = cflags
1271 } 1402 }
1272 } 1403 }
1404
1405 # Default symbols.
1406 config("default_symbols") {
1407 if (symbol_level == 0) {
1408 configs = [ ":no_symbols" ]
1409 } else if (symbol_level == 1) {
1410 configs = [ ":minimal_symbols" ]
1411 } else if (symbol_level == 2) {
1412 configs = [ ":symbols" ]
1413 } else {
1414 assert(false)
1415 }
1416 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698