1# Copyright (c) 2021-2023 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/ohos.gni")
15import("../sensor.gni")
16
17config("sensor_vdi_config") {
18  include_dirs = [
19    "../interfaces/include",
20    "../interfaces/v1_0",
21  ]
22}
23
24ohos_static_library("libsensor_vdi_config") {
25  public_configs = [ ":sensor_vdi_config" ]
26}
27
28ohos_shared_library("libsensor_interface_service_2.0") {
29  defines = []
30  if (build_variant == "root") {
31    defines += [ "SENSOR_DEBUG" ]
32  }
33  include_dirs = [
34    ".",
35    "../interfaces/include",
36    "../interfaces/v1_0",
37    "../utils/include",
38  ]
39
40  sources = [
41    "sensor_callback_vdi.cpp",
42    "sensor_client_info.cpp",
43    "sensor_clients_manager.cpp",
44    "sensor_hdi_dump.cpp",
45    "sensor_if_service.cpp",
46  ]
47
48  cflags = [
49    "-Wall",
50    "-Wextra",
51    "-Werror",
52    "-fsigned-char",
53    "-fno-common",
54    "-fno-strict-aliasing",
55  ]
56
57  if (is_standard_system) {
58    external_deps = [
59      "drivers_interface_sensor:libsensor_stub_2.0",
60      "hdf_core:libhdf_host",
61      "hdf_core:libhdf_ipc_adapter",
62      "hdf_core:libhdf_utils",
63      "hilog:libhilog",
64      "hitrace:hitrace_meter",
65      "ipc:ipc_single",
66    ]
67    if (c_utils_enable) {
68      external_deps += [ "c_utils:utils" ]
69    }
70  } else {
71    external_deps = [
72      "hilog:libhilog",
73      "ipc:ipc_single",
74    ]
75  }
76
77  install_images = [ chipset_base_dir ]
78  subsystem_name = "hdf"
79  part_name = "drivers_peripheral_sensor"
80}
81
82ohos_shared_library("libsensor_driver") {
83  include_dirs = [
84    "../interfaces/include/",
85    "../utils/include",
86  ]
87  sources = [ "sensor_if_driver.cpp" ]
88
89  cflags = [
90    "-Wall",
91    "-Wextra",
92    "-Werror",
93    "-fsigned-char",
94    "-fno-common",
95    "-fno-strict-aliasing",
96  ]
97
98  if (is_standard_system) {
99    external_deps = [
100      "drivers_interface_sensor:libsensor_stub_2.0",
101      "hdf_core:libhdf_host",
102      "hdf_core:libhdf_ipc_adapter",
103      "hdf_core:libhdf_utils",
104      "hdf_core:libhdi",
105      "hilog:libhilog",
106      "ipc:ipc_single",
107    ]
108    if (c_utils_enable) {
109      external_deps += [ "c_utils:utils" ]
110    }
111  } else {
112    external_deps = [
113      "hilog:libhilog",
114      "ipc:ipc_single",
115    ]
116  }
117
118  shlib_type = "hdi"
119  install_images = [ chipset_base_dir ]
120  subsystem_name = "hdf"
121  part_name = "drivers_peripheral_sensor"
122}
123
124group("hdi_sensor_service") {
125  deps = [
126    ":libsensor_driver",
127    ":libsensor_interface_service_2.0",
128  ]
129}
130