1# Copyright (C) 2022 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
17local_base_sources = [
18  "$LOCATION_GEOCONVERT_ROOT/source/geo_convert_request.cpp",
19  "$SUBSYSTEM_DIR/location_locator/callback/source/cached_locations_callback_proxy.cpp",
20  "$SUBSYSTEM_DIR/location_locator/callback/source/country_code_callback_proxy.cpp",
21  "$SUBSYSTEM_DIR/location_locator/callback/source/gnss_status_callback_proxy.cpp",
22  "$SUBSYSTEM_DIR/location_locator/callback/source/locating_required_data_callback_proxy.cpp",
23  "$SUBSYSTEM_DIR/location_locator/callback/source/location_gnss_geofence_callback_proxy.cpp",
24  "$SUBSYSTEM_DIR/location_locator/callback/source/locator_callback_proxy.cpp",
25  "$SUBSYSTEM_DIR/location_locator/callback/source/locator_msdp_state_change_cb.cpp",
26  "$SUBSYSTEM_DIR/location_locator/callback/source/nmea_message_callback_proxy.cpp",
27  "$SUBSYSTEM_DIR/location_locator/locator/source/fusion_controller.cpp",
28  "$SUBSYSTEM_DIR/location_locator/locator/source/geo_convert_proxy.cpp",
29  "$SUBSYSTEM_DIR/location_locator/locator/source/gnss_ability_proxy.cpp",
30  "$SUBSYSTEM_DIR/location_locator/locator/source/location_config_manager.cpp",
31  "$SUBSYSTEM_DIR/location_locator/locator/source/locator_ability.cpp",
32  "$SUBSYSTEM_DIR/location_locator/locator/source/locator_background_proxy.cpp",
33  "$SUBSYSTEM_DIR/location_locator/locator/source/locator_event_manager.cpp",
34  "$SUBSYSTEM_DIR/location_locator/locator/source/locator_event_subscriber.cpp",
35  "$SUBSYSTEM_DIR/location_locator/locator/source/locator_msdp_monitor_manager.cpp",
36  "$SUBSYSTEM_DIR/location_locator/locator/source/locator_required_data_manager.cpp",
37  "$SUBSYSTEM_DIR/location_locator/locator/source/locator_skeleton.cpp",
38  "$SUBSYSTEM_DIR/location_locator/locator/source/network_ability_proxy.cpp",
39  "$SUBSYSTEM_DIR/location_locator/locator/source/passive_ability_proxy.cpp",
40  "$SUBSYSTEM_DIR/location_locator/locator/source/permission_status_change_cb.cpp",
41  "$SUBSYSTEM_DIR/location_locator/locator/source/report_manager.cpp",
42  "$SUBSYSTEM_DIR/location_locator/locator/source/request_manager.cpp",
43  "$SUBSYSTEM_DIR/location_locator/locator/source/subability_common.cpp",
44  "$SUBSYSTEM_DIR/location_locator/locator/source/work_record.cpp",
45  "$SUBSYSTEM_DIR/location_locator/locator/source/work_record_statistic.cpp",
46]
47
48ohos_shared_library("lbsservice_locator") {
49  sanitize = {
50    cfi = true
51    cfi_cross_dso = true
52    debug = false
53  }
54  branch_protector_ret = "pac_ret"
55
56  sources = local_base_sources
57
58  include_dirs = [
59    "$LOCATION_ROOT_DIR/interfaces/inner_api/include",
60    "$SUBSYSTEM_DIR/location_geocode/geocode/include",
61    "$SUBSYSTEM_DIR/location_gnss/gnss/include",
62    "$SUBSYSTEM_DIR/location_locator/callback/include",
63    "$SUBSYSTEM_DIR/location_locator/locator/include",
64    "$SUBSYSTEM_DIR/location_network/network/include",
65    "$SUBSYSTEM_DIR/location_passive/passive/include",
66  ]
67
68  deps = [
69    "$LOCATION_COMMON_DIR:lbsservice_common",
70    "$LOCATION_ROOT_DIR/frameworks/base_module:lbsbase_module",
71    "$LOCATION_ROOT_DIR/frameworks/native/geofence_sdk:geofence_sdk",
72  ]
73
74  external_deps = [
75    "ability_base:want",
76    "ability_runtime:app_manager",
77    "access_token:libaccesstoken_sdk",
78    "access_token:libprivacy_sdk",
79    "eventhandler:libeventhandler",
80    "ffrt:libffrt",
81    "hilog:libhilog",
82    "init:libbeget_proxy",
83    "ipc:ipc_single",
84    "os_account:os_account_innerkits",
85    "safwk:system_ability_fwk",
86    "samgr:samgr_proxy",
87  ]
88
89  defines = []
90
91  ldflags = [
92    "-Wl,--as-needed",
93    "-Wl,--gc-sections",
94  ]
95
96  cflags_cc = [
97    "-ffunction-sections",
98    "-fdata-sections",
99    "-flto=thin",
100    "-Os",
101  ]
102
103  if (communication_wifi_enable) {
104    external_deps += [ "wifi:wifi_sdk" ]
105    defines += [ "WIFI_ENABLE" ]
106  }
107
108  if (communication_bluetooth_enable) {
109    external_deps += [ "bluetooth:btframework" ]
110    defines += [ "BLUETOOTH_ENABLE" ]
111  }
112
113  if (location_feature_with_geocode) {
114    defines += [ "FEATURE_GEOCODE_SUPPORT" ]
115  }
116
117  if (location_feature_with_gnss) {
118    defines += [ "FEATURE_GNSS_SUPPORT" ]
119  }
120
121  if (location_feature_with_network) {
122    defines += [ "FEATURE_NETWORK_SUPPORT" ]
123  }
124
125  if (location_feature_with_passive) {
126    defines += [ "FEATURE_PASSIVE_SUPPORT" ]
127  }
128
129  if (resourceschedule_background_task_mgr_enable) {
130    external_deps += [ "background_task_mgr:bgtaskmgr_innerkits" ]
131    defines += [ "BGTASKMGR_SUPPORT" ]
132  }
133
134  if (is_emulator) {
135    defines += [ "EMULATOR_ENABLED" ]
136  }
137
138  if (ability_form_fwk_enable) {
139    external_deps += [ "form_fwk:fmskit_native" ]
140    defines += [ "FMSKIT_NATIVE_SUPPORT" ]
141  }
142
143  if (resourceschedule_schedule_service_enable) {
144    external_deps += [ "resource_schedule_service:ressched_client" ]
145    defines += [ "RES_SCHED_SUPPROT" ]
146  }
147
148  if (notification_distributed_notification_service_enable) {
149    defines += [ "NOTIFICATION_ENABLE" ]
150  }
151
152  if (movement_client_enable) {
153    external_deps += [ "movement:movement_client" ]
154    defines += [ "MOVEMENT_CLIENT_ENABLE" ]
155  }
156
157  if (location_device_standby_enable) {
158    external_deps += [ "device_standby:standby_innerkits" ]
159    defines += [ "DEVICE_STANDBY_ENABLE" ]
160  }
161
162  # Used to control the export of dynamic library symbols.
163  version_script = "liblbsservice_locator_version_script.txt"
164
165  part_name = "location"
166  subsystem_name = "location"
167}
168
169ohos_static_library("lbsservice_locator_static") {
170  sanitize = {
171    cfi = true
172    cfi_cross_dso = true
173    debug = false
174  }
175  branch_protector_ret = "pac_ret"
176
177  sources = local_base_sources
178
179  include_dirs = [
180    "$LOCATION_ROOT_DIR/interfaces/inner_api/include",
181    "$SUBSYSTEM_DIR/location_geocode/geocode/include",
182    "$SUBSYSTEM_DIR/location_gnss/gnss/include",
183    "$SUBSYSTEM_DIR/location_locator/callback/include",
184    "$SUBSYSTEM_DIR/location_locator/locator/include",
185    "$SUBSYSTEM_DIR/location_network/network/include",
186    "$SUBSYSTEM_DIR/location_passive/passive/include",
187  ]
188
189  deps = [
190    "$LOCATION_COMMON_DIR:lbsservice_common",
191    "$LOCATION_ROOT_DIR/frameworks/base_module:lbsbase_module",
192    "$LOCATION_ROOT_DIR/frameworks/native/geofence_sdk:geofence_sdk",
193  ]
194
195  external_deps = [
196    "ability_base:want",
197    "ability_runtime:app_manager",
198    "access_token:libaccesstoken_sdk",
199    "access_token:libprivacy_sdk",
200    "eventhandler:libeventhandler",
201    "ffrt:libffrt",
202    "hilog:libhilog",
203    "ipc:ipc_single",
204    "os_account:os_account_innerkits",
205    "safwk:system_ability_fwk",
206    "samgr:samgr_proxy",
207  ]
208
209  defines = []
210  if (communication_wifi_enable) {
211    external_deps += [ "wifi:wifi_sdk" ]
212    defines += [ "WIFI_ENABLE" ]
213  }
214
215  if (communication_bluetooth_enable) {
216    external_deps += [ "bluetooth:btframework" ]
217    defines += [ "BLUETOOTH_ENABLE" ]
218  }
219
220  if (location_feature_with_geocode) {
221    defines += [ "FEATURE_GEOCODE_SUPPORT" ]
222  }
223
224  if (location_feature_with_gnss) {
225    defines += [ "FEATURE_GNSS_SUPPORT" ]
226  }
227
228  if (location_feature_with_network) {
229    defines += [ "FEATURE_NETWORK_SUPPORT" ]
230  }
231
232  if (location_feature_with_passive) {
233    defines += [ "FEATURE_PASSIVE_SUPPORT" ]
234  }
235
236  if (resourceschedule_background_task_mgr_enable) {
237    external_deps += [ "background_task_mgr:bgtaskmgr_innerkits" ]
238    defines += [ "BGTASKMGR_SUPPORT" ]
239  }
240
241  if (is_emulator) {
242    defines += [ "EMULATOR_ENABLED" ]
243  }
244
245  if (ability_form_fwk_enable) {
246    external_deps += [ "form_fwk:fmskit_native" ]
247    defines += [ "FMSKIT_NATIVE_SUPPORT" ]
248  }
249
250  if (resourceschedule_schedule_service_enable) {
251    external_deps += [ "resource_schedule_service:ressched_client" ]
252    defines += [ "RES_SCHED_SUPPROT" ]
253  }
254
255  if (notification_distributed_notification_service_enable) {
256    defines += [ "NOTIFICATION_ENABLE" ]
257  }
258
259  if (movement_client_enable) {
260    external_deps += [ "movement:movement_client" ]
261    defines += [ "MOVEMENT_CLIENT_ENABLE" ]
262  }
263
264  if (location_device_standby_enable) {
265    external_deps += [ "device_standby:standby_innerkits" ]
266    defines += [ "DEVICE_STANDBY_ENABLE" ]
267  }
268
269  part_name = "location"
270  subsystem_name = "location"
271}
272