• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
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    "../../utils/battery_xcollie.cpp",
24    "src/battery_config.cpp",
25    "src/battery_interface_impl.cpp",
26    "src/battery_thread.cpp",
27    "src/power_supply_provider.cpp",
28  ]
29
30  defines = []
31  if (is_standard_system) {
32    external_deps = [
33      "drivers_interface_battery:libbattery_stub_2.0",
34      "hdf_core:libpub_utils",
35      "hilog:libhilog",
36      "ipc:ipc_single",
37      "jsoncpp:jsoncpp",
38    ]
39    if (drivers_peripheral_battery_feature_config_policy) {
40      external_deps += [ "config_policy:configpolicy_util" ]
41    }
42    if (drivers_peripheral_battery_feature_c_utils) {
43      external_deps += [ "c_utils:utils" ]
44    }
45
46    # xcollie has a bug, disable it
47    if (drivers_peripheral_battery_feature_hicollie) {
48      external_deps += [ "hicollie:libhicollie" ]
49      defines += [ "HICOLLIE_ENABLE" ]
50    }
51  } else {
52    external_deps = [
53      "hilog:libhilog",
54      "ipc:ipc_single",
55      "jsoncpp:jsoncpp",
56    ]
57  }
58
59  install_images = [ chipset_base_dir ]
60  subsystem_name = "hdf"
61  part_name = "drivers_peripheral_battery"
62}
63
64##############################################################################################
65
66ohos_shared_library("libbattery_driver") {
67  include_dirs = [
68    "include",
69    "../include",
70    "../../utils/include",
71    "../../charger/led",
72  ]
73  sources = [ "src/battery_interface_driver.cpp" ]
74
75  if (is_standard_system) {
76    external_deps = [
77      "drivers_interface_battery:libbattery_stub_2.0",
78      "hdf_core:libhdf_host",
79      "hdf_core:libhdf_ipc_adapter",
80      "hdf_core:libhdf_utils",
81      "hdf_core:libhdi",
82      "hilog:libhilog",
83      "ipc:ipc_single",
84      "jsoncpp:jsoncpp",
85    ]
86    if (drivers_peripheral_battery_feature_c_utils) {
87      external_deps += [ "c_utils:utils" ]
88    }
89  } else {
90    external_deps = [
91      "hilog:libhilog",
92      "ipc:ipc_single",
93      "jsoncpp:jsoncpp",
94    ]
95  }
96
97  shlib_type = "hdi"
98  install_images = [ chipset_base_dir ]
99  subsystem_name = "hdf"
100  part_name = "drivers_peripheral_battery"
101}
102
103group("hdf_battery") {
104  deps = [
105    ":libbattery_driver",
106    ":libbattery_interface_service_2.0",
107    "profile:battery_config",
108  ]
109}
110