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("../../power.gni")
15
16ohos_shared_library("libpower_interface_service_1.2") {
17  include_dirs = [ "../../utils/include" ]
18  sources = [
19    "src/power_interface_impl.cpp",
20    "src/running_lock_counter.cpp",
21    "src/running_lock_impl.cpp",
22    "src/running_lock_timer_handler.cpp",
23    "src/system_operation.cpp",
24  ]
25
26  external_deps = [
27    "drivers_interface_power:libpower_stub_1.2",
28    "hdf_core:libhdf_host",
29    "hdf_core:libhdf_utils",
30    "hilog:libhilog",
31    "ipc:ipc_single",
32    "libxml2:libxml2",
33  ]
34  if (has_power_c_utils_part) {
35    external_deps += [ "c_utils:utils" ]
36  }
37  if (has_power_hisysevent_part) {
38    external_deps += [ "hisysevent:libhisysevent" ]
39  }
40
41  defines = []
42
43  if (drivers_peripheral_power_wakeup_cause_path) {
44    sources += [ "src/power_config.cpp" ]
45
46    external_deps += [ "jsoncpp:jsoncpp" ]
47
48    if (has_power_config_policy_part) {
49      external_deps += [ "config_policy:configpolicy_util" ]
50    }
51
52    defines += [ "DRIVER_PERIPHERAL_POWER_WAKEUP_CAUSE_PATH" ]
53  }
54
55  if (drivers_peripheral_power_suspend_with_tag) {
56    defines += [ "DRIVER_PERIPHERAL_POWER_SUSPEND_WITH_TAG" ]
57  }
58
59  if (drivers_peripheral_power_faster_retry_of_sleep) {
60    defines += [ "FASTER_RETRY_OF_SLEEP" ]
61  }
62
63  if (drivers_peripheral_power_enable_s4) {
64    sources += [ "src/hibernate.cpp" ]
65    defines += [ "DRIVERS_PERIPHERAL_POWER_ENABLE_S4" ]
66  }
67
68  if (drivers_peripheral_power_slower_retry_of_sleep) {
69    defines += [ "SLOWER_RETRY_OF_SLEEP" ]
70  }
71
72  install_images = [ chipset_base_dir ]
73  subsystem_name = "hdf"
74  part_name = "drivers_peripheral_power"
75}
76
77##############################################################################################
78
79ohos_shared_library("libpower_driver") {
80  sources = [ "src/power_interface_driver.cpp" ]
81
82  external_deps = [
83    "drivers_interface_power:libpower_stub_1.2",
84    "hdf_core:libhdf_host",
85    "hdf_core:libhdf_ipc_adapter",
86    "hdf_core:libhdf_utils",
87    "hdf_core:libhdi",
88    "hilog:libhilog",
89    "ipc:ipc_single",
90  ]
91  if (has_power_c_utils_part) {
92    external_deps += [ "c_utils:utils" ]
93  }
94
95  shlib_type = "hdi"
96  install_images = [ chipset_base_dir ]
97  subsystem_name = "hdf"
98  part_name = "drivers_peripheral_power"
99}
100
101group("hdf_power") {
102  deps = [
103    ":libpower_driver",
104    ":libpower_interface_service_1.2",
105  ]
106
107  if (drivers_peripheral_power_wakeup_cause_path) {
108    deps += [ "profile:power_hdi_service_config" ]
109  }
110}
111