1# Copyright (c) 2022-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.
13import("//build/ohos.gni")
14import("../../battery.gni")
15
16ohos_shared_library("libbattery_interface_service_2.0") {
17  include_dirs = [
18    "include",
19    "../include",
20    "../../utils/include",
21  ]
22  sources = [
23    "src/battery_config.cpp",
24    "src/battery_interface_impl.cpp",
25    "src/battery_thread.cpp",
26    "src/power_supply_provider.cpp",
27  ]
28
29  if (is_standard_system) {
30    external_deps = [
31      "drivers_interface_battery:libbattery_stub_2.0",
32      "hdf_core:libpub_utils",
33      "hilog:libhilog",
34      "ipc:ipc_single",
35      "jsoncpp:jsoncpp",
36    ]
37    if (has_battery_config_policy_part) {
38      external_deps += [ "config_policy:configpolicy_util" ]
39    }
40    if (has_battery_c_utils_part) {
41      external_deps += [ "c_utils:utils" ]
42    }
43  } else {
44    external_deps = [
45      "hilog:libhilog",
46      "ipc:ipc_single",
47      "jsoncpp:jsoncpp",
48    ]
49  }
50
51  install_images = [ chipset_base_dir ]
52  subsystem_name = "hdf"
53  part_name = "drivers_peripheral_battery"
54}
55
56##############################################################################################
57
58ohos_shared_library("libbattery_driver") {
59  include_dirs = [
60    "include",
61    "../include",
62    "../../utils/include",
63    "../../charger/led",
64  ]
65  sources = [ "src/battery_interface_driver.cpp" ]
66
67  if (is_standard_system) {
68    external_deps = [
69      "drivers_interface_battery:libbattery_stub_2.0",
70      "hdf_core:libhdf_host",
71      "hdf_core:libhdf_ipc_adapter",
72      "hdf_core:libhdf_utils",
73      "hdf_core:libhdi",
74      "hilog:libhilog",
75      "ipc:ipc_single",
76      "jsoncpp:jsoncpp",
77    ]
78    if (has_battery_c_utils_part) {
79      external_deps += [ "c_utils:utils" ]
80    }
81  } else {
82    external_deps = [
83      "hilog:libhilog",
84      "ipc:ipc_single",
85      "jsoncpp:jsoncpp",
86    ]
87  }
88
89  shlib_type = "hdi"
90  install_images = [ chipset_base_dir ]
91  subsystem_name = "hdf"
92  part_name = "drivers_peripheral_battery"
93}
94
95group("hdf_battery") {
96  deps = [
97    ":libbattery_driver",
98    ":libbattery_interface_service_2.0",
99    "profile:battery_config",
100  ]
101}
102