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