| # Copyright 2022 The Fuchsia Authors. All rights reserved. |
| # Use of this source code is governed by a BSD-style license that can be |
| # found in the LICENSE file. |
| |
| import("//build/components.gni") |
| |
| # [START args_declare] |
| declare_args() { |
| # Set this in args.gn to override the greeting emitted by this example. |
| config_example_cpp_greeting = "World" |
| } |
| |
| # [END args_declare] |
| |
| # [START binary] |
| executable("bin") { |
| # [START_EXCLUDE] |
| output_name = "config_example_cpp" |
| sources = [ "main.cc" ] |
| |
| # [END_EXCLUDE] |
| deps = [ |
| ":example_config", |
| |
| # [START_EXCLUDE] |
| "//sdk/lib/sys/cpp", |
| "//sdk/lib/sys/inspect/cpp", |
| "//sdk/lib/syslog/cpp", |
| "//zircon/system/ulib/async-loop:async-loop-cpp", |
| "//zircon/system/ulib/async-loop:async-loop-default", |
| |
| # [END_EXCLUDE] |
| ] |
| } |
| |
| # [END binary] |
| |
| # [START component] |
| fuchsia_component_manifest("manifest") { |
| component_name = "config_example" |
| manifest = "meta/config_example.cml" |
| } |
| |
| fuchsia_component("component") { |
| cm_label = ":manifest" |
| deps = [ ":bin" ] |
| } |
| |
| # [END component] |
| |
| # [START library] |
| fuchsia_structured_config_cpp_elf_lib("example_config") { |
| cm_label = ":manifest" |
| } |
| |
| # [END library] |
| |
| # [START config_values_gn] |
| fuchsia_structured_config_values("values_from_gn") { |
| cm_label = ":manifest" |
| values = { |
| greeting = config_example_cpp_greeting |
| } |
| } |
| |
| # [END config_values_gn] |
| |
| # [START config_values_json] |
| fuchsia_structured_config_values("values_from_json_file") { |
| cm_label = ":manifest" |
| values_source = "../config_example_default_values.json5" |
| } |
| |
| # [END config_values_json] |
| |
| # [START package] |
| fuchsia_package("cpp_config_example") { |
| deps = [ |
| ":component", |
| ":values_from_gn", |
| ] |
| } |
| |
| # [END package] |
| |
| fuchsia_package("cpp_config_example_with_json_values") { |
| deps = [ |
| ":component", |
| ":values_from_json_file", |
| ] |
| } |
| |
| group("cpp") { |
| deps = [ |
| ":cpp_config_example", |
| ":cpp_config_example_with_json_values", |
| ] |
| } |