| # Copyright 2019 The Chromium OS 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("//common-mk/pkg_config.gni") |
| |
| group("all") { |
| deps = [ |
| ":install_error_h", |
| ":install_headers", |
| ":install_headers_overalls", |
| ":libhwsec", |
| ] |
| deps += [ ":libhwsec_test" ] |
| if (use.test) { |
| deps += [ ":hwsec_testrunner" ] |
| } |
| } |
| |
| pkg_config("target_defaults") { |
| pkg_deps = [ |
| "absl", |
| "libbrillo", |
| "libchrome", |
| "libtpm_manager-client", |
| "openssl", |
| "system_api", |
| ] |
| if (use.fuzzer) { |
| pkg_deps += [ "protobuf" ] |
| } else { |
| pkg_deps += [ "protobuf-lite" ] |
| } |
| |
| libs = [ |
| "hwsec-foundation", |
| "tpm_manager", |
| ] |
| |
| defines = [ |
| "USE_TPM_DYNAMIC=${use.tpm_dynamic}", |
| "USE_TPM1=${use.tpm}", |
| "USE_TPM2=${use.tpm2}", |
| ] |
| } |
| |
| static_library("overalls_library") { |
| sources = [ |
| "overalls/overalls_api.cc", |
| "overalls/overalls_singleton.cc", |
| ] |
| configs += [ |
| ":target_defaults", |
| "//common-mk:pic", |
| ] |
| } |
| |
| source_set("error_library") { |
| sources = [ |
| "error/elliptic_curve_error.cc", |
| "error/tpm_error.cc", |
| "error/tpm_manager_error.cc", |
| "error/tpm_nvram_error.cc", |
| "error/tpm_retry_handler.cc", |
| ] |
| deps = [] |
| if (use.tpm2 || use.fuzzer) { |
| sources += [ "error/tpm2_error.cc" ] |
| deps += [ ":install_tpm2_error_h" ] |
| } |
| if (use.tpm || use.fuzzer) { |
| sources += [ "error/tpm1_error.cc" ] |
| deps += [ ":install_tpm1_error_h" ] |
| } |
| configs += [ |
| ":target_defaults", |
| "//common-mk:pic", |
| ] |
| } |
| |
| install_config("install_tpm1_headers") { |
| sources = [ "test_utils/tpm1/test_fixture.h" ] |
| install_path = "/usr/include/chromeos/libhwsec/test_utils/tpm1" |
| } |
| |
| install_config("install_tpm1_error_h") { |
| sources = [ "error/tpm1_error.h" ] |
| install_path = "/usr/include/chromeos/libhwsec/error" |
| } |
| |
| install_config("install_tpm2_error_h") { |
| sources = [ "error/tpm2_error.h" ] |
| install_path = "/usr/include/chromeos/libhwsec/error" |
| } |
| |
| static_library("libhwsec_test") { |
| sources = [] |
| if (use.tpm) { |
| sources += [ "test_utils/tpm1/test_fixture.cc" ] |
| } |
| configs += [ |
| ":target_defaults", |
| "//common-mk:nouse_thin_archive", |
| ] |
| configs -= [ "//common-mk:use_thin_archive" ] |
| install_path = "lib" |
| } |
| |
| config("libhwsec_tpm1_config") { |
| libs = [ "tspi" ] |
| } |
| |
| config("libhwsec_tpm2_config") { |
| libs = [ "trunks" ] |
| } |
| |
| source_set("hardware_abstraction_library") { |
| sources = [ |
| "proxy/proxy.cc", |
| "proxy/proxy_impl.cc", |
| ] |
| |
| libs = [] |
| |
| configs += [ |
| ":target_defaults", |
| "//common-mk:pic", |
| ] |
| |
| if (use.tpm) { |
| libs += [ "tspi" ] |
| } |
| |
| if (use.tpm2) { |
| libs += [ "trunks" ] |
| } |
| } |
| |
| shared_library("libhwsec") { |
| configs += [ ":target_defaults" ] |
| all_dependent_configs = [] |
| install_path = "lib" |
| deps = [ |
| ":error_library", |
| ":hardware_abstraction_library", |
| ] |
| if (use.tpm2 || use.fuzzer) { |
| all_dependent_configs += [ ":libhwsec_tpm2_config" ] |
| } |
| if (use.tpm || use.fuzzer) { |
| all_dependent_configs += [ ":libhwsec_tpm1_config" ] |
| deps += [ ":overalls_library" ] |
| } |
| } |
| |
| install_config("install_headers") { |
| sources = [ "hwsec_export.h" ] |
| install_path = "/usr/include/chromeos/libhwsec" |
| } |
| |
| install_config("install_headers_overalls") { |
| sources = [ |
| "overalls/overalls.h", |
| "overalls/overalls_api.h", |
| ] |
| install_path = "/usr/include/chromeos/libhwsec/overalls" |
| } |
| |
| install_config("install_error_h") { |
| sources = [ "error/tpm_error.h" ] |
| install_path = "/usr/include/chromeos/libhwsec/error" |
| } |
| |
| if (use.test) { |
| pkg_config("test_config") { |
| pkg_deps = [ |
| "libchrome-test", |
| "libtpm_manager-client-test", |
| ] |
| } |
| |
| executable("hwsec_testrunner") { |
| sources = [ |
| "error/tpm_error_test.cc", |
| "error/tpm_manager_error_test.cc", |
| "error/tpm_nvram_error_test.cc", |
| ] |
| configs += [ |
| "//common-mk:test", |
| ":target_defaults", |
| ":test_config", |
| ] |
| run_test = true |
| deps = [ |
| ":error_library", |
| ":hardware_abstraction_library", |
| ":libhwsec_test", |
| "//common-mk/testrunner", |
| ] |
| if (use.tpm) { |
| sources += [ |
| "error/tpm1_error_test.cc", |
| "overalls/overalls_api_test.cc", |
| "overalls/overalls_singleton_test.cc", |
| ] |
| deps += [ ":overalls_library" ] |
| } |
| if (use.tpm2) { |
| sources += [ "error/tpm2_error_test.cc" ] |
| } |
| } |
| } |