OLD | NEW |
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 531 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
542 } | 542 } |
543 set_defaults("shared_library") { | 543 set_defaults("shared_library") { |
544 configs = _shared_library_configs | 544 configs = _shared_library_configs |
545 } | 545 } |
546 set_defaults("loadable_module") { | 546 set_defaults("loadable_module") { |
547 configs = _shared_library_configs | 547 configs = _shared_library_configs |
548 } | 548 } |
549 if (is_component_build) { | 549 if (is_component_build) { |
550 set_defaults("component") { | 550 set_defaults("component") { |
551 configs = _shared_library_configs | 551 configs = _shared_library_configs |
| 552 if (is_android) { |
| 553 configs -= [ "//build/config/android:hide_native_jni_exports" ] |
| 554 } |
552 } | 555 } |
553 } | 556 } |
554 | 557 |
555 # Source set defaults (also for components in non-component mode). | 558 # Source set defaults (also for components in non-component mode). |
556 set_defaults("source_set") { | 559 set_defaults("source_set") { |
557 configs = _native_compiler_configs | 560 configs = _native_compiler_configs |
558 } | 561 } |
559 if (!is_component_build) { | 562 if (!is_component_build) { |
560 set_defaults("component") { | 563 set_defaults("component") { |
561 configs = _native_compiler_configs | 564 configs = _native_compiler_configs |
562 } | 565 } |
563 } | 566 } |
564 | 567 |
565 # Test defaults. | 568 # Test defaults. |
566 set_defaults("test") { | 569 set_defaults("test") { |
567 if (is_android) { | 570 if (is_android) { |
568 configs = _shared_library_configs | 571 configs = _shared_library_configs |
569 } else { | 572 } else { |
570 configs = _executable_configs | 573 configs = _executable_configs |
571 } | 574 } |
572 } | 575 } |
573 | 576 |
574 # ============================================================================== | 577 # ============================================================================== |
575 # COMPONENT SETUP | 578 # COMPONENT SETUP |
576 # ============================================================================== | 579 # ============================================================================== |
577 | 580 |
578 if (is_component_build) { | 581 # Defines a component, which equates to a shared_library when |
579 _component_mode = "shared_library" | 582 # is_component_build == true and a source_set / static_library otherwise. |
580 } else { | 583 # |
581 _component_mode = "source_set" | 584 # Arguments are the same as a normal library with this addition: |
582 } | 585 # component_never_use_source_set: Whether to use static_library instead of |
| 586 # source_set for non-component builds. Some targets (e.g. //base) should |
| 587 # use static_library rather than source_set to avoid linking unused object |
| 588 # files. |
583 template("component") { | 589 template("component") { |
| 590 _never_use_source_set = defined(invoker.component_never_use_source_set) && |
| 591 invoker.component_never_use_source_set |
| 592 assert(_never_use_source_set || true) # Mark as used. |
| 593 if (is_component_build) { |
| 594 _component_mode = "shared_library" |
| 595 } else if (_never_use_source_set) { |
| 596 _component_mode = "static_library" |
| 597 } else { |
| 598 _component_mode = "source_set" |
| 599 } |
584 target(_component_mode, target_name) { | 600 target(_component_mode, target_name) { |
585 forward_variables_from(invoker, "*") | 601 forward_variables_from(invoker, "*") |
586 | 602 |
587 # All shared libraries must have the sanitizer deps to properly link in | 603 # All shared libraries must have the sanitizer deps to properly link in |
588 # asan mode (this target will be empty in other cases). | 604 # asan mode (this target will be empty in other cases). |
589 if (!defined(deps)) { | 605 if (!defined(deps)) { |
590 deps = [] | 606 deps = [] |
591 } | 607 } |
592 deps += [ "//build/config/sanitizers:deps" ] | 608 deps += [ "//build/config/sanitizers:deps" ] |
593 } | 609 } |
594 } | 610 } |
OLD | NEW |