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. 13 14import("//base/location/config.gni") 15import("//build/ohos.gni") 16 17if (location_feature_with_gnss) { 18 local_base_sources = [ 19 "$LOCATION_GNSS_ROOT/source/agnss_event_callback.cpp", 20 "$LOCATION_GNSS_ROOT/source/agnss_ni_manager.cpp", 21 "$LOCATION_GNSS_ROOT/source/geofence_event_callback.cpp", 22 "$LOCATION_GNSS_ROOT/source/gnss_ability.cpp", 23 "$LOCATION_GNSS_ROOT/source/gnss_ability_skeleton.cpp", 24 "$LOCATION_GNSS_ROOT/source/gnss_common_event_subscriber.cpp", 25 "$LOCATION_GNSS_ROOT/source/gnss_event_callback.cpp", 26 "$LOCATION_GNSS_ROOT/source/ntp/elapsed_real_time_check.cpp", 27 "$LOCATION_GNSS_ROOT/source/ntp/gps_time_manager.cpp", 28 "$LOCATION_GNSS_ROOT/source/ntp/net_conn_observer.cpp", 29 "$LOCATION_GNSS_ROOT/source/ntp/ntp_time_check.cpp", 30 "$LOCATION_GNSS_ROOT/source/ntp/ntp_time_helper.cpp", 31 "$LOCATION_GNSS_ROOT/source/ntp/time_manager.cpp", 32 "$LOCATION_GNSS_ROOT/source/string_utils.cpp", 33 "$LOCATION_LOCATOR_ROOT/source/location_config_manager.cpp", 34 "$LOCATION_LOCATOR_ROOT/source/subability_common.cpp", 35 "$LOCATION_LOCATOR_ROOT/source/work_record.cpp", 36 "$LOCATION_LOCATOR_ROOT/source/work_record_statistic.cpp", 37 ] 38 39 ohos_shared_library("lbsservice_gnss") { 40 sources = local_base_sources 41 42 include_dirs = [ 43 "$LOCATION_ROOT_DIR/interfaces/inner_api/include", 44 "$LOCATION_GNSS_ROOT/include", 45 "$LOCATION_GNSS_ROOT/include/ntp", 46 "$LOCATION_LOCATOR_ROOT/include", 47 ] 48 49 sanitize = { 50 cfi = true 51 cfi_cross_dso = true 52 debug = false 53 } 54 branch_protector_ret = "pac_ret" 55 56 deps = [ 57 "$LOCATION_ROOT_DIR/frameworks/base_module:lbsbase_module", 58 "$LOCATION_ROOT_DIR/frameworks/location_common/common:lbsservice_common", 59 "$LOCATION_ROOT_DIR/frameworks/native/geofence_sdk:geofence_sdk", 60 ] 61 62 external_deps = [ 63 "ability_base:want", 64 "eventhandler:libeventhandler", 65 "ffrt:libffrt", 66 "hdf_core:libhdi", 67 "hilog:libhilog", 68 "ipc:ipc_single", 69 "relational_store:native_rdb", 70 "safwk:system_ability_fwk", 71 "samgr:samgr_proxy", 72 ] 73 74 defines = [] 75 76 ldflags = [ 77 "-Wl,--as-needed", 78 "-Wl,--gc-sections", 79 ] 80 81 cflags_cc = [ 82 "-ffunction-sections", 83 "-fdata-sections", 84 "-flto=thin", 85 "-Os", 86 ] 87 88 if (telephony_core_service_enable) { 89 external_deps += [ "core_service:tel_core_service_api" ] 90 defines += [ "TEL_CORE_SERVICE_ENABLE" ] 91 } 92 93 if (telephony_cellular_data_enable) { 94 external_deps += [ "cellular_data:tel_cellular_data_api" ] 95 defines += [ "TEL_CELLULAR_DATA_ENABLE" ] 96 } 97 98 if (hdf_drivers_interface_location_agnss_enable) { 99 external_deps += 100 [ "drivers_interface_location_agnss:liblocation_agnss_proxy_2.0" ] 101 defines += [ "HDF_DRIVERS_INTERFACE_AGNSS_ENABLE" ] 102 } 103 104 if (location_feature_with_gnss && 105 hdf_drivers_interface_location_gnss_enable) { 106 external_deps += 107 [ "drivers_interface_location_gnss:liblocation_gnss_proxy_2.0" ] 108 defines += [ "FEATURE_GNSS_SUPPORT" ] 109 } 110 111 if (location_feature_with_passive) { 112 defines += [ "FEATURE_PASSIVE_SUPPORT" ] 113 } 114 115 if (communication_wifi_enable) { 116 external_deps += [ "wifi:wifi_sdk" ] 117 defines += [ "WIFI_ENABLE" ] 118 } 119 120 if (call_manager_enable) { 121 external_deps += [ "call_manager:tel_call_manager_api" ] 122 defines += [ "CALL_MANAGER_ENABLE" ] 123 } 124 125 if (common_event_service_enable) { 126 external_deps += [ 127 "ability_runtime:extension_manager", 128 "common_event_service:cesfwk_innerkits", 129 ] 130 defines += [ "COMMON_EVENT_SERVICE_ENABLE" ] 131 } 132 133 if (sms_mms_enable) { 134 external_deps += [ "sms_mms:tel_sms_mms_api" ] 135 defines += [ "SMS_MMS_ENABLE" ] 136 } 137 138 if (notification_distributed_notification_service_enable) { 139 defines += [ "NOTIFICATION_ENABLE" ] 140 } 141 142 if (hdf_drivers_interface_location_geofence_enable) { 143 external_deps += [ 144 "drivers_interface_location_geofence:liblocation_geofence_proxy_2.0", 145 ] 146 defines += [ "HDF_DRIVERS_INTERFACE_GEOFENCE_ENABLE" ] 147 } 148 149 if (time_service_enable) { 150 external_deps += [ "time_service:time_client" ] 151 defines += [ "TIME_SERVICE_ENABLE" ] 152 } 153 154 if (net_manager_enable) { 155 external_deps += [ "netmanager_base:net_conn_manager_if" ] 156 defines += [ "NET_MANAGER_ENABLE" ] 157 } 158 159 # Used to control the export of dynamic library symbols. 160 version_script = "liblbsservice_gnss_version_script.txt" 161 162 part_name = "location" 163 subsystem_name = "location" 164 } 165 166 ohos_static_library("lbsservice_gnss_static") { 167 sources = local_base_sources 168 169 include_dirs = [ 170 "$LOCATION_ROOT_DIR/interfaces/inner_api/include", 171 "$LOCATION_GNSS_ROOT/include", 172 "$LOCATION_GNSS_ROOT/include/ntp", 173 "$LOCATION_LOCATOR_ROOT/include", 174 ] 175 176 sanitize = { 177 cfi = true 178 cfi_cross_dso = true 179 debug = false 180 } 181 branch_protector_ret = "pac_ret" 182 183 deps = [ 184 "$LOCATION_ROOT_DIR/frameworks/base_module:lbsbase_module", 185 "$LOCATION_ROOT_DIR/frameworks/location_common/common:lbsservice_common", 186 "$LOCATION_ROOT_DIR/frameworks/native/geofence_sdk:geofence_sdk", 187 ] 188 189 external_deps = [ 190 "ability_base:want", 191 "eventhandler:libeventhandler", 192 "ffrt:libffrt", 193 "hdf_core:libhdi", 194 "hilog:libhilog", 195 "ipc:ipc_single", 196 "relational_store:native_rdb", 197 "safwk:system_ability_fwk", 198 "samgr:samgr_proxy", 199 ] 200 201 defines = [] 202 203 if (telephony_core_service_enable) { 204 external_deps += [ "core_service:tel_core_service_api" ] 205 defines += [ "TEL_CORE_SERVICE_ENABLE" ] 206 } 207 208 if (telephony_cellular_data_enable) { 209 external_deps += [ "cellular_data:tel_cellular_data_api" ] 210 defines += [ "TEL_CELLULAR_DATA_ENABLE" ] 211 } 212 213 if (hdf_drivers_interface_location_agnss_enable) { 214 external_deps += 215 [ "drivers_interface_location_agnss:liblocation_agnss_proxy_2.0" ] 216 defines += [ "HDF_DRIVERS_INTERFACE_AGNSS_ENABLE" ] 217 } 218 219 if (location_feature_with_gnss && 220 hdf_drivers_interface_location_gnss_enable) { 221 external_deps += 222 [ "drivers_interface_location_gnss:liblocation_gnss_proxy_2.0" ] 223 defines += [ "FEATURE_GNSS_SUPPORT" ] 224 } 225 226 if (location_feature_with_passive) { 227 defines += [ "FEATURE_PASSIVE_SUPPORT" ] 228 } 229 230 if (communication_wifi_enable) { 231 external_deps += [ "wifi:wifi_sdk" ] 232 defines += [ "WIFI_ENABLE" ] 233 } 234 235 if (call_manager_enable) { 236 external_deps += [ "call_manager:tel_call_manager_api" ] 237 defines += [ "CALL_MANAGER_ENABLE" ] 238 } 239 240 if (common_event_service_enable) { 241 external_deps += [ 242 "ability_runtime:extension_manager", 243 "common_event_service:cesfwk_innerkits", 244 ] 245 defines += [ "COMMON_EVENT_SERVICE_ENABLE" ] 246 } 247 248 if (sms_mms_enable) { 249 external_deps += [ "sms_mms:tel_sms_mms_api" ] 250 defines += [ "SMS_MMS_ENABLE" ] 251 } 252 253 if (notification_distributed_notification_service_enable) { 254 defines += [ "NOTIFICATION_ENABLE" ] 255 } 256 257 if (hdf_drivers_interface_location_geofence_enable) { 258 external_deps += [ 259 "drivers_interface_location_geofence:liblocation_geofence_proxy_2.0", 260 ] 261 defines += [ "HDF_DRIVERS_INTERFACE_GEOFENCE_ENABLE" ] 262 } 263 264 if (time_service_enable) { 265 external_deps += [ "time_service:time_client" ] 266 defines += [ "TIME_SERVICE_ENABLE" ] 267 } 268 269 if (net_manager_enable) { 270 external_deps += [ "netmanager_base:net_conn_manager_if" ] 271 defines += [ "NET_MANAGER_ENABLE" ] 272 } 273 274 part_name = "location" 275 subsystem_name = "location" 276 } 277} else { 278 ohos_shared_library("lbsservice_gnss") { 279 part_name = "location" 280 subsystem_name = "location" 281 } 282 283 ohos_static_library("lbsservice_gnss_static") { 284 part_name = "location" 285 subsystem_name = "location" 286 } 287} 288