• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
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/config/components/idl_tool/idl.gni")
16import("//build/ohos.gni")
17
18################################################################################
19
20config("locator_sdk_config") {
21  visibility = [ ":*" ]
22  include_dirs = [
23    "$LOCATION_ROOT_DIR/interfaces/inner_api/include",
24    "$LOCATION_ROOT_DIR/frameworks/js/napi/include",
25    "$LOCATION_ROOT_DIR/services/utils/lbsutils/include",
26    "$LOCATION_ROOT_DIR/services/utils/inner_api",
27    "$LOCATION_ROOT_DIR/frameworks/native/locator_sdk/include",
28  ]
29}
30
31config("locator_interface_config") {
32  visibility = [ "*:*" ]
33  include_dirs = [
34    "${target_gen_dir}",
35    "${target_gen_dir}/type",
36  ]
37}
38
39idl_gen_interface("locator_interface") {
40  sources = [ "ILocatorService.idl" ]
41  sources_common = [ "type/IDataTypes.idl" ]
42  configs = [ ":locator_sdk_config" ]
43  sources_cpp = [
44    rebase_path(
45        "${LOCATION_ROOT_DIR}/frameworks/base_module/source/request_config.cpp"),
46    rebase_path(
47        "${LOCATION_ROOT_DIR}/frameworks/base_module/source/location.cpp"),
48    rebase_path(
49        "${LOCATION_ROOT_DIR}/frameworks/native/geofence_sdk/source/geofence_request.cpp"),
50    rebase_path(
51        "${LOCATION_ROOT_DIR}/frameworks/location_common/common/source/geocode_convert_address_request.cpp"),
52    rebase_path(
53        "${LOCATION_ROOT_DIR}/frameworks/location_common/common/source/geocode_convert_location_request.cpp"),
54    rebase_path(
55        "${LOCATION_ROOT_DIR}/frameworks/location_common/common/source/geocoding_mock_info.cpp"),
56    rebase_path(
57        "${LOCATION_ROOT_DIR}/frameworks/location_common/common/source/geo_address.cpp"),
58    rebase_path(
59        "${LOCATION_ROOT_DIR}/frameworks/location_common/common/source/beacon_fence_request.cpp"),
60    rebase_path(
61        "${LOCATION_ROOT_DIR}/frameworks/location_common/common/source/beacon_fence.cpp"),
62  ]
63  log_domainid = "0xD002300"
64  log_tag = "Locator"
65  part_name = "location"
66  subsystem_name = "location"
67}
68
69local_base_sources = [
70  "$LOCATION_NATIVE_DIR/locator_sdk/source/country_code_callback_host.cpp",
71  "$LOCATION_NATIVE_DIR/locator_sdk/source/country_code_manager.cpp",
72  "$LOCATION_NATIVE_DIR/locator_sdk/source/geo_convert_callback_host.cpp",
73  "$LOCATION_NATIVE_DIR/locator_sdk/source/gnss_status_callback_host.cpp",
74  "$LOCATION_NATIVE_DIR/locator_sdk/source/locating_required_data_callback_host.cpp",
75  "$LOCATION_NATIVE_DIR/locator_sdk/source/location_data_manager.cpp",
76  "$LOCATION_NATIVE_DIR/locator_sdk/source/location_data_rdb_observer.cpp",
77  "$LOCATION_NATIVE_DIR/locator_sdk/source/location_switch_callback_host.cpp",
78  "$LOCATION_NATIVE_DIR/locator_sdk/source/locator.cpp",
79  "$LOCATION_NATIVE_DIR/locator_sdk/source/locator_callback_host.cpp",
80  "$LOCATION_NATIVE_DIR/locator_sdk/source/locator_impl.cpp",
81  "$LOCATION_NATIVE_DIR/locator_sdk/source/switch_callback_proxy.cpp",
82  "$LOCATION_ROOT_DIR/services/utils/lbsutils/source/lbs_res_loader.cpp",
83]
84
85ohos_shared_library("locator_sdk") {
86  install_enable = true
87
88  public_configs = [
89    ":locator_sdk_config",
90    ":locator_interface_config",
91  ]
92
93  sanitize = {
94    cfi = true
95    cfi_cross_dso = true
96    debug = false
97  }
98
99  branch_protector_ret = "pac_ret"
100
101  sources = local_base_sources
102
103  deps = [
104    ":liblocator_interface_proxy",
105    "$LOCATION_COMMON_DIR:lbsservice_common",
106    "$LOCATION_ROOT_DIR/frameworks/base_module:lbsbase_module",
107  ]
108
109  public_external_deps = [
110    "ability_runtime:dataobs_manager",
111    "data_share:datashare_consumer",
112    "hilog:libhilog",
113    "init:libbeget_proxy",
114  ]
115
116  defines = []
117
118  if (i18n_enable) {
119    defines += [ "I18N_ENABLE" ]
120  }
121
122  if (telephony_core_service_enable) {
123    public_external_deps += [ "core_service:tel_core_service_api" ]
124    defines += [ "TEL_CORE_SERVICE_ENABLE" ]
125  }
126
127  if (telephony_cellular_data_enable) {
128    public_external_deps += [ "cellular_data:tel_cellular_data_api" ]
129    defines += [ "TEL_CELLULAR_DATA_ENABLE" ]
130  }
131
132  if (is_emulator) {
133    defines += [ "EMULATOR_ENABLED" ]
134  }
135
136  if (communication_bluetooth_enable) {
137    defines += [ "BLUETOOTH_ENABLE" ]
138  }
139
140  cflags_cc = [
141    "-std=c++17",
142    "-fno-rtti",
143    "-ffunction-sections",
144    "-fdata-sections",
145    "-flto=thin",
146    "-Os",
147  ]
148
149  ldflags = [
150    "-fPIC",
151    "-Wl,-E",
152    "-Wl,--as-needed",
153    "-Wl,--gc-sections",
154  ]
155
156  # Used to control the export of dynamic library symbols.
157  version_script = "liblocator_sdk_version_script.txt"
158
159  innerapi_tags = [ "platformsdk" ]
160  part_name = "location"
161  subsystem_name = "location"
162}
163
164ohos_static_library("locator_sdk_static") {
165  public_configs = [
166    ":locator_sdk_config",
167    ":locator_interface_config",
168  ]
169
170  sanitize = {
171    cfi = true
172    cfi_cross_dso = true
173    debug = false
174  }
175
176  branch_protector_ret = "pac_ret"
177
178  sources = local_base_sources
179
180  deps = [
181    ":liblocator_interface_proxy",
182    "$LOCATION_COMMON_DIR:lbsservice_common",
183    "$LOCATION_ROOT_DIR/frameworks/base_module:lbsbase_module",
184  ]
185
186  public_external_deps = [
187    "ability_runtime:dataobs_manager",
188    "data_share:datashare_consumer",
189    "hilog:libhilog",
190    "init:libbeget_proxy",
191    "ipc:ipc_single",
192    "samgr:samgr_proxy",
193  ]
194
195  defines = []
196
197  if (i18n_enable) {
198    defines += [ "I18N_ENABLE" ]
199  }
200
201  if (telephony_core_service_enable) {
202    public_external_deps += [ "core_service:tel_core_service_api" ]
203    defines += [ "TEL_CORE_SERVICE_ENABLE" ]
204  }
205
206  if (telephony_cellular_data_enable) {
207    public_external_deps += [ "cellular_data:tel_cellular_data_api" ]
208    defines += [ "TEL_CELLULAR_DATA_ENABLE" ]
209  }
210
211  if (is_emulator) {
212    defines += [ "EMULATOR_ENABLED" ]
213  }
214
215  defines += [ "TEST_CASES_ENABLED" ]
216
217  if (communication_bluetooth_enable) {
218    defines += [ "BLUETOOTH_ENABLE" ]
219  }
220
221  cflags_cc = [
222    "-std=c++17",
223    "-fno-rtti",
224  ]
225
226  ldflags = [
227    "-fPIC",
228    "-Wl,-E",
229  ]
230
231  part_name = "location"
232  subsystem_name = "location"
233}
234