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

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

Issue 2150753002: Separate out target defaults in the GN build config. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Format Created 4 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/ios/rules.gni » ('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 # PLATFORM SELECTION 6 # PLATFORM SELECTION
7 # ============================================================================= 7 # =============================================================================
8 # 8 #
9 # There are two main things to set: "os" and "cpu". The "toolchain" is the name 9 # There are two main things to set: "os" and "cpu". The "toolchain" is the name
10 # of the GN thing that encodes combinations of these things. 10 # of the GN thing that encodes combinations of these things.
(...skipping 437 matching lines...) Expand 10 before | Expand all | Expand 10 after
448 448
449 # ============================================================================= 449 # =============================================================================
450 # TARGET DEFAULTS 450 # TARGET DEFAULTS
451 # ============================================================================= 451 # =============================================================================
452 # 452 #
453 # Set up the default configuration for every build target of the given type. 453 # Set up the default configuration for every build target of the given type.
454 # The values configured here will be automatically set on the scope of the 454 # The values configured here will be automatically set on the scope of the
455 # corresponding target. Target definitions can add or remove to the settings 455 # corresponding target. Target definitions can add or remove to the settings
456 # here as needed. 456 # here as needed.
457 457
458 # Holds all configs used for making native executables and libraries, to avoid 458 # Holds all configs used for running the compiler.
459 # duplication in each target below. 459 default_compiler_configs = [
Dirk Pranke 2016/07/14 21:40:39 So, these renames aren't strictly needed (or used
460 _native_compiler_configs = [
461 "//build/config:feature_flags", 460 "//build/config:feature_flags",
462 "//build/config/compiler:compiler", 461 "//build/config/compiler:compiler",
463 "//build/config/compiler:clang_stackrealign", 462 "//build/config/compiler:clang_stackrealign",
464 "//build/config/compiler:compiler_arm_fpu", 463 "//build/config/compiler:compiler_arm_fpu",
465 "//build/config/compiler:chromium_code", 464 "//build/config/compiler:chromium_code",
466 "//build/config/compiler:default_include_dirs", 465 "//build/config/compiler:default_include_dirs",
467 "//build/config/compiler:default_optimization", 466 "//build/config/compiler:default_optimization",
468 "//build/config/compiler:default_symbols", 467 "//build/config/compiler:default_symbols",
469 "//build/config/compiler:no_rtti", 468 "//build/config/compiler:no_rtti",
470 "//build/config/compiler:runtime_library", 469 "//build/config/compiler:runtime_library",
471 "//build/config/sanitizers:default_sanitizer_flags", 470 "//build/config/sanitizers:default_sanitizer_flags",
472 ] 471 ]
473 if (is_win) { 472 if (is_win) {
474 _native_compiler_configs += [ 473 default_compiler_configs += [
475 "//build/config/win:lean_and_mean", 474 "//build/config/win:lean_and_mean",
476 "//build/config/win:nominmax", 475 "//build/config/win:nominmax",
477 "//build/config/win:unicode", 476 "//build/config/win:unicode",
478 "//build/config/win:winver", 477 "//build/config/win:winver",
479 "//build/config/win:vs_code_analysis", 478 "//build/config/win:vs_code_analysis",
480 ] 479 ]
481 } 480 }
482 if (current_os == "winrt_81" || current_os == "winrt_81_phone" || 481 if (current_os == "winrt_81" || current_os == "winrt_81_phone" ||
483 current_os == "winrt_10") { 482 current_os == "winrt_10") {
484 _native_compiler_configs += [ "//build/config/win:target_winrt" ] 483 default_compiler_configs += [ "//build/config/win:target_winrt" ]
485 } 484 }
486 if (is_posix) { 485 if (is_posix) {
487 _native_compiler_configs += [ 486 default_compiler_configs += [
488 "//build/config/gcc:no_exceptions", 487 "//build/config/gcc:no_exceptions",
489 "//build/config/gcc:symbol_visibility_hidden", 488 "//build/config/gcc:symbol_visibility_hidden",
490 ] 489 ]
491 } 490 }
492 491
493 if (is_android) { 492 if (is_android) {
494 _native_compiler_configs += 493 default_compiler_configs +=
495 [ "//build/config/android:default_cygprofile_instrumentation" ] 494 [ "//build/config/android:default_cygprofile_instrumentation" ]
496 } 495 }
497 496
498 if (is_clang && !is_nacl) { 497 if (is_clang && !is_nacl) {
499 _native_compiler_configs += [ 498 default_compiler_configs += [
500 "//build/config/clang:find_bad_constructs", 499 "//build/config/clang:find_bad_constructs",
501 "//build/config/clang:extra_warnings", 500 "//build/config/clang:extra_warnings",
502 ] 501 ]
503 } 502 }
504 503
505 # Debug/release-related defines. 504 # Debug/release-related defines.
506 if (is_debug) { 505 if (is_debug) {
507 _native_compiler_configs += [ "//build/config:debug" ] 506 default_compiler_configs += [ "//build/config:debug" ]
508 } else { 507 } else {
509 _native_compiler_configs += [ "//build/config:release" ] 508 default_compiler_configs += [ "//build/config:release" ]
510 } 509 }
511 510
511 # Static libraries and source sets use only the compiler ones.
512 set_defaults("static_library") {
513 configs = default_compiler_configs
514 }
515 set_defaults("source_set") {
516 configs = default_compiler_configs
517 }
518
519 # Compute the set of configs common to all linked targets (shared libraries,
520 # loadable modules, executables) to avoid duplication below.
512 if (is_win) { 521 if (is_win) {
513 # Many targets remove these configs, so they are not contained within 522 # Many targets remove these configs, so they are not contained within
514 # //build/config:executable_config for easy removal. 523 # //build/config:executable_config for easy removal.
515 _windows_linker_configs = [ 524 _linker_configs = [
516 "//build/config/win:default_incremental_linking", 525 "//build/config/win:default_incremental_linking",
517 526
518 # Default to console-mode apps. Most of our targets are tests and such 527 # Default to console-mode apps. Most of our targets are tests and such
519 # that shouldn't use the windows subsystem. 528 # that shouldn't use the windows subsystem.
520 "//build/config/win:console", 529 "//build/config/win:console",
521 ] 530 ]
522 } else if (is_mac) { 531 } else if (is_mac) {
523 _mac_linker_configs = [ "//build/config/mac:strip_all" ] 532 _linker_configs = [ "//build/config/mac:strip_all" ]
533 } else {
534 _linker_configs = []
524 } 535 }
525 536
526 # Executable defaults. 537 # Executable defaults.
527 _executable_configs = _native_compiler_configs + [ 538 default_executable_configs = default_compiler_configs + [
528 "//build/config:default_libs", 539 "//build/config:default_libs",
529 "//build/config:executable_config", 540 "//build/config:executable_config",
530 ] 541 ] + _linker_configs
531 if (is_win) {
532 _executable_configs += _windows_linker_configs
533 } else if (is_mac) {
534 _executable_configs += _mac_linker_configs
535 }
536 set_defaults("executable") { 542 set_defaults("executable") {
537 configs = _executable_configs 543 configs = default_executable_configs
538 }
539
540 if (is_ios) {
541 set_defaults("ios_app_bundle") {
542 configs = _executable_configs
543 }
544 set_defaults("ios_appex_bundle") {
545 configs = _executable_configs
546 }
547 }
548
549 # Static library defaults.
550 set_defaults("static_library") {
551 configs = _native_compiler_configs
552 } 544 }
553 545
554 # Shared library and loadable module defaults (also for components in component 546 # Shared library and loadable module defaults (also for components in component
555 # mode). 547 # mode).
556 _shared_library_configs = _native_compiler_configs + [ 548 default_shared_library_configs = default_compiler_configs + [
557 "//build/config:default_libs", 549 "//build/config:default_libs",
558 "//build/config:shared_library_config", 550 "//build/config:shared_library_config",
559 ] 551 ] + _linker_configs
560 if (is_win) { 552 if (is_android) {
561 _shared_library_configs += _windows_linker_configs
562 } else if (is_android) {
563 # Strip native JNI exports from shared libraries by default. Binaries that 553 # Strip native JNI exports from shared libraries by default. Binaries that
564 # want this can remove this config. 554 # want this can remove this config.
565 _shared_library_configs += 555 default_shared_library_configs +=
566 [ "//build/config/android:hide_native_jni_exports" ] 556 [ "//build/config/android:hide_native_jni_exports" ]
567 } else if (is_mac) {
568 _shared_library_configs += _mac_linker_configs
569 } 557 }
570 set_defaults("shared_library") { 558 set_defaults("shared_library") {
571 configs = _shared_library_configs 559 configs = default_shared_library_configs
572 } 560 }
573 set_defaults("loadable_module") { 561 set_defaults("loadable_module") {
574 configs = _shared_library_configs 562 configs = default_shared_library_configs
575 }
576 if (is_component_build) {
577 set_defaults("component") {
578 configs = _shared_library_configs
579 if (is_android) {
580 configs -= [ "//build/config/android:hide_native_jni_exports" ]
581 }
582 }
583 }
584 if (is_ios) {
585 set_defaults("ios_framework_bundle") {
586 configs = _shared_library_configs
587 }
588 }
589 if (is_mac) {
590 set_defaults("mac_framework_bundle") {
591 configs = _shared_library_configs
592 }
593 }
594
595 # Source set defaults (also for components in non-component mode).
596 set_defaults("source_set") {
597 configs = _native_compiler_configs
598 }
599 if (!is_component_build) {
600 set_defaults("component") {
601 configs = _native_compiler_configs
602 }
603 }
604
605 # TODO(brettw) move to //build/split_static_library.gni when set_defaults can
606 # be practically implemented outside of this file.
607 set_defaults("split_static_library") {
608 configs = _native_compiler_configs
609 }
610
611 # Test defaults.
612 set_defaults("test") {
613 if (is_android) {
614 configs = _shared_library_configs
615 } else {
616 configs = _executable_configs
617 }
618 } 563 }
619 564
620 # ============================================================================== 565 # ==============================================================================
621 # COMPONENT SETUP 566 # COMPONENT SETUP
622 # ============================================================================== 567 # ==============================================================================
623 568
624 # Defines a component, which equates to a shared_library when 569 # Defines a component, which equates to a shared_library when
625 # is_component_build == true and a static_library otherwise. 570 # is_component_build == true and a static_library otherwise.
626 # 571 #
627 # Use static libraries for the static build rather than source sets because 572 # Use static libraries for the static build rather than source sets because
(...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after
673 forward_variables_from(invoker, "*", [ "visibility" ]) 618 forward_variables_from(invoker, "*", [ "visibility" ])
674 619
675 # All shared libraries must have the sanitizer deps to properly link in 620 # All shared libraries must have the sanitizer deps to properly link in
676 # asan mode (this target will be empty in other cases). 621 # asan mode (this target will be empty in other cases).
677 if (!defined(deps)) { 622 if (!defined(deps)) {
678 deps = [] 623 deps = []
679 } 624 }
680 deps += [ "//build/config/sanitizers:deps" ] 625 deps += [ "//build/config/sanitizers:deps" ]
681 } 626 }
682 } 627 }
628
629 # Component defaults
630 set_defaults("component") {
631 if (is_component_build) {
632 configs = default_shared_library_configs
633 if (is_android) {
634 configs -= [ "//build/config/android:hide_native_jni_exports" ]
635 }
636 } else {
637 configs = default_compiler_configs
638 }
639 }
OLDNEW
« no previous file with comments | « no previous file | build/config/ios/rules.gni » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698