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

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

Issue 1233683003: Pass corresponding C/C++ flags to ObjC/C++ (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years, 5 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/config/gcc/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") {
(...skipping 72 matching lines...) Expand 10 before | Expand all | Expand 10 after
83 # 83 #
84 # Base compiler configuration. 84 # Base compiler configuration.
85 # 85 #
86 # See also "runtime_library" below for related stuff and a discussion about 86 # See also "runtime_library" below for related stuff and a discussion about
87 # where stuff should go. Put warning related stuff in the "warnings" config. 87 # where stuff should go. Put warning related stuff in the "warnings" config.
88 88
89 config("compiler") { 89 config("compiler") {
90 cflags = [] 90 cflags = []
91 cflags_c = [] 91 cflags_c = []
92 cflags_cc = [] 92 cflags_cc = []
93 cflags_objc = []
94 cflags_objcc = []
93 ldflags = [] 95 ldflags = []
94 defines = [] 96 defines = []
95 97
96 # In general, Windows is totally different, but all the other builds share 98 # In general, Windows is totally different, but all the other builds share
97 # some common GCC configuration. This section sets up Windows and the common 99 # some common GCC configuration. This section sets up Windows and the common
98 # GCC flags, and then we handle the other non-Windows platforms specifically 100 # GCC flags, and then we handle the other non-Windows platforms specifically
99 # below. 101 # below.
100 if (is_win) { 102 if (is_win) {
101 # Windows compiler flags setup. 103 # Windows compiler flags setup.
102 # ----------------------------- 104 # -----------------------------
(...skipping 17 matching lines...) Expand all
120 cflags += [ "-fmsc-version=1800" ] 122 cflags += [ "-fmsc-version=1800" ]
121 } else if (visual_studio_version == "2015") { 123 } else if (visual_studio_version == "2015") {
122 cflags += [ "-fmsc-version=1900" ] 124 cflags += [ "-fmsc-version=1900" ]
123 } 125 }
124 126
125 if (current_cpu == "x86") { 127 if (current_cpu == "x86") {
126 cflags += [ "-m32" ] 128 cflags += [ "-m32" ]
127 } else { 129 } else {
128 cflags += [ "-m64" ] 130 cflags += [ "-m64" ]
129 } 131 }
132
130 # TODO(thakis): Remove this once llvm.org/PR24167 is fixed. 133 # TODO(thakis): Remove this once llvm.org/PR24167 is fixed.
131 if (is_asan) { 134 if (is_asan) {
132 cflags += [ "/fallback" ] 135 cflags += [ "/fallback" ]
133 } 136 }
134 if (exec_script("//build/win/use_ansi_codes.py", [], "trim string") == 137 if (exec_script("//build/win/use_ansi_codes.py", [], "trim string") ==
135 "True") { 138 "True") {
136 cflags += [ 139 cflags += [
137 # cmd.exe doesn't understand ANSI escape codes by default, 140 # cmd.exe doesn't understand ANSI escape codes by default,
138 # so only enable them if something emulating them is around. 141 # so only enable them if something emulating them is around.
139 "-fansi-escape-codes", 142 "-fansi-escape-codes",
(...skipping 122 matching lines...) Expand 10 before | Expand all | Expand 10 after
262 common_mac_flags += [ 265 common_mac_flags += [
263 "-arch", 266 "-arch",
264 "armv7", 267 "armv7",
265 ] 268 ]
266 } 269 }
267 270
268 cflags += common_mac_flags 271 cflags += common_mac_flags
269 272
270 # Without this, the constructors and destructors of a C++ object inside 273 # Without this, the constructors and destructors of a C++ object inside
271 # an Objective C struct won't be called, which is very bad. 274 # an Objective C struct won't be called, which is very bad.
272 cflags_objcc = [ "-fobjc-call-cxx-cdtors" ] 275 cflags_objcc += [ "-fobjc-call-cxx-cdtors" ]
273 276
274 cflags_c += [ "-std=c99" ] 277 cflags_c += [ "-std=c99" ]
275 278
276 ldflags += common_mac_flags 279 ldflags += common_mac_flags
277 } else if (is_posix) { 280 } else if (is_posix) {
278 # Non-Mac Posix compiler flags setup. 281 # Non-Mac Posix compiler flags setup.
279 # ----------------------------------- 282 # -----------------------------------
280 if (enable_profiling && !is_debug) { 283 if (enable_profiling && !is_debug) {
281 # The GYP build spams this define into every compilation unit, as we do 284 # The GYP build spams this define into every compilation unit, as we do
282 # here, but it only appears to be used in base and a couple other places. 285 # here, but it only appears to be used in base and a couple other places.
(...skipping 279 matching lines...) Expand 10 before | Expand all | Expand 10 after
562 if (is_clang) { 565 if (is_clang) {
563 if (current_cpu == "arm") { 566 if (current_cpu == "arm") {
564 cflags += [ "-target arm-linux-androideabi" ] 567 cflags += [ "-target arm-linux-androideabi" ]
565 ldflags += [ "-target arm-linux-androideabi" ] 568 ldflags += [ "-target arm-linux-androideabi" ]
566 } else if (current_cpu == "x86") { 569 } else if (current_cpu == "x86") {
567 cflags += [ "-target x86-linux-androideabi" ] 570 cflags += [ "-target x86-linux-androideabi" ]
568 ldflags += [ "-target x86-linux-androideabi" ] 571 ldflags += [ "-target x86-linux-androideabi" ]
569 } 572 }
570 } 573 }
571 } 574 }
575
576 # Pass the same C/C++ flags to the objective C/C++ compiler.
577 cflags_objc += cflags_c
578 cflags_objcc += cflags_cc
572 } 579 }
573 580
574 config("compiler_arm_fpu") { 581 config("compiler_arm_fpu") {
575 if (current_cpu == "arm" && !is_ios) { 582 if (current_cpu == "arm" && !is_ios) {
576 cflags = [ "-mfpu=$arm_fpu" ] 583 cflags = [ "-mfpu=$arm_fpu" ]
577 } 584 }
578 } 585 }
579 586
580 # runtime_library ------------------------------------------------------------- 587 # runtime_library -------------------------------------------------------------
581 # 588 #
(...skipping 669 matching lines...) Expand 10 before | Expand all | Expand 10 after
1251 cflags += [ "-gsplit-dwarf" ] 1258 cflags += [ "-gsplit-dwarf" ]
1252 } 1259 }
1253 } 1260 }
1254 } 1261 }
1255 1262
1256 config("no_symbols") { 1263 config("no_symbols") {
1257 if (!is_win) { 1264 if (!is_win) {
1258 cflags = [ "-g0" ] 1265 cflags = [ "-g0" ]
1259 } 1266 }
1260 } 1267 }
OLDNEW
« no previous file with comments | « no previous file | build/config/gcc/BUILD.gn » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698