| 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 # 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 367 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 378 _windows_linker_configs = [ | 378 _windows_linker_configs = [ |
| 379 _default_incremental_linking_config, | 379 _default_incremental_linking_config, |
| 380 "//build/config/win:sdk_link", | 380 "//build/config/win:sdk_link", |
| 381 "//build/config/win:common_linker_setup", | 381 "//build/config/win:common_linker_setup", |
| 382 # Default to console-mode apps. Most of our targets are tests and such | 382 # Default to console-mode apps. Most of our targets are tests and such |
| 383 # that shouldn't use the windows subsystem. | 383 # that shouldn't use the windows subsystem. |
| 384 "//build/config/win:console", | 384 "//build/config/win:console", |
| 385 ] | 385 ] |
| 386 } | 386 } |
| 387 | 387 |
| 388 # Executable defaults (applies to executables and tests). | 388 # Executable defaults. |
| 389 _executable_configs = _native_compiler_configs + [ | 389 _executable_configs = _native_compiler_configs + [ |
| 390 "//build/config:default_libs", | 390 "//build/config:default_libs", |
| 391 ] | 391 ] |
| 392 if (is_win) { | 392 if (is_win) { |
| 393 _executable_configs += _windows_linker_configs | 393 _executable_configs += _windows_linker_configs |
| 394 } else if (is_mac) { | 394 } else if (is_mac) { |
| 395 _executable_configs += [ | 395 _executable_configs += [ |
| 396 "//build/config/mac:mac_dynamic_flags", | 396 "//build/config/mac:mac_dynamic_flags", |
| 397 "//build/config/mac:mac_executable_flags" ] | 397 "//build/config/mac:mac_executable_flags" ] |
| 398 } else if (is_linux || is_android) { | 398 } else if (is_linux || is_android) { |
| 399 _executable_configs += [ "//build/config/gcc:executable_ldconfig" ] | 399 _executable_configs += [ "//build/config/gcc:executable_ldconfig" ] |
| 400 } | 400 } |
| 401 set_defaults("executable") { | 401 set_defaults("executable") { |
| 402 configs = _executable_configs | 402 configs = _executable_configs |
| 403 } | 403 } |
| 404 set_defaults("test") { | |
| 405 configs = _executable_configs | |
| 406 } | |
| 407 | 404 |
| 408 # Static library defaults. | 405 # Static library defaults. |
| 409 set_defaults("static_library") { | 406 set_defaults("static_library") { |
| 410 configs = _native_compiler_configs | 407 configs = _native_compiler_configs |
| 411 } | 408 } |
| 412 | 409 |
| 413 # Shared library defaults (also for components in component mode). | 410 # Shared library defaults (also for components in component mode). |
| 414 _shared_library_configs = _native_compiler_configs + [ | 411 _shared_library_configs = _native_compiler_configs + [ |
| 415 "//build/config:default_libs", | 412 "//build/config:default_libs", |
| 416 ] | 413 ] |
| (...skipping 14 matching lines...) Expand all Loading... |
| 431 # Source set defaults (also for components in non-component mode). | 428 # Source set defaults (also for components in non-component mode). |
| 432 set_defaults("source_set") { | 429 set_defaults("source_set") { |
| 433 configs = _native_compiler_configs | 430 configs = _native_compiler_configs |
| 434 } | 431 } |
| 435 if (!is_component_build) { | 432 if (!is_component_build) { |
| 436 set_defaults("component") { | 433 set_defaults("component") { |
| 437 configs = _native_compiler_configs | 434 configs = _native_compiler_configs |
| 438 } | 435 } |
| 439 } | 436 } |
| 440 | 437 |
| 438 # Test defaults. |
| 439 set_defaults("test") { |
| 440 if (is_android) { |
| 441 configs = _shared_library_configs |
| 442 } else { |
| 443 configs = _executable_configs |
| 444 } |
| 445 } |
| 446 |
| 447 |
| 441 # ============================================================================== | 448 # ============================================================================== |
| 442 # TOOLCHAIN SETUP | 449 # TOOLCHAIN SETUP |
| 443 # ============================================================================== | 450 # ============================================================================== |
| 444 # | 451 # |
| 445 # Here we set the default toolchain, as well as the variable host_toolchain | 452 # Here we set the default toolchain, as well as the variable host_toolchain |
| 446 # which will identify the toolchain corresponding to the local system when | 453 # which will identify the toolchain corresponding to the local system when |
| 447 # doing cross-compiles. When not cross-compiling, this will be the same as the | 454 # doing cross-compiles. When not cross-compiling, this will be the same as the |
| 448 # default toolchain. | 455 # default toolchain. |
| 449 | 456 |
| 450 if (is_win) { | 457 if (is_win) { |
| (...skipping 118 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 569 if (defined(invoker.testonly)) { testonly = invoker.testonly } | 576 if (defined(invoker.testonly)) { testonly = invoker.testonly } |
| 570 if (defined(invoker.visibility)) { visibility = invoker.visibility } | 577 if (defined(invoker.visibility)) { visibility = invoker.visibility } |
| 571 } | 578 } |
| 572 } | 579 } |
| 573 } | 580 } |
| 574 | 581 |
| 575 # ============================================================================== | 582 # ============================================================================== |
| 576 # TEST SETUP | 583 # TEST SETUP |
| 577 # ============================================================================== | 584 # ============================================================================== |
| 578 | 585 |
| 579 # Define a test as an executable with the "testonly" flag set. In the future, | 586 # Define a test as an executable (or shared_library on Android) with the |
| 580 # this will need to be enhanced for Android. | 587 # "testonly" flag set. |
| 581 template("test") { | 588 template("test") { |
| 582 executable(target_name) { | 589 if (is_android) { |
| 583 # Configs will always be defined since we set_defaults for a component | 590 shared_library(target_name) { |
| 584 # above. We want to use those rather than whatever came with the nested | 591 # Configs will always be defined since we set_defaults for a component |
| 585 # shared/static library inside the component. | 592 # above. We want to use those rather than whatever came with the nested |
| 586 configs = [] # Prevent list overwriting warning. | 593 # shared/static library inside the component. |
| 587 configs = invoker.configs | 594 configs = [] # Prevent list overwriting warning. |
| 595 configs = invoker.configs |
| 588 | 596 |
| 589 testonly = true | 597 # See above call. |
| 598 set_sources_assignment_filter([]) |
| 590 | 599 |
| 591 # See above call. | 600 testonly = true |
| 592 set_sources_assignment_filter([]) | |
| 593 | 601 |
| 594 if (defined(invoker.all_dependent_configs)) { all_dependent_configs = invoke
r.all_dependent_configs } | 602 if (defined(invoker.all_dependent_configs)) { all_dependent_configs = invo
ker.all_dependent_configs } |
| 595 if (defined(invoker.allow_circular_includes_from)) { allow_circular_includes
_from = invoker.allow_circular_includes_from } | 603 if (defined(invoker.allow_circular_includes_from)) { allow_circular_includ
es_from = invoker.allow_circular_includes_from } |
| 596 if (defined(invoker.cflags)) { cflags = invoker.cflags } | 604 if (defined(invoker.cflags)) { cflags = invoker.cflags } |
| 597 if (defined(invoker.cflags_c)) { cflags_c = invoker.cflags_c } | 605 if (defined(invoker.cflags_c)) { cflags_c = invoker.cflags_c } |
| 598 if (defined(invoker.cflags_cc)) { cflags_cc = invoker.cflags_cc } | 606 if (defined(invoker.cflags_cc)) { cflags_cc = invoker.cflags_cc } |
| 599 if (defined(invoker.cflags_objc)) { cflags_objc = invoker.cflags_objc } | 607 if (defined(invoker.cflags_objc)) { cflags_objc = invoker.cflags_objc } |
| 600 if (defined(invoker.cflags_objcc)) { cflags_objcc = invoker.cflags_objcc } | 608 if (defined(invoker.cflags_objcc)) { cflags_objcc = invoker.cflags_objcc } |
| 601 if (defined(invoker.check_includes)) { check_includes = invoker.check_includ
es } | 609 if (defined(invoker.check_includes)) { check_includes = invoker.check_incl
udes } |
| 602 if (defined(invoker.data)) { data = invoker.data } | 610 if (defined(invoker.data)) { data = invoker.data } |
| 603 if (defined(invoker.datadeps)) { datadeps = invoker.datadeps } | 611 if (defined(invoker.datadeps)) { datadeps = invoker.datadeps } |
| 604 if (defined(invoker.defines)) { defines = invoker.defines } | 612 if (defined(invoker.defines)) { defines = invoker.defines } |
| 605 if (defined(invoker.deps)) { deps = invoker.deps } | 613 if (defined(invoker.deps)) { deps = invoker.deps } |
| 606 if (defined(invoker.direct_dependent_configs)) { direct_dependent_configs =
invoker.direct_dependent_configs } | 614 if (defined(invoker.direct_dependent_configs)) { direct_dependent_configs
= invoker.direct_dependent_configs } |
| 607 if (defined(invoker.forward_dependent_configs_from)) { forward_dependent_con
figs_from = invoker.forward_dependent_configs_from } | 615 if (defined(invoker.forward_dependent_configs_from)) { forward_dependent_c
onfigs_from = invoker.forward_dependent_configs_from } |
| 608 if (defined(invoker.include_dirs)) { include_dirs = invoker.include_dirs } | 616 if (defined(invoker.include_dirs)) { include_dirs = invoker.include_dirs } |
| 609 if (defined(invoker.ldflags)) { ldflags = invoker.ldflags } | 617 if (defined(invoker.ldflags)) { ldflags = invoker.ldflags } |
| 610 if (defined(invoker.lib_dirs)) { lib_dirs = invoker.lib_dirs } | 618 if (defined(invoker.lib_dirs)) { lib_dirs = invoker.lib_dirs } |
| 611 if (defined(invoker.libs)) { libs = invoker.libs } | 619 if (defined(invoker.libs)) { libs = invoker.libs } |
| 612 if (defined(invoker.output_extension)) { output_extension = invoker.output_e
xtension } | 620 if (defined(invoker.output_extension)) { output_extension = invoker.output
_extension } |
| 613 if (defined(invoker.output_name)) { output_name = invoker.output_name } | 621 if (defined(invoker.output_name)) { output_name = invoker.output_name } |
| 614 if (defined(invoker.public)) { public = invoker.public } | 622 if (defined(invoker.public)) { public = invoker.public } |
| 615 if (defined(invoker.sources)) { sources = invoker.sources } | 623 if (defined(invoker.sources)) { sources = invoker.sources } |
| 616 if (defined(invoker.visibility)) { visibility = invoker.visibility } | 624 if (defined(invoker.visibility)) { visibility = invoker.visibility } |
| 625 } |
| 626 } else { |
| 627 executable(target_name) { |
| 628 # See above. |
| 629 configs = [] # Prevent list overwriting warning. |
| 630 configs = invoker.configs |
| 631 |
| 632 # See above call. |
| 633 set_sources_assignment_filter([]) |
| 634 |
| 635 testonly = true |
| 636 |
| 637 if (defined(invoker.all_dependent_configs)) { all_dependent_configs = invo
ker.all_dependent_configs } |
| 638 if (defined(invoker.allow_circular_includes_from)) { allow_circular_includ
es_from = invoker.allow_circular_includes_from } |
| 639 if (defined(invoker.cflags)) { cflags = invoker.cflags } |
| 640 if (defined(invoker.cflags_c)) { cflags_c = invoker.cflags_c } |
| 641 if (defined(invoker.cflags_cc)) { cflags_cc = invoker.cflags_cc } |
| 642 if (defined(invoker.cflags_objc)) { cflags_objc = invoker.cflags_objc } |
| 643 if (defined(invoker.cflags_objcc)) { cflags_objcc = invoker.cflags_objcc } |
| 644 if (defined(invoker.check_includes)) { check_includes = invoker.check_incl
udes } |
| 645 if (defined(invoker.data)) { data = invoker.data } |
| 646 if (defined(invoker.datadeps)) { datadeps = invoker.datadeps } |
| 647 if (defined(invoker.defines)) { defines = invoker.defines } |
| 648 if (defined(invoker.deps)) { deps = invoker.deps } |
| 649 if (defined(invoker.direct_dependent_configs)) { direct_dependent_configs
= invoker.direct_dependent_configs } |
| 650 if (defined(invoker.forward_dependent_configs_from)) { forward_dependent_c
onfigs_from = invoker.forward_dependent_configs_from } |
| 651 if (defined(invoker.include_dirs)) { include_dirs = invoker.include_dirs } |
| 652 if (defined(invoker.ldflags)) { ldflags = invoker.ldflags } |
| 653 if (defined(invoker.lib_dirs)) { lib_dirs = invoker.lib_dirs } |
| 654 if (defined(invoker.libs)) { libs = invoker.libs } |
| 655 if (defined(invoker.output_extension)) { output_extension = invoker.output
_extension } |
| 656 if (defined(invoker.output_name)) { output_name = invoker.output_name } |
| 657 if (defined(invoker.public)) { public = invoker.public } |
| 658 if (defined(invoker.sources)) { sources = invoker.sources } |
| 659 if (defined(invoker.visibility)) { visibility = invoker.visibility } |
| 660 } |
| 617 } | 661 } |
| 618 } | 662 } |
| OLD | NEW |