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

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

Issue 1371153005: Mov Linux & Mac GN compiler flags to separate configs. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: 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 | « no previous file | build/config/linux/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 import("//build/config/compiler/compiler.gni") 7 import("//build/config/compiler/compiler.gni")
8 import("//build/toolchain/ccache.gni") 8 import("//build/toolchain/ccache.gni")
9 9
10 if (current_cpu == "arm") { 10 if (current_cpu == "arm") {
(...skipping 92 matching lines...) Expand 10 before | Expand all | Expand 10 after
103 defines = [] 103 defines = []
104 configs = [] 104 configs = []
105 105
106 # System-specific flags. If your compiler flags apply to one of the 106 # System-specific flags. If your compiler flags apply to one of the
107 # categories here, add it to the associated file to keep this shared config 107 # categories here, add it to the associated file to keep this shared config
108 # smaller. 108 # smaller.
109 if (is_win) { 109 if (is_win) {
110 configs += [ "//build/config/win:compiler" ] 110 configs += [ "//build/config/win:compiler" ]
111 } else if (is_android) { 111 } else if (is_android) {
112 configs += [ "//build/config/android:compiler" ] 112 configs += [ "//build/config/android:compiler" ]
113 } else if (is_linux) {
114 configs += [ "//build/config/linux:compiler" ]
113 } 115 }
114 116
115 # In general, Windows is totally different, but all the other builds share 117 # In general, Windows is totally different, but all the other builds share
116 # some common GCC configuration. 118 # some common GCC configuration.
117 if (!is_win) { 119 if (!is_win) {
118 # Common GCC compiler flags setup. 120 # Common GCC compiler flags setup.
119 # -------------------------------- 121 # --------------------------------
120 cflags += [ "-fno-strict-aliasing" ] # See http://crbug.com/32204 122 cflags += [ "-fno-strict-aliasing" ] # See http://crbug.com/32204
121 cflags_cc += [ 123 cflags_cc += [
122 "-fno-threadsafe-statics", 124 "-fno-threadsafe-statics",
(...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after
165 # This is here so that all files get recompiled after a clang roll and 167 # This is here so that all files get recompiled after a clang roll and
166 # when turning clang on or off. (defines are passed via the command line, 168 # when turning clang on or off. (defines are passed via the command line,
167 # and build system rebuild things when their commandline changes). Nothing 169 # and build system rebuild things when their commandline changes). Nothing
168 # should ever read this define. 170 # should ever read this define.
169 defines += 171 defines +=
170 [ "CR_CLANG_REVISION=" + exec_script("//tools/clang/scripts/update.py", 172 [ "CR_CLANG_REVISION=" + exec_script("//tools/clang/scripts/update.py",
171 [ "--print-revision" ], 173 [ "--print-revision" ],
172 "trim string") ] 174 "trim string") ]
173 } 175 }
174 176
175 # Mac-specific compiler flags setup. 177 # Non-Mac Posix compiler flags setup.
176 # ---------------------------------- 178 # -----------------------------------
177 if (is_mac || is_ios) { 179 if (is_posix && !(is_mac || is_ios)) {
178 # These flags are shared between the C compiler and linker.
179 common_mac_flags = []
180
181 # CPU architecture.
182 if (current_cpu == "x64") {
183 common_mac_flags += [
184 "-arch",
185 "x86_64",
186 ]
187 } else if (current_cpu == "x86") {
188 common_mac_flags += [
189 "-arch",
190 "i386",
191 ]
192 } else if (current_cpu == "arm") {
193 # TODO(GYP): we may need to distinguish between "arm64", "armv7",
194 # and "armv7s" for iOS, and hence need multiple current_cpu values
195 # rather than just "arm".
196 common_mac_flags += [
197 "-arch",
198 "arm64",
199 ]
200 }
201
202 cflags += common_mac_flags
203
204 # Without this, the constructors and destructors of a C++ object inside
205 # an Objective C struct won't be called, which is very bad.
206 cflags_objcc += [ "-fobjc-call-cxx-cdtors" ]
207
208 cflags_c += [ "-std=c99" ]
209
210 ldflags += common_mac_flags
211 } else if (is_posix) {
212 # Non-Mac Posix compiler flags setup.
213 # -----------------------------------
214 if (enable_profiling && !is_debug) { 180 if (enable_profiling && !is_debug) {
215 # The GYP build spams this define into every compilation unit, as we do 181 # The GYP build spams this define into every compilation unit, as we do
216 # here, but it only appears to be used in base and a couple other places. 182 # here, but it only appears to be used in base and a couple other places.
217 # TODO(abarth): Should we move this define closer to where it's used? 183 # TODO(abarth): Should we move this define closer to where it's used?
218 defines += [ "ENABLE_PROFILING" ] 184 defines += [ "ENABLE_PROFILING" ]
219 185
220 cflags += [ 186 cflags += [
221 "-fno-omit-frame-pointer", 187 "-fno-omit-frame-pointer",
222 "-g", 188 "-g",
223 ] 189 ]
(...skipping 160 matching lines...) Expand 10 before | Expand all | Expand 10 after
384 "-Wl,-z,now", 350 "-Wl,-z,now",
385 "-Wl,-z,relro", 351 "-Wl,-z,relro",
386 ] 352 ]
387 if (!using_sanitizer && !use_cfi_diag) { 353 if (!using_sanitizer && !use_cfi_diag) {
388 ldflags += [ "-Wl,-z,defs" ] 354 ldflags += [ "-Wl,-z,defs" ]
389 } 355 }
390 } 356 }
391 357
392 # Linux-specific compiler flags setup. 358 # Linux-specific compiler flags setup.
393 # ------------------------------------ 359 # ------------------------------------
394 if (is_linux) {
395 cflags += [ "-pthread" ]
396 ldflags += [ "-pthread" ]
397 }
398 if (use_gold) { 360 if (use_gold) {
399 ldflags += [ 361 ldflags += [
400 "-B$gold_path", 362 "-B$gold_path",
401 363
402 # Newer gccs and clangs support -fuse-ld, use the flag to force gold 364 # Newer gccs and clangs support -fuse-ld, use the flag to force gold
403 # selection. 365 # selection.
404 # gcc -- http://gcc.gnu.org/onlinedocs/gcc-4.8.0/gcc/Optimize-Options.html 366 # gcc -- http://gcc.gnu.org/onlinedocs/gcc-4.8.0/gcc/Optimize-Options.html
405 "-fuse-ld=gold", 367 "-fuse-ld=gold",
406 368
407 # Experimentation found that using four linking threads 369 # Experimentation found that using four linking threads
(...skipping 743 matching lines...) Expand 10 before | Expand all | Expand 10 after
1151 if (symbol_level == 0) { 1113 if (symbol_level == 0) {
1152 configs = [ ":no_symbols" ] 1114 configs = [ ":no_symbols" ]
1153 } else if (symbol_level == 1) { 1115 } else if (symbol_level == 1) {
1154 configs = [ ":minimal_symbols" ] 1116 configs = [ ":minimal_symbols" ]
1155 } else if (symbol_level == 2) { 1117 } else if (symbol_level == 2) {
1156 configs = [ ":symbols" ] 1118 configs = [ ":symbols" ]
1157 } else { 1119 } else {
1158 assert(false) 1120 assert(false)
1159 } 1121 }
1160 } 1122 }
OLDNEW
« no previous file with comments | « no previous file | build/config/linux/BUILD.gn » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698