| # Copyright 2019 The ChromiumOS Authors | |
| # Use of this source code is governed by a BSD-style license that can be | |
| # found in the LICENSE file. | |
| import("//common-mk/generate-dbus-proxies.gni") | |
| import("//common-mk/pkg_config.gni") | |
| import("//common-mk/proto_library.gni") | |
| group("all") { | |
| deps = [ | |
| ":libtpm_manager-client-headers", | |
| ":tpm_manager_client", | |
| ] | |
| } | |
| # tpm_manager client library generated headers. Used by other tools to | |
| # interact with tpm_manager. | |
| generate_dbus_proxies("libtpm_manager-client-headers") { | |
| dbus_service_config = "../common/dbus_bindings/dbus-service-config.json" | |
| proxy_output_file = "include/tpm_manager/dbus-proxies.h" | |
| mock_output_file = "include/tpm_manager/dbus-proxy-mocks.h" | |
| proxy_path_in_mocks = "tpm_manager/dbus-proxies.h" | |
| sources = [ "../common/dbus_bindings/org.chromium.TpmManager.xml" ] | |
| } | |
| # copy the dbus-proxies.h for the internal package usage. | |
| copy("libtpm_manager-client") { | |
| sources = [ "${root_gen_dir}/include/tpm_manager/dbus-proxies.h" ] | |
| outputs = [ | |
| "${root_gen_dir}/include/tpm_manager-client/tpm_manager/dbus-proxies.h", | |
| ] | |
| deps = [ ":libtpm_manager-client-headers" ] | |
| } | |
| # copy the dbus-proxy-mocks.h for the internal package usage. | |
| copy("libtpm_manager-client-test") { | |
| sources = [ "${root_gen_dir}/include/tpm_manager/dbus-proxy-mocks.h" ] | |
| outputs = [ "${root_gen_dir}/include/tpm_manager-client-test/tpm_manager/dbus-proxy-mocks.h" ] | |
| deps = [ ":libtpm_manager-client-headers" ] | |
| } | |
| pkg_config("target_default_deps") { | |
| # This is a list of pkg-config dependencies | |
| pkg_deps = [ | |
| "libbrillo", | |
| "libchrome", | |
| ] | |
| if (use.fuzzer) { | |
| pkg_deps += [ "protobuf" ] | |
| } else { | |
| pkg_deps += [ "protobuf-lite" ] | |
| } | |
| } | |
| config("target_defaults") { | |
| configs = [ ":target_default_deps" ] | |
| } | |
| config("local_print_proto_include") { | |
| # This config is used when any build target used the print_proto. | |
| include_dirs = [ "${target_gen_dir}/../.." ] | |
| } | |
| action("print_proto_library") { | |
| dbus_proto_path = "${sysroot}/usr/include/chromeos/dbus/tpm_manager" | |
| script = "../../libhwsec-foundation/utility/proto_print.py" | |
| inputs = [ "${dbus_proto_path}/tpm_manager.proto" ] | |
| outputs = [ "${target_gen_dir}/../common/print_tpm_manager_proto.cc" ] | |
| args = [ | |
| "--subdir", | |
| "common", | |
| "--proto-include", | |
| "tpm_manager/proto_bindings", | |
| "--output-dir", | |
| "${target_gen_dir}/../common", | |
| ] + inputs | |
| } | |
| static_library("proto_library") { | |
| sources = get_target_outputs(":print_proto_library") | |
| configs -= [ | |
| "//common-mk:use_thin_archive", | |
| "//common-mk:pie", | |
| ] | |
| configs += [ | |
| ":local_print_proto_include", | |
| ":target_defaults", | |
| "//common-mk:nouse_thin_archive", | |
| "//common-mk:pic", | |
| ] | |
| public_deps = [ ":print_proto_library" ] | |
| } | |
| # A client command line utility. | |
| executable("tpm_manager_client") { | |
| sources = [ "main.cc" ] | |
| configs += [ | |
| ":local_print_proto_include", | |
| ":target_defaults", | |
| ] | |
| deps = [ | |
| ":libtpm_manager-client", | |
| ":proto_library", | |
| ] | |
| # NOSORT | |
| pkg_deps = [ | |
| # system_api depends on protobuf (or protobuf-lite). It must appear | |
| # before protobuf here or the linker flags won't be in the right | |
| # order. | |
| "system_api", | |
| "protobuf", | |
| ] | |
| } |