1# Copyright (C) 2022-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("//base/location/config.gni") 15import("//build/ohos.gni") 16 17################################################################################ 18 19config("locator_sdk_config") { 20 visibility = [ ":*" ] 21 include_dirs = [ 22 "$LOCATION_ROOT_DIR/interfaces/inner_api/include", 23 "$LOCATION_ROOT_DIR/frameworks/js/napi/include", 24 "$LOCATION_ROOT_DIR/services/utils/lbsutils/include", 25 "$LOCATION_ROOT_DIR/services/utils/inner_api", 26 "$LOCATION_ROOT_DIR/frameworks/native/locator_sdk/include", 27 ] 28} 29 30local_base_sources = [ 31 "$LOCATION_NATIVE_DIR/locator_sdk/source/country_code_callback_host.cpp", 32 "$LOCATION_NATIVE_DIR/locator_sdk/source/country_code_manager.cpp", 33 "$LOCATION_NATIVE_DIR/locator_sdk/source/geo_convert_callback_host.cpp", 34 "$LOCATION_NATIVE_DIR/locator_sdk/source/gnss_status_callback_host.cpp", 35 "$LOCATION_NATIVE_DIR/locator_sdk/source/location_data_manager.cpp", 36 "$LOCATION_NATIVE_DIR/locator_sdk/source/location_data_rdb_observer.cpp", 37 "$LOCATION_NATIVE_DIR/locator_sdk/source/location_switch_callback_host.cpp", 38 "$LOCATION_NATIVE_DIR/locator_sdk/source/locator.cpp", 39 "$LOCATION_NATIVE_DIR/locator_sdk/source/locator_callback_host.cpp", 40 "$LOCATION_NATIVE_DIR/locator_sdk/source/locator_impl.cpp", 41 "$LOCATION_NATIVE_DIR/locator_sdk/source/locator_proxy.cpp", 42 "$LOCATION_NATIVE_DIR/locator_sdk/source/switch_callback_proxy.cpp", 43 "$LOCATION_ROOT_DIR/services/utils/lbsutils/source/lbs_res_loader.cpp", 44] 45 46ohos_shared_library("locator_sdk") { 47 install_enable = true 48 49 public_configs = [ ":locator_sdk_config" ] 50 51 sanitize = { 52 cfi = true 53 cfi_cross_dso = true 54 debug = false 55 } 56 57 branch_protector_ret = "pac_ret" 58 59 sources = local_base_sources 60 61 deps = [ 62 "$LOCATION_COMMON_DIR:lbsservice_common", 63 "$LOCATION_ROOT_DIR/frameworks/base_module:lbsbase_module", 64 ] 65 66 public_external_deps = [ 67 "ability_runtime:dataobs_manager", 68 "data_share:datashare_consumer", 69 "hilog:libhilog", 70 "init:libbeget_proxy", 71 ] 72 73 defines = [] 74 75 if (i18n_enable) { 76 defines += [ "I18N_ENABLE" ] 77 } 78 79 if (telephony_core_service_enable) { 80 public_external_deps += [ "core_service:tel_core_service_api" ] 81 defines += [ "TEL_CORE_SERVICE_ENABLE" ] 82 } 83 84 if (telephony_cellular_data_enable) { 85 public_external_deps += [ "cellular_data:tel_cellular_data_api" ] 86 defines += [ "TEL_CELLULAR_DATA_ENABLE" ] 87 } 88 89 if (is_emulator) { 90 defines += [ "EMULATOR_ENABLED" ] 91 } 92 93 cflags_cc = [ 94 "-std=c++17", 95 "-fno-rtti", 96 "-ffunction-sections", 97 "-fdata-sections", 98 "-flto=thin", 99 "-Os", 100 ] 101 102 ldflags = [ 103 "-fPIC", 104 "-Wl,-E", 105 "-Wl,--as-needed", 106 "-Wl,--gc-sections", 107 ] 108 109 # Used to control the export of dynamic library symbols. 110 version_script = "liblocator_sdk_version_script.txt" 111 112 innerapi_tags = [ "platformsdk" ] 113 part_name = "location" 114 subsystem_name = "location" 115} 116 117ohos_static_library("locator_sdk_static") { 118 public_configs = [ ":locator_sdk_config" ] 119 120 sanitize = { 121 cfi = true 122 cfi_cross_dso = true 123 debug = false 124 } 125 126 branch_protector_ret = "pac_ret" 127 128 sources = local_base_sources 129 130 deps = [ 131 "$LOCATION_COMMON_DIR:lbsservice_common", 132 "$LOCATION_ROOT_DIR/frameworks/base_module:lbsbase_module", 133 ] 134 135 public_external_deps = [ 136 "ability_runtime:dataobs_manager", 137 "data_share:datashare_consumer", 138 "hilog:libhilog", 139 "init:libbeget_proxy", 140 "ipc:ipc_single", 141 "samgr:samgr_proxy", 142 ] 143 144 defines = [] 145 146 if (i18n_enable) { 147 defines += [ "I18N_ENABLE" ] 148 } 149 150 if (telephony_core_service_enable) { 151 public_external_deps += [ "core_service:tel_core_service_api" ] 152 defines += [ "TEL_CORE_SERVICE_ENABLE" ] 153 } 154 155 if (telephony_cellular_data_enable) { 156 public_external_deps += [ "cellular_data:tel_cellular_data_api" ] 157 defines += [ "TEL_CELLULAR_DATA_ENABLE" ] 158 } 159 160 if (is_emulator) { 161 defines += [ "EMULATOR_ENABLED" ] 162 } 163 164 defines += [ "TEST_CASES_ENABLED" ] 165 166 cflags_cc = [ 167 "-std=c++17", 168 "-fno-rtti", 169 ] 170 171 ldflags = [ 172 "-fPIC", 173 "-Wl,-E", 174 ] 175 176 part_name = "location" 177 subsystem_name = "location" 178} 179