1# Copyright (c) 2021-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. 13 14import("//build/ohos.gni") 15import("./../../sensor.gni") 16 17ohos_shared_library("libsensor_client") { 18 sources = [ 19 "src/fd_listener.cpp", 20 "src/sensor_agent_proxy.cpp", 21 "src/sensor_client_stub.cpp", 22 "src/sensor_data_channel.cpp", 23 "src/sensor_event_handler.cpp", 24 "src/sensor_file_descriptor_listener.cpp", 25 "src/sensor_service_client.cpp", 26 "src/sensor_service_proxy.cpp", 27 ] 28 29 include_dirs = [ 30 "$SUBSYSTEM_DIR/frameworks/native/include", 31 "$SUBSYSTEM_DIR/interfaces/inner_api", 32 "$SUBSYSTEM_DIR/utils/common/include", 33 "$SUBSYSTEM_DIR/utils/ipc/include", 34 ] 35 36 branch_protector_ret = "pac_ret" 37 sanitize = { 38 cfi = true 39 cfi_cross_dso = true 40 debug = false 41 } 42 43 defines = sensor_default_defines 44 45 deps = [ 46 "$SUBSYSTEM_DIR/utils/common:libsensor_utils", 47 "$SUBSYSTEM_DIR/utils/ipc:libsensor_ipc", 48 ] 49 50 if (sensor_rust_socket_ipc) { 51 deps += 52 [ "$SUBSYSTEM_DIR/rust/utils/socket_ipc_rust_ffi:sensor_rust_util_ffi" ] 53 } 54 55 external_deps = [ 56 "c_utils:utils", 57 "eventhandler:libeventhandler", 58 "hilog:libhilog", 59 "ipc:ipc_single", 60 "samgr:samgr_proxy", 61 ] 62 63 if (hiviewdfx_hisysevent_enable) { 64 external_deps += [ "hisysevent:libhisysevent" ] 65 } 66 67 if (hiviewdfx_hitrace_enable) { 68 external_deps += [ "hitrace:hitrace_meter" ] 69 } 70 71 innerapi_tags = [ "platformsdk_indirect" ] 72 part_name = "sensor" 73 subsystem_name = "sensors" 74} 75ohos_ndk_library("libsensor_ndk") { 76 output_name = "sensor" 77 ndk_description_file = "./libsensor.json" 78 min_compact_version = "6" 79} 80 81config("sensor_private_config") { 82 include_dirs = [ 83 "$SUBSYSTEM_DIR/frameworks/native/include", 84 "$SUBSYSTEM_DIR/interfaces/inner_api", 85 "$SUBSYSTEM_DIR/utils/common/include", 86 ] 87} 88config("sensor_public_config") { 89 include_dirs = [ "$SUBSYSTEM_DIR/interfaces/inner_api" ] 90} 91 92ohos_shared_library("sensor_interface_native") { 93 output_name = "sensor_agent" 94 sources = [ 95 "src/geomagnetic_field.cpp", 96 "src/sensor_agent.cpp", 97 "src/sensor_algorithm.cpp", 98 ] 99 100 configs = [ ":sensor_private_config" ] 101 public_configs = [ ":sensor_public_config" ] 102 103 branch_protector_ret = "pac_ret" 104 sanitize = { 105 cfi = true 106 cfi_cross_dso = true 107 debug = false 108 boundary_sanitize = true 109 integer_overflow = true 110 ubsan = true 111 } 112 113 deps = [ 114 "$SUBSYSTEM_DIR/frameworks/native:libsensor_client", 115 "$SUBSYSTEM_DIR/frameworks/native:libsensor_ndk", 116 ] 117 118 external_deps = [ 119 "c_utils:utils", 120 "eventhandler:libeventhandler", 121 "hilog:libhilog", 122 "ipc:ipc_single", 123 "safwk:system_ability_fwk", 124 ] 125 126 part_name = "sensor" 127 innerapi_tags = [ "platformsdk" ] 128 subsystem_name = "sensors" 129} 130 131config("ohsensor_public_config") { 132 include_dirs = [ "$SUBSYSTEM_DIR/interfaces/kits/c" ] 133} 134 135ohos_shared_library("ohsensor") { 136 sources = [ "src/native_sensor.cpp" ] 137 output_extension = "so" 138 defines = [ "API_EXPORT=__attribute__((visibility (\"default\")))" ] 139 140 configs = [ ":sensor_private_config" ] 141 public_configs = [ ":ohsensor_public_config" ] 142 143 branch_protector_ret = "pac_ret" 144 sanitize = { 145 cfi = true 146 cfi_cross_dso = true 147 debug = false 148 } 149 150 deps = [ 151 "$SUBSYSTEM_DIR/frameworks/native:libsensor_client", 152 "$SUBSYSTEM_DIR/frameworks/native:libsensor_ndk", 153 "$SUBSYSTEM_DIR/frameworks/native:sensor_interface_native", 154 "$SUBSYSTEM_DIR/utils/ipc:libsensor_ipc", 155 ] 156 157 external_deps = [ 158 "c_utils:utils", 159 "eventhandler:libeventhandler", 160 "hilog:libhilog", 161 "ipc:ipc_single", 162 "safwk:system_ability_fwk", 163 ] 164 165 relative_install_dir = "ndk" 166 part_name = "sensor" 167 subsystem_name = "sensors" 168} 169 170group("sensor_target") { 171 deps = [ 172 ":libsensor_client", 173 ":sensor_interface_native", 174 ] 175} 176