• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1# Copyright (c) 2022 Huawei Device Co., Ltd.
2# Licensed under the Apache License, Version 2.0 (the "License");
3# you may not use this file except in compliance with the License.
4# You may obtain a copy of the License at
5#
6#     http://www.apache.org/licenses/LICENSE-2.0
7#
8# Unless required by applicable law or agreed to in writing, software
9# distributed under the License is distributed on an "AS IS" BASIS,
10# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
11# See the License for the specific language governing permissions and
12# limitations under the License.
13
14import("//build/lite/config/component/lite_component.gni")
15import("//test/xts/device_attest_lite/build/devattestconfig.gni")
16import("attestsource.gni")
17
18if (enable_attest_debug_memory_leak) {
19  sources_common += [ "utils/attest_utils_memleak.c" ]
20}
21
22if (enable_attest_debug_dfx) {
23  sources_common += [ "dfx/attest_dfx.c" ]
24}
25
26config("devattest_core_config") {
27  visibility = [ ":*" ]
28
29  include_dirs = include_core_dirs
30
31  defines = []
32  if (enable_attest_log_debug) {
33    defines += [ "__ATTEST_HILOG_LEVEL_DEBUG__" ]
34  }
35
36  if (enable_attest_test_mock_network) {
37    defines += [ "__ATTEST_MOCK_NETWORK_STUB__" ]
38  }
39
40  if (enable_attest_test_mock_device) {
41    defines += [ "__ATTEST_MOCK_DEVICE_STUB__" ]
42  }
43
44  if (enable_attest_debug_memory_leak) {
45    defines += [ "__ATTEST_DEBUG_MEMORY_LEAK__" ]
46  }
47
48  if (enable_attest_debug_dfx) {
49    defines += [ "__ATTEST_DEBUG_DFX__" ]
50  }
51
52  if (disable_attest_active_site) {
53    defines += [ "__ATTEST_DISABLE_SITE__" ]
54  }
55
56  defines += [ "MBEDTLS_ALLOW_PRIVATE_ACCESS" ]
57}
58
59config("devattest_core_mini_config") {
60  visibility = [ ":*" ]
61
62  include_dirs = [ "${devattest_path}/common/mini" ]
63}
64
65config("devattest_core_small_config") {
66  visibility = [ ":*" ]
67
68  include_dirs = [ "${devattest_path}/common/small" ]
69}
70
71config("devattest_core_hi3861_config") {
72  visibility = [ ":*" ]
73
74  include_dirs = [
75    "//device/soc/hisilicon/hi3861v100/sdk_liteos/third_party/mbedtls/include",
76  ]
77}
78
79if (ohos_kernel_type == "liteos_m") {
80  static_library("devattest_core") {
81    sources = sources_common
82    sources += sources_mock
83    sources += [
84      "mini/adapter/attest_adapter_network_config.c",
85      "mini/attest/attest_service_pcid.c",
86      "mini/utils/attest_utils_file_detail.c",
87    ]
88
89    public_configs = [
90      ":devattest_core_config",
91      ":devattest_core_mini_config",
92      ":devattest_core_hi3861_config",
93    ]
94
95    deps = [
96      "$ohos_product_adapter_dir/utils/token:hal_token_static",
97      "//base/startup/init/interfaces/innerkits:parameter",
98    ]
99    deps += [
100      "//build/lite/config/component/cJSON:cjson_static",
101      "//third_party/bounds_checking_function:libsec_static",
102      "//third_party/mbedtls:mbedtls_static",
103    ]
104  }
105} else if (ohos_kernel_type == "liteos_a" || ohos_kernel_type == "linux") {
106  shared_library("devattest_core") {
107    sources = sources_common
108    sources += sources_mock
109    sources += [
110      "small/adapter/attest_adapter_network_config.c",
111      "small/attest/attest_service_pcid.c",
112      "small/utils/attest_utils_file_detail.c",
113    ]
114
115    public_configs = [
116      ":devattest_core_config",
117      ":devattest_core_mini_config",
118    ]
119    cflags = [
120      "-ftrapv",
121      "-Wextra",
122      "-Wshadow",
123      "-Wformat=2",
124      "-Wfloat-equal",
125      "-Wdate-time",
126      "-fPIE",
127    ]
128
129    deps = [
130      "$ohos_product_adapter_dir/utils/token:haltoken_shared",
131      "//base/startup/init/interfaces/innerkits:parameter",
132    ]
133    deps += [
134      "//base/hiviewdfx/hilog_lite/frameworks/featured:hilog_shared",
135      "//build/lite/config/component/cJSON:cjson_shared",
136      "//third_party/mbedtls:mbedtls",
137    ]
138    deps += [ "//developtools/syscap_codec:syscap_interface_shared" ]
139  }
140}
141