1# Copyright (c) 2021-2024 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 17ohos_shared_library("libsensor_service") { 18 sources = [ 19 "src/client_info.cpp", 20 "src/fifo_cache_data.cpp", 21 "src/flush_info_record.cpp", 22 "src/sensor_dump.cpp", 23 "src/sensor_manager.cpp", 24 "src/sensor_power_policy.cpp", 25 "src/sensor_service.cpp", 26 "src/stream_server.cpp", 27 ] 28 29 include_dirs = [ 30 "$SUBSYSTEM_DIR/frameworks/native/include", 31 "$SUBSYSTEM_DIR/interfaces/inner_api", 32 "$SUBSYSTEM_DIR/services/include", 33 "$SUBSYSTEM_DIR/utils/common/include", 34 "$SUBSYSTEM_DIR/utils/ipc/include", 35 ] 36 37 cflags = [ 38 "-fvisibility=hidden", 39 "-ffunction-sections", 40 "-fdata-sections", 41 "-Oz", 42 ] 43 44 cflags_cc = [ 45 "-fvisibility=hidden", 46 "-ffunction-sections", 47 "-fdata-sections", 48 "-Oz", 49 ] 50 51 branch_protector_ret = "pac_ret" 52 sanitize = { 53 cfi = true 54 cfi_cross_dso = true 55 debug = false 56 } 57 58 defines = sensor_default_defines 59 60 deps = [ 61 "$SUBSYSTEM_DIR/frameworks/native:sensor_service_stub", 62 "$SUBSYSTEM_DIR/utils/common:libsensor_utils", 63 "$SUBSYSTEM_DIR/utils/ipc:libsensor_ipc", 64 ] 65 66 if (sensor_rust_socket_ipc) { 67 deps += 68 [ "$SUBSYSTEM_DIR/rust/utils/socket_ipc_rust_ffi:sensor_rust_util_ffi" ] 69 } 70 71 external_deps = [ 72 "access_token:libaccesstoken_sdk", 73 "access_token:libtokenid_sdk", 74 "c_utils:utils", 75 "hicollie:libhicollie", 76 "hilog:libhilog", 77 "init:libbegetutil", 78 "ipc:ipc_single", 79 "safwk:system_ability_fwk", 80 "samgr:samgr_proxy", 81 ] 82 83 if (sensor_memmgr_enable) { 84 defines += [ "MEMMGR_ENABLE" ] 85 external_deps += [ "memmgr:memmgrclient" ] 86 } 87 88 if (sensor_access_token_enable) { 89 defines += [ "ACCESS_TOKEN_ENABLE" ] 90 } 91 92 if (sensor_msdp_motion_enable) { 93 defines += [ "MSDP_MOTION_ENABLE" ] 94 } 95 96 if (hiviewdfx_hisysevent_enable) { 97 external_deps += [ "hisysevent:libhisysevent" ] 98 } 99 100 if (hiviewdfx_hitrace_enable) { 101 external_deps += [ "hitrace:hitrace_meter" ] 102 } 103 104 if (hdf_drivers_interface_sensor) { 105 sources += [ 106 "hdi_connection/adapter/src/hdi_connection.cpp", 107 "hdi_connection/adapter/src/sensor_event_callback.cpp", 108 "hdi_connection/adapter/src/sensor_plug_callback.cpp", 109 "hdi_connection/interface/src/sensor_hdi_connection.cpp", 110 "src/sensor_data_processer.cpp", 111 ] 112 113 include_dirs += [ 114 "$SUBSYSTEM_DIR/services/hdi_connection/interface/include", 115 "$SUBSYSTEM_DIR/services/hdi_connection/adapter/include", 116 ] 117 118 if (sensor_build_eng) { 119 sources += [ 120 "hdi_connection/adapter/src/compatible_connection.cpp", 121 "hdi_connection/hardware/src/hdi_service_impl.cpp", 122 ] 123 124 include_dirs += 125 [ "$SUBSYSTEM_DIR/services/hdi_connection/hardware/include" ] 126 } 127 128 external_deps += [ "drivers_interface_sensor:libsensor_proxy_3.0" ] 129 } 130 131 shlib_type = "sa" 132 part_name = "sensor" 133 subsystem_name = "sensors" 134} 135 136########################################################################## 137ohos_static_library("libsensor_service_static") { 138 sources = [ 139 "src/client_info.cpp", 140 "src/fifo_cache_data.cpp", 141 "src/flush_info_record.cpp", 142 "src/sensor_dump.cpp", 143 "src/sensor_manager.cpp", 144 "src/sensor_power_policy.cpp", 145 "src/sensor_service.cpp", 146 "src/stream_server.cpp", 147 ] 148 149 include_dirs = [ 150 "$SUBSYSTEM_DIR/frameworks/native/include", 151 "$SUBSYSTEM_DIR/interfaces/inner_api", 152 "$SUBSYSTEM_DIR/services/include", 153 "$SUBSYSTEM_DIR/utils/common/include", 154 "$SUBSYSTEM_DIR/utils/ipc/include", 155 ] 156 157 cflags = [ 158 "-fvisibility=hidden", 159 "-ffunction-sections", 160 "-fdata-sections", 161 "-Oz", 162 ] 163 164 cflags_cc = [ 165 "-fvisibility=hidden", 166 "-ffunction-sections", 167 "-fdata-sections", 168 "-Oz", 169 ] 170 171 branch_protector_ret = "pac_ret" 172 sanitize = { 173 cfi = true 174 cfi_cross_dso = true 175 debug = false 176 } 177 178 defines = sensor_default_defines 179 180 deps = [ 181 "$SUBSYSTEM_DIR/frameworks/native:sensor_service_stub", 182 "$SUBSYSTEM_DIR/utils/common:libsensor_utils", 183 "$SUBSYSTEM_DIR/utils/ipc:libsensor_ipc", 184 ] 185 186 if (sensor_rust_socket_ipc) { 187 deps += 188 [ "$SUBSYSTEM_DIR/rust/utils/socket_ipc_rust_ffi:sensor_rust_util_ffi" ] 189 } 190 191 external_deps = [ 192 "access_token:libaccesstoken_sdk", 193 "access_token:libtokenid_sdk", 194 "c_utils:utils", 195 "hicollie:libhicollie", 196 "hilog:libhilog", 197 "init:libbegetutil", 198 "ipc:ipc_single", 199 "safwk:system_ability_fwk", 200 "samgr:samgr_proxy", 201 ] 202 203 if (sensor_memmgr_enable) { 204 defines += [ "MEMMGR_ENABLE" ] 205 external_deps += [ "memmgr:memmgrclient" ] 206 } 207 208 if (sensor_access_token_enable) { 209 defines += [ "ACCESS_TOKEN_ENABLE" ] 210 } 211 212 if (sensor_msdp_motion_enable) { 213 defines += [ "MSDP_MOTION_ENABLE" ] 214 } 215 216 if (hiviewdfx_hisysevent_enable) { 217 external_deps += [ "hisysevent:libhisysevent" ] 218 } 219 220 if (hiviewdfx_hitrace_enable) { 221 external_deps += [ "hitrace:hitrace_meter" ] 222 } 223 224 if (hdf_drivers_interface_sensor) { 225 sources += [ 226 "hdi_connection/adapter/src/hdi_connection.cpp", 227 "hdi_connection/adapter/src/sensor_event_callback.cpp", 228 "hdi_connection/adapter/src/sensor_plug_callback.cpp", 229 "hdi_connection/interface/src/sensor_hdi_connection.cpp", 230 "src/sensor_data_processer.cpp", 231 ] 232 233 include_dirs += [ 234 "$SUBSYSTEM_DIR/services/hdi_connection/interface/include", 235 "$SUBSYSTEM_DIR/services/hdi_connection/adapter/include", 236 ] 237 238 if (sensor_build_eng) { 239 sources += [ 240 "hdi_connection/adapter/src/compatible_connection.cpp", 241 "hdi_connection/hardware/src/hdi_service_impl.cpp", 242 ] 243 244 include_dirs += 245 [ "$SUBSYSTEM_DIR/services/hdi_connection/hardware/include" ] 246 } 247 248 external_deps += [ "drivers_interface_sensor:libsensor_proxy_3.0" ] 249 } 250 251 part_name = "sensor" 252 subsystem_name = "sensors" 253} 254group("sensor_service_target") { 255 deps = [ 256 ":libsensor_service", 257 ":libsensor_service_static", 258 ] 259} 260