Chromium Code Reviews| 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 383 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 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") { | 404 set_defaults("test") { |
|
brettw
2014/09/08 20:04:22
I think you will need to update the default config
cjhopman
2014/09/09 16:55:32
Done.
| |
| 405 configs = _executable_configs | 405 configs = _executable_configs |
| 406 } | 406 } |
| 407 | 407 |
| 408 # Static library defaults. | 408 # Static library defaults. |
| 409 set_defaults("static_library") { | 409 set_defaults("static_library") { |
| 410 configs = _native_compiler_configs | 410 configs = _native_compiler_configs |
| 411 } | 411 } |
| 412 | 412 |
| 413 # Shared library defaults (also for components in component mode). | 413 # Shared library defaults (also for components in component mode). |
| 414 _shared_library_configs = _native_compiler_configs + [ | 414 _shared_library_configs = _native_compiler_configs + [ |
| (...skipping 75 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 490 # ============================================================================== | 490 # ============================================================================== |
| 491 | 491 |
| 492 # TODO(brettw) erase this once the built-in "component" function is removed. | 492 # TODO(brettw) erase this once the built-in "component" function is removed. |
| 493 if (is_component_build) { | 493 if (is_component_build) { |
| 494 component_mode = "shared_library" | 494 component_mode = "shared_library" |
| 495 } else { | 495 } else { |
| 496 component_mode = "source_set" | 496 component_mode = "source_set" |
| 497 } | 497 } |
| 498 | 498 |
| 499 template("component") { | 499 template("component") { |
| 500 # The sources assignment filter will have already been applied when the | |
|
cjhopman
2014/09/08 18:09:44
I would prefer that we didn't allow variables set
brettw
2014/09/08 20:04:22
I'd rather keep this the old way, maybe we can res
cjhopman
2014/09/09 16:55:32
Done.
| |
| 501 # code was originally executed. We don't want to apply it again, since | |
| 502 # the original target may have override it for some assignments. | |
| 503 set_sources_assignment_filter([]) | |
| 504 | |
| 505 if (defined(invoker.all_dependent_configs)) { all_dependent_configs = invoker. all_dependent_configs } | |
| 506 if (defined(invoker.cflags)) { cflags = invoker.cflags } | |
| 507 if (defined(invoker.cflags_c)) { cflags_c = invoker.cflags_c } | |
| 508 if (defined(invoker.cflags_cc)) { cflags_cc = invoker.cflags_cc } | |
| 509 if (defined(invoker.cflags_objc)) { cflags_objc = invoker.cflags_objc } | |
| 510 if (defined(invoker.cflags_objcc)) { cflags_objcc = invoker.cflags_objcc } | |
| 511 if (defined(invoker.data)) { data = invoker.data } | |
| 512 if (defined(invoker.datadeps)) { datadeps = invoker.datadeps } | |
| 513 if (defined(invoker.defines)) { defines = invoker.defines } | |
| 514 if (defined(invoker.deps)) { deps = invoker.deps } | |
| 515 if (defined(invoker.direct_dependent_configs)) { direct_dependent_configs = in voker.direct_dependent_configs } | |
| 516 if (defined(invoker.forward_dependent_configs_from)) { forward_dependent_confi gs_from = invoker.forward_dependent_configs_from } | |
| 517 if (defined(invoker.include_dirs)) { include_dirs = invoker.include_dirs } | |
| 518 if (defined(invoker.ldflags)) { ldflags = invoker.ldflags } | |
| 519 if (defined(invoker.lib_dirs)) { lib_dirs = invoker.lib_dirs } | |
| 520 if (defined(invoker.libs)) { libs = invoker.libs } | |
| 521 if (defined(invoker.output_extension)) { output_extension = invoker.output_ext ension } | |
| 522 if (defined(invoker.output_name)) { output_name = invoker.output_name } | |
| 523 if (defined(invoker.public)) { public = invoker.public } | |
| 524 if (defined(invoker.sources)) { sources = invoker.sources } | |
| 525 if (defined(invoker.visibility)) { visibility = invoker.visibility } | |
| 500 if (is_component_build) { | 526 if (is_component_build) { |
| 501 shared_library(target_name) { | 527 shared_library(target_name) { |
| 502 # Configs will always be defined since we set_defaults for a component | 528 # Configs will always be defined since we set_defaults for a component |
| 503 # above. We want to use those rather than whatever came with the nested | 529 # above. We want to use those rather than whatever came with the nested |
| 504 # shared/static library inside the component. | 530 # shared/static library inside the component. |
| 505 configs = [] # Prevent list overwriting warning. | 531 configs = [] # Prevent list overwriting warning. |
| 506 configs = invoker.configs | 532 configs = invoker.configs |
| 507 | |
| 508 # The sources assignment filter will have already been applied when the | |
| 509 # code was originally executed. We don't want to apply it again, since | |
| 510 # the original target may have override it for some assignments. | |
| 511 set_sources_assignment_filter([]) | |
| 512 | |
| 513 if (defined(invoker.all_dependent_configs)) { all_dependent_configs = invo ker.all_dependent_configs } | |
| 514 if (defined(invoker.cflags)) { cflags = invoker.cflags } | |
| 515 if (defined(invoker.cflags_c)) { cflags_c = invoker.cflags_c } | |
| 516 if (defined(invoker.cflags_cc)) { cflags_cc = invoker.cflags_cc } | |
| 517 if (defined(invoker.cflags_objc)) { cflags_objc = invoker.cflags_objc } | |
| 518 if (defined(invoker.cflags_objcc)) { cflags_objcc = invoker.cflags_objcc } | |
| 519 if (defined(invoker.data)) { data = invoker.data } | |
| 520 if (defined(invoker.datadeps)) { datadeps = invoker.datadeps } | |
| 521 if (defined(invoker.defines)) { defines = invoker.defines } | |
| 522 if (defined(invoker.deps)) { deps = invoker.deps } | |
| 523 if (defined(invoker.direct_dependent_configs)) { direct_dependent_configs = invoker.direct_dependent_configs } | |
| 524 if (defined(invoker.forward_dependent_configs_from)) { forward_dependent_c onfigs_from = invoker.forward_dependent_configs_from } | |
| 525 if (defined(invoker.include_dirs)) { include_dirs = invoker.include_dirs } | |
| 526 if (defined(invoker.ldflags)) { ldflags = invoker.ldflags } | |
| 527 if (defined(invoker.lib_dirs)) { lib_dirs = invoker.lib_dirs } | |
| 528 if (defined(invoker.libs)) { libs = invoker.libs } | |
| 529 if (defined(invoker.output_extension)) { output_extension = invoker.output _extension } | |
| 530 if (defined(invoker.output_name)) { output_name = invoker.output_name } | |
| 531 if (defined(invoker.public)) { public = invoker.public } | |
| 532 if (defined(invoker.sources)) { sources = invoker.sources } | |
| 533 if (defined(invoker.visibility)) { visibility = invoker.visibility } | |
| 534 } | 533 } |
| 535 } else { | 534 } else { |
| 536 source_set(target_name) { | 535 source_set(target_name) { |
| 537 # See above. | 536 # See above. |
| 538 configs = [] # Prevent list overwriting warning. | 537 configs = [] # Prevent list overwriting warning. |
| 539 configs = invoker.configs | 538 configs = invoker.configs |
| 540 | |
| 541 # See above call. | |
| 542 set_sources_assignment_filter([]) | |
| 543 | |
| 544 if (defined(invoker.all_dependent_configs)) { all_dependent_configs = invo ker.all_dependent_configs } | |
| 545 if (defined(invoker.cflags)) { cflags = invoker.cflags } | |
| 546 if (defined(invoker.cflags_c)) { cflags_c = invoker.cflags_c } | |
| 547 if (defined(invoker.cflags_cc)) { cflags_cc = invoker.cflags_cc } | |
| 548 if (defined(invoker.cflags_objc)) { cflags_objc = invoker.cflags_objc } | |
| 549 if (defined(invoker.cflags_objcc)) { cflags_objcc = invoker.cflags_objcc } | |
| 550 if (defined(invoker.data)) { data = invoker.data } | |
| 551 if (defined(invoker.datadeps)) { datadeps = invoker.datadeps } | |
| 552 if (defined(invoker.defines)) { defines = invoker.defines } | |
| 553 if (defined(invoker.deps)) { deps = invoker.deps } | |
| 554 if (defined(invoker.direct_dependent_configs)) { direct_dependent_configs = invoker.direct_dependent_configs } | |
| 555 if (defined(invoker.forward_dependent_configs_from)) { forward_dependent_c onfigs_from = invoker.forward_dependent_configs_from } | |
| 556 if (defined(invoker.include_dirs)) { include_dirs = invoker.include_dirs } | |
| 557 if (defined(invoker.ldflags)) { ldflags = invoker.ldflags } | |
| 558 if (defined(invoker.lib_dirs)) { lib_dirs = invoker.lib_dirs } | |
| 559 if (defined(invoker.libs)) { libs = invoker.libs } | |
| 560 if (defined(invoker.output_extension)) { output_extension = invoker.output _extension } | |
| 561 if (defined(invoker.output_name)) { output_name = invoker.output_name } | |
| 562 if (defined(invoker.public)) { public = invoker.public } | |
| 563 if (defined(invoker.sources)) { sources = invoker.sources } | |
| 564 if (defined(invoker.visibility)) { visibility = invoker.visibility } | |
| 565 } | 539 } |
| 566 } | 540 } |
| 567 } | 541 } |
| 568 | 542 |
| 569 # ============================================================================== | 543 # ============================================================================== |
| 570 # TEST SETUP | 544 # TEST SETUP |
| 571 # ============================================================================== | 545 # ============================================================================== |
| 572 | 546 |
| 573 # Define a test as an executable with the "testonly" flag set. In the future, | 547 # Define a test as an executable with the "testonly" flag set. In the future, |
| 574 # this will need to be enhanced for Android. | 548 # this will need to be enhanced for Android. |
| 575 template("test") { | 549 template("test") { |
| 576 executable(target_name) { | 550 # See above call. |
| 577 # Configs will always be defined since we set_defaults for a component | 551 set_sources_assignment_filter([]) |
| 578 # above. We want to use those rather than whatever came with the nested | |
| 579 # shared/static library inside the component. | |
| 580 configs = [] # Prevent list overwriting warning. | |
| 581 configs = invoker.configs | |
| 582 | 552 |
| 583 testonly = true | 553 if (defined(invoker.all_dependent_configs)) { all_dependent_configs = invoker. all_dependent_configs } |
| 554 if (defined(invoker.cflags)) { cflags = invoker.cflags } | |
| 555 if (defined(invoker.cflags_c)) { cflags_c = invoker.cflags_c } | |
| 556 if (defined(invoker.cflags_cc)) { cflags_cc = invoker.cflags_cc } | |
| 557 if (defined(invoker.cflags_objc)) { cflags_objc = invoker.cflags_objc } | |
| 558 if (defined(invoker.cflags_objcc)) { cflags_objcc = invoker.cflags_objcc } | |
| 559 if (defined(invoker.data)) { data = invoker.data } | |
| 560 if (defined(invoker.datadeps)) { datadeps = invoker.datadeps } | |
| 561 if (defined(invoker.defines)) { defines = invoker.defines } | |
| 562 if (defined(invoker.deps)) { deps = invoker.deps } | |
| 563 if (defined(invoker.direct_dependent_configs)) { direct_dependent_configs = in voker.direct_dependent_configs } | |
| 564 if (defined(invoker.forward_dependent_configs_from)) { forward_dependent_confi gs_from = invoker.forward_dependent_configs_from } | |
| 565 if (defined(invoker.include_dirs)) { include_dirs = invoker.include_dirs } | |
| 566 if (defined(invoker.ldflags)) { ldflags = invoker.ldflags } | |
| 567 if (defined(invoker.lib_dirs)) { lib_dirs = invoker.lib_dirs } | |
| 568 if (defined(invoker.libs)) { libs = invoker.libs } | |
| 569 if (defined(invoker.output_extension)) { output_extension = invoker.output_ext ension } | |
| 570 if (defined(invoker.output_name)) { output_name = invoker.output_name } | |
| 571 if (defined(invoker.public)) { public = invoker.public } | |
| 572 if (defined(invoker.sources)) { sources = invoker.sources } | |
| 573 if (defined(invoker.visibility)) { visibility = invoker.visibility } | |
| 584 | 574 |
| 585 # See above call. | 575 testonly = true |
| 586 set_sources_assignment_filter([]) | |
| 587 | 576 |
| 588 if (defined(invoker.all_dependent_configs)) { all_dependent_configs = invoke r.all_dependent_configs } | 577 if (is_android) { |
| 589 if (defined(invoker.cflags)) { cflags = invoker.cflags } | 578 shared_library(target_name) { |
| 590 if (defined(invoker.cflags_c)) { cflags_c = invoker.cflags_c } | 579 # Configs will always be defined since we set_defaults for a component |
| 591 if (defined(invoker.cflags_cc)) { cflags_cc = invoker.cflags_cc } | 580 # above. We want to use those rather than whatever came with the nested |
| 592 if (defined(invoker.cflags_objc)) { cflags_objc = invoker.cflags_objc } | 581 # shared/static library inside the component. |
| 593 if (defined(invoker.cflags_objcc)) { cflags_objcc = invoker.cflags_objcc } | 582 configs = [] # Prevent list overwriting warning. |
| 594 if (defined(invoker.data)) { data = invoker.data } | 583 configs = invoker.configs |
| 595 if (defined(invoker.datadeps)) { datadeps = invoker.datadeps } | 584 } |
| 596 if (defined(invoker.defines)) { defines = invoker.defines } | 585 } else { |
| 597 if (defined(invoker.deps)) { deps = invoker.deps } | 586 executable(target_name) { |
| 598 if (defined(invoker.direct_dependent_configs)) { direct_dependent_configs = invoker.direct_dependent_configs } | 587 # Configs will always be defined since we set_defaults for a component |
| 599 if (defined(invoker.forward_dependent_configs_from)) { forward_dependent_con figs_from = invoker.forward_dependent_configs_from } | 588 # above. We want to use those rather than whatever came with the nested |
| 600 if (defined(invoker.include_dirs)) { include_dirs = invoker.include_dirs } | 589 # shared/static library inside the component. |
| 601 if (defined(invoker.ldflags)) { ldflags = invoker.ldflags } | 590 configs = [] # Prevent list overwriting warning. |
| 602 if (defined(invoker.lib_dirs)) { lib_dirs = invoker.lib_dirs } | 591 configs = invoker.configs |
| 603 if (defined(invoker.libs)) { libs = invoker.libs } | 592 } |
| 604 if (defined(invoker.output_extension)) { output_extension = invoker.output_e xtension } | |
| 605 if (defined(invoker.output_name)) { output_name = invoker.output_name } | |
| 606 if (defined(invoker.public)) { public = invoker.public } | |
| 607 if (defined(invoker.sources)) { sources = invoker.sources } | |
| 608 if (defined(invoker.visibility)) { visibility = invoker.visibility } | |
| 609 } | 593 } |
| 610 } | 594 } |
| OLD | NEW |