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

Side by Side Diff: build/config/BUILDCONFIG.gn

Issue 287693002: Support private values in GN. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: fix semicolon Created 6 years, 7 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 | Annotate | Revision Log
« no previous file with comments | « no previous file | tools/gn/function_set_defaults.cc » ('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 # ============================================================================= 5 # =============================================================================
6 # BUILD FLAGS 6 # BUILD FLAGS
7 # ============================================================================= 7 # =============================================================================
8 # 8 #
9 # This block lists input arguments to the build, along with their default 9 # This block lists input arguments to the build, along with their default
10 # values. GN requires listing them explicitly so it can validate input and have 10 # values. GN requires listing them explicitly so it can validate input and have
(...skipping 162 matching lines...) Expand 10 before | Expand all | Expand 10 after
173 173
174 # ============================================================================= 174 # =============================================================================
175 # SOURCES FILTERS 175 # SOURCES FILTERS
176 # ============================================================================= 176 # =============================================================================
177 # 177 #
178 # These patterns filter out platform-specific files when assigning to the 178 # These patterns filter out platform-specific files when assigning to the
179 # sources variable. The magic variable |sources_assignment_filter| is applied 179 # sources variable. The magic variable |sources_assignment_filter| is applied
180 # to each assignment or appending to the sources variable and matches are 180 # to each assignment or appending to the sources variable and matches are
181 # automatcally removed. 181 # automatcally removed.
182 # 182 #
183 # We define lists of filters for each platform for all builds so they can
184 # be used by individual targets if necessary (a target can always change
185 # sources_assignment_filter on itself if it needs something more specific).
186 #
187 # Note that the patterns are NOT regular expressions. Only "*" and "\b" (path 183 # Note that the patterns are NOT regular expressions. Only "*" and "\b" (path
188 # boundary = end of string or slash) are supported, and the entire string 184 # boundary = end of string or slash) are supported, and the entire string
189 # muct match the pattern (so you need "*.cc" to match all .cc files, for 185 # muct match the pattern (so you need "*.cc" to match all .cc files, for
190 # example). 186 # example).
191 187
192 # DO NOT ADD MORE PATTERNS TO THIS LIST, see set_sources_assignment_filter call 188 # DO NOT ADD MORE PATTERNS TO THIS LIST, see set_sources_assignment_filter call
193 # below. 189 # below.
194 windows_sources_filters = [ 190 sources_assignment_filter = []
195 "*_win.cc", 191 if (!is_posix) {
196 "*_win.h", 192 sources_assignment_filter += [
197 "*_win_unittest.cc", 193 "*_posix.h",
198 "*\bwin/*", 194 "*_posix.cc",
199 "*.rc", 195 "*_posix_unittest.h",
200 ] 196 "*_posix_unittest.cc",
201 mac_sources_filters = [ 197 "*\bposix/*",
202 "*_mac.h", 198 ]
203 "*_mac.cc", 199 }
204 "*_mac.mm", 200 if (!is_win) {
205 "*_mac_unittest.h", 201 sources_assignment_filter += [
206 "*_mac_unittest.cc", 202 "*_win.cc",
207 "*_mac_unittest.mm", 203 "*_win.h",
208 "*\bmac/*", 204 "*_win_unittest.cc",
209 "*_cocoa.h", 205 "*\bwin/*",
210 "*_cocoa.cc", 206 "*.rc",
211 "*_cocoa.mm", 207 ]
212 "*_cocoa_unittest.h", 208 }
213 "*_cocoa_unittest.cc", 209 if (!is_mac) {
214 "*_cocoa_unittest.mm", 210 sources_assignment_filter += [
215 "*\bcocoa/*", 211 "*_mac.h",
216 ] 212 "*_mac.cc",
217 ios_sources_filters = [ 213 "*_mac.mm",
218 "*_ios.h", 214 "*_mac_unittest.h",
219 "*_ios.cc", 215 "*_mac_unittest.cc",
220 "*_ios.mm", 216 "*_mac_unittest.mm",
221 "*_ios_unittest.h", 217 "*\bmac/*",
222 "*_ios_unittest.cc", 218 "*_cocoa.h",
223 "*_ios_unittest.mm", 219 "*_cocoa.cc",
224 "*\bios/*", 220 "*_cocoa.mm",
225 ] 221 "*_cocoa_unittest.h",
226 objective_c_sources_filters = [ 222 "*_cocoa_unittest.cc",
227 "*.mm", 223 "*_cocoa_unittest.mm",
228 ] 224 "*\bcocoa/*",
229 linux_sources_filters = [ 225 ]
230 "*_linux.h", 226 }
231 "*_linux.cc", 227 if (!is_ios) {
232 "*_linux_unittest.h", 228 sources_assignment_filter += [
233 "*_linux_unittest.cc", 229 "*_ios.h",
234 "*\blinux/*", 230 "*_ios.cc",
235 ] 231 "*_ios.mm",
236 android_sources_filters = [ 232 "*_ios_unittest.h",
237 "*_android.h", 233 "*_ios_unittest.cc",
238 "*_android.cc", 234 "*_ios_unittest.mm",
239 "*_android_unittest.h", 235 "*\bios/*",
240 "*_android_unittest.cc", 236 ]
241 "*\bandroid/*", 237 }
242 ] 238 if (!is_mac && !is_ios) {
243 posix_sources_filters = [ 239 sources_assignment_filter += [
244 "*_posix.h", 240 "*.mm",
245 "*_posix.cc", 241 ]
246 "*_posix_unittest.h", 242 }
247 "*_posix_unittest.cc", 243 if (!is_linux) {
248 "*\bposix/*", 244 sources_assignment_filter += [
249 ] 245 "*_linux.h",
250 chromeos_sources_filters = [ 246 "*_linux.cc",
251 "*_chromeos.h", 247 "*_linux_unittest.h",
252 "*_chromeos.cc", 248 "*_linux_unittest.cc",
253 "*_chromeos_unittest.h", 249 "*\blinux/*",
254 "*_chromeos_unittest.cc", 250 ]
255 "*\bchromeos/*", 251 }
256 ] 252 if (!is_android) {
253 sources_assignment_filter += [
254 "*_android.h",
255 "*_android.cc",
256 "*_android_unittest.h",
257 "*_android_unittest.cc",
258 "*\bandroid/*",
259 ]
260 }
261 if (!is_chromeos) {
262 sources_assignment_filter += [
263 "*_chromeos.h",
264 "*_chromeos.cc",
265 "*_chromeos_unittest.h",
266 "*_chromeos_unittest.cc",
267 "*\bchromeos/*",
268 ]
269 }
257 # DO NOT ADD MORE PATTERNS TO THIS LIST, see set_sources_assignment_filter call 270 # DO NOT ADD MORE PATTERNS TO THIS LIST, see set_sources_assignment_filter call
258 # below. 271 # below.
259 272
260 # Construct the full list of sources we're using for this platform.
261 sources_assignment_filter = []
262 if (is_win) {
263 sources_assignment_filter += posix_sources_filters
264 } else {
265 sources_assignment_filter += windows_sources_filters
266 }
267 if (!is_mac) {
268 sources_assignment_filter += mac_sources_filters
269 }
270 if (!is_ios) {
271 sources_assignment_filter += ios_sources_filters
272 }
273 if (!is_mac && !is_ios) {
274 sources_assignment_filter += objective_c_sources_filters
275 }
276 if (!is_linux) {
277 sources_assignment_filter += linux_sources_filters
278 }
279 if (!is_android) {
280 sources_assignment_filter += android_sources_filters
281 }
282 if (!is_chromeos) {
283 sources_assignment_filter += chromeos_sources_filters
284 }
285
286 # Actually save this list. 273 # Actually save this list.
287 # 274 #
288 # DO NOT ADD MORE PATTERNS TO THIS LIST.
289 #
290 # These patterns are executed for every file in the source tree of every run. 275 # These patterns are executed for every file in the source tree of every run.
291 # Therefore, adding more patterns slows down the build for everybody. We should 276 # Therefore, adding more patterns slows down the build for everybody. We should
292 # only add automatic patterns for configurations affecting hundreds of files 277 # only add automatic patterns for configurations affecting hundreds of files
293 # across many projects in the tree. 278 # across many projects in the tree.
294 # 279 #
295 # Therefore, we only add rules to this list corresponding to platforms on the 280 # Therefore, we only add rules to this list corresponding to platforms on the
296 # Chromium waterfall. This is not for non-officially-supported platforms 281 # Chromium waterfall. This is not for non-officially-supported platforms
297 # (FreeBSD, etc.) toolkits, (X11, GTK, etc.), or features. For these cases, 282 # (FreeBSD, etc.) toolkits, (X11, GTK, etc.), or features. For these cases,
298 # write a conditional in the target to remove the file(s) from the list when 283 # write a conditional in the target to remove the file(s) from the list when
299 # your platform/toolkit/feature doesn't apply. 284 # your platform/toolkit/feature doesn't apply.
(...skipping 19 matching lines...) Expand all
319 # TARGET DEFAULTS 304 # TARGET DEFAULTS
320 # ============================================================================= 305 # =============================================================================
321 # 306 #
322 # Set up the default configuration for every build target of the given type. 307 # Set up the default configuration for every build target of the given type.
323 # The values configured here will be automatically set on the scope of the 308 # The values configured here will be automatically set on the scope of the
324 # corresponding target. Target definitions can add or remove to the settings 309 # corresponding target. Target definitions can add or remove to the settings
325 # here as needed. 310 # here as needed.
326 311
327 # Holds all configs used for making native executables and libraries, to avoid 312 # Holds all configs used for making native executables and libraries, to avoid
328 # duplication in each target below. 313 # duplication in each target below.
329 native_compiler_configs = [ 314 _native_compiler_configs = [
330 "//build/config:feature_flags", 315 "//build/config:feature_flags",
331 316
332 "//build/config/compiler:compiler", 317 "//build/config/compiler:compiler",
333 "//build/config/compiler:chromium_code", 318 "//build/config/compiler:chromium_code",
334 "//build/config/compiler:default_warnings", 319 "//build/config/compiler:default_warnings",
335 "//build/config/compiler:no_rtti", 320 "//build/config/compiler:no_rtti",
336 "//build/config/compiler:runtime_library", 321 "//build/config/compiler:runtime_library",
337 ] 322 ]
338 if (is_win) { 323 if (is_win) {
339 native_compiler_configs += [ 324 _native_compiler_configs += [
340 "//build/config/win:lean_and_mean", 325 "//build/config/win:lean_and_mean",
341 "//build/config/win:sdk", 326 "//build/config/win:sdk",
342 "//build/config/win:unicode", 327 "//build/config/win:unicode",
343 ] 328 ]
344 } else if (is_linux) { 329 } else if (is_linux) {
345 native_compiler_configs += [ "//build/config/linux:sdk", ] 330 _native_compiler_configs += [ "//build/config/linux:sdk", ]
346 } else if (is_mac) { 331 } else if (is_mac) {
347 native_compiler_configs += [ "//build/config/mac:sdk", ] 332 _native_compiler_configs += [ "//build/config/mac:sdk", ]
348 } else if (is_ios) { 333 } else if (is_ios) {
349 native_compiler_configs += [ "//build/config/ios:sdk", ] 334 _native_compiler_configs += [ "//build/config/ios:sdk", ]
350 } else if (is_android) { 335 } else if (is_android) {
351 native_compiler_configs += [ "//build/config/android:sdk", ] 336 _native_compiler_configs += [ "//build/config/android:sdk", ]
352 } 337 }
353 if (!is_win) { 338 if (!is_win) {
354 native_compiler_configs += [ "//build/config/gcc:symbol_visibility_hidden" ] 339 _native_compiler_configs += [ "//build/config/gcc:symbol_visibility_hidden" ]
355 } 340 }
356 if (is_clang) { 341 if (is_clang) {
357 native_compiler_configs += [ 342 _native_compiler_configs += [
358 "//build/config/clang:find_bad_constructs", 343 "//build/config/clang:find_bad_constructs",
359 "//build/config/clang:extra_warnings", 344 "//build/config/clang:extra_warnings",
360 ] 345 ]
361 } 346 }
362 347
363 # Optimizations and debug checking. 348 # Optimizations and debug checking.
364 if (is_debug) { 349 if (is_debug) {
365 native_compiler_configs += [ "//build/config:debug" ] 350 _native_compiler_configs += [ "//build/config:debug" ]
366 default_optimization_config = "//build/config/compiler:no_optimize" 351 _default_optimization_config = "//build/config/compiler:no_optimize"
367 } else { 352 } else {
368 native_compiler_configs += [ "//build/config:release" ] 353 _native_compiler_configs += [ "//build/config:release" ]
369 default_optimization_config = "//build/config/compiler:optimize" 354 _default_optimization_config = "//build/config/compiler:optimize"
370 } 355 }
371 native_compiler_configs += [ default_optimization_config ] 356 _native_compiler_configs += [ _default_optimization_config ]
372 357
373 # Symbol setup. 358 # Symbol setup.
374 if (is_clang && (is_linux || is_android)) { 359 if (is_clang && (is_linux || is_android)) {
375 # Clang creates chubby debug information, which makes linking very slow. 360 # Clang creates chubby debug information, which makes linking very slow.
376 # For now, don't create debug information with clang. 361 # For now, don't create debug information with clang.
377 # See http://crbug.com/70000 362 # See http://crbug.com/70000
378 # TODO(brettw) This just copies GYP. Why not do this on Mac as well? 363 # TODO(brettw) This just copies GYP. Why not do this on Mac as well?
379 default_symbols_config = "//build/config/compiler:no_symbols" 364 _default_symbols_config = "//build/config/compiler:no_symbols"
380 } else if (symbol_level == 2) { 365 } else if (symbol_level == 2) {
381 default_symbols_config = "//build/config/compiler:symbols" 366 _default_symbols_config = "//build/config/compiler:symbols"
382 } else if (symbol_level == 1) { 367 } else if (symbol_level == 1) {
383 default_symbols_config = "//build/config/compiler:minimal_symbols" 368 _default_symbols_config = "//build/config/compiler:minimal_symbols"
384 } else if (symbol_level == 0) { 369 } else if (symbol_level == 0) {
385 default_symbols_config = "//build/config/compiler:no_symbols" 370 _default_symbols_config = "//build/config/compiler:no_symbols"
386 } else { 371 } else {
387 assert(false, "Bad value for symbol_level.") 372 assert(false, "Bad value for symbol_level.")
388 } 373 }
389 native_compiler_configs += [ default_symbols_config ] 374 _native_compiler_configs += [ _default_symbols_config ]
390 375
391 # Windows linker setup for EXEs and DLLs. 376 # Windows linker setup for EXEs and DLLs.
392 if (is_win) { 377 if (is_win) {
393 if (is_debug) { 378 if (is_debug) {
394 default_incremental_linking_config = 379 _default_incremental_linking_config =
395 "//build/config/win:incremental_linking" 380 "//build/config/win:incremental_linking"
396 } else { 381 } else {
397 default_incremental_linking_config = 382 _default_incremental_linking_config =
398 "//build/config/win:no_incremental_linking" 383 "//build/config/win:no_incremental_linking"
399 } 384 }
400 windows_linker_configs = [ 385 _windows_linker_configs = [
401 default_incremental_linking_config, 386 _default_incremental_linking_config,
402 "//build/config/win:sdk_link", 387 "//build/config/win:sdk_link",
403 "//build/config/win:common_linker_setup", 388 "//build/config/win:common_linker_setup",
404 # Default to console-mode apps. Most of our targets are tests and such 389 # Default to console-mode apps. Most of our targets are tests and such
405 # that shouldn't use the windows subsystem. 390 # that shouldn't use the windows subsystem.
406 "//build/config/win:console", 391 "//build/config/win:console",
407 ] 392 ]
408 } 393 }
409 394
410 set_defaults("executable") { 395 set_defaults("executable") {
411 configs = native_compiler_configs + [ 396 configs = _native_compiler_configs + [
412 "//build/config:default_libs", 397 "//build/config:default_libs",
413 ] 398 ]
414 if (is_win) { 399 if (is_win) {
415 configs += windows_linker_configs 400 configs += _windows_linker_configs
416 } else if (is_mac) { 401 } else if (is_mac) {
417 configs += [ 402 configs += [
418 "//build/config/mac:mac_dynamic_flags", 403 "//build/config/mac:mac_dynamic_flags",
419 "//build/config/mac:mac_executable_flags" ] 404 "//build/config/mac:mac_executable_flags" ]
420 } else if (is_linux || is_android) { 405 } else if (is_linux || is_android) {
421 configs += [ "//build/config/gcc:executable_ldconfig" ] 406 configs += [ "//build/config/gcc:executable_ldconfig" ]
422 } 407 }
423 } 408 }
424 409
425 set_defaults("static_library") { 410 set_defaults("static_library") {
426 configs = native_compiler_configs 411 configs = _native_compiler_configs
427 } 412 }
428 413
429 set_defaults("shared_library") { 414 set_defaults("shared_library") {
430 configs = native_compiler_configs + [ 415 configs = _native_compiler_configs + [
431 "//build/config:default_libs", 416 "//build/config:default_libs",
432 ] 417 ]
433 if (is_win) { 418 if (is_win) {
434 configs += windows_linker_configs 419 configs += _windows_linker_configs
435 } else if (is_mac) { 420 } else if (is_mac) {
436 configs += [ "//build/config/mac:mac_dynamic_flags" ] 421 configs += [ "//build/config/mac:mac_dynamic_flags" ]
437 } 422 }
438 } 423 }
439 424
440 set_defaults("source_set") { 425 set_defaults("source_set") {
441 configs = native_compiler_configs 426 configs = _native_compiler_configs
442 } 427 }
443 428
444 # ============================================================================== 429 # ==============================================================================
445 # TOOLCHAIN SETUP 430 # TOOLCHAIN SETUP
446 # ============================================================================== 431 # ==============================================================================
447 # 432 #
448 # Here we set the default toolchain, as well as the variable host_toolchain 433 # Here we set the default toolchain, as well as the variable host_toolchain
449 # which will identify the toolchain corresponding to the local system when 434 # which will identify the toolchain corresponding to the local system when
450 # doing cross-compiles. When not cross-compiling, this will be the same as the 435 # doing cross-compiles. When not cross-compiling, this will be the same as the
451 # default toolchain. 436 # default toolchain.
(...skipping 18 matching lines...) Expand all
470 } else if (is_linux) { 455 } else if (is_linux) {
471 host_toolchain = "//build/toolchain/linux:$build_cpu_arch" 456 host_toolchain = "//build/toolchain/linux:$build_cpu_arch"
472 set_default_toolchain("//build/toolchain/linux:$cpu_arch") 457 set_default_toolchain("//build/toolchain/linux:$cpu_arch")
473 } else if (is_mac) { 458 } else if (is_mac) {
474 host_toolchain = "//build/toolchain/mac:clang" 459 host_toolchain = "//build/toolchain/mac:clang"
475 set_default_toolchain(host_toolchain) 460 set_default_toolchain(host_toolchain)
476 } else if (is_ios) { 461 } else if (is_ios) {
477 host_toolchain = "//build/toolchain/mac:host_clang" 462 host_toolchain = "//build/toolchain/mac:host_clang"
478 set_default_toolchain("//build/toolchain/mac:clang") 463 set_default_toolchain("//build/toolchain/mac:clang")
479 } 464 }
OLDNEW
« no previous file with comments | « no previous file | tools/gn/function_set_defaults.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698