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
17local_base_sources = [
18  "$LOCATION_ROOT_DIR/frameworks/js/napi/source/cached_locations_callback_napi.cpp",
19  "$LOCATION_ROOT_DIR/frameworks/js/napi/source/country_code_callback_napi.cpp",
20  "$LOCATION_ROOT_DIR/frameworks/js/napi/source/geofence_napi.cpp",
21  "$LOCATION_ROOT_DIR/frameworks/js/napi/source/gnss_status_callback_napi.cpp",
22  "$LOCATION_ROOT_DIR/frameworks/js/napi/source/locating_required_data_callback_napi.cpp",
23  "$LOCATION_ROOT_DIR/frameworks/js/napi/source/location_error_callback_napi.cpp",
24  "$LOCATION_ROOT_DIR/frameworks/js/napi/source/location_gnss_geofence_callback_napi.cpp",
25  "$LOCATION_ROOT_DIR/frameworks/js/napi/source/location_napi_adapter.cpp",
26  "$LOCATION_ROOT_DIR/frameworks/js/napi/source/location_napi_entry.cpp",
27  "$LOCATION_ROOT_DIR/frameworks/js/napi/source/location_napi_errcode.cpp",
28  "$LOCATION_ROOT_DIR/frameworks/js/napi/source/location_napi_event.cpp",
29  "$LOCATION_ROOT_DIR/frameworks/js/napi/source/location_napi_system.cpp",
30  "$LOCATION_ROOT_DIR/frameworks/js/napi/source/location_switch_callback_napi.cpp",
31  "$LOCATION_ROOT_DIR/frameworks/js/napi/source/locator_callback_napi.cpp",
32  "$LOCATION_ROOT_DIR/frameworks/js/napi/source/napi_util.cpp",
33  "$LOCATION_ROOT_DIR/frameworks/js/napi/source/nmea_message_callback_napi.cpp",
34]
35
36if (notification_distributed_notification_service_enable) {
37  local_notification_sources = [
38    "$LOCATION_ROOT_DIR/frameworks/js/napi/notification/src/notification_napi.cpp",
39    "$LOCATION_ROOT_DIR/frameworks/js/napi/notification/src/notification_napi_convert_content.cpp",
40    "$LOCATION_ROOT_DIR/frameworks/js/napi/notification/src/notification_napi_convert_liveview.cpp",
41    "$LOCATION_ROOT_DIR/frameworks/js/napi/notification/src/notification_napi_convert_notification.cpp",
42    "$LOCATION_ROOT_DIR/frameworks/js/napi/notification/src/notification_napi_convert_request.cpp",
43    "$LOCATION_ROOT_DIR/frameworks/js/napi/notification/src/notification_napi_utils.cpp",
44  ]
45
46  notification_external_deps = [
47    "ability_base:session_info",
48    "ability_base:want",
49    "ability_runtime:napi_common",
50    "distributed_notification_service:ans_innerkits",
51    "image_framework:image",
52    "relational_store:native_rdb",
53  ]
54}
55
56ohos_shared_library("geolocation") {
57  sanitize = {
58    cfi = true
59    cfi_cross_dso = true
60    debug = false
61  }
62  branch_protector_ret = "pac_ret"
63  install_enable = true
64  include_dirs = [
65    "$LOCATION_ROOT_DIR/frameworks/js/napi/include",
66    "$LOCATION_ROOT_DIR/frameworks/js/napi/notification/include",
67    "$LOCATION_ROOT_DIR/interfaces/inner_api/include",
68  ]
69
70  sources = local_base_sources
71
72  deps = [
73    "$LOCATION_ROOT_DIR/frameworks/base_module:lbsbase_module",
74    "$LOCATION_ROOT_DIR/frameworks/location_common/common:lbsservice_common",
75    "$LOCATION_ROOT_DIR/frameworks/native/geofence_sdk:geofence_sdk",
76    "$LOCATION_ROOT_DIR/frameworks/native/locator_sdk:locator_sdk",
77  ]
78
79  external_deps = [
80    "hilog:libhilog",
81    "ipc:ipc_single",
82    "napi:ace_napi",
83  ]
84
85  defines = []
86
87  if (notification_distributed_notification_service_enable) {
88    sources += local_notification_sources
89    external_deps += notification_external_deps
90    defines += [ "NOTIFICATION_ENABLE" ]
91  }
92
93  if (location_feature_with_jsstack) {
94    defines += [ "SUPPORT_JSSTACK" ]
95    external_deps += [ "hiview:libxpower_event_js" ]
96  }
97
98  relative_install_dir = "module"
99  part_name = "location"
100  subsystem_name = "location"
101}
102
103ohos_static_library("geolocation_static") {
104  sanitize = {
105    cfi = true
106    cfi_cross_dso = true
107    debug = false
108  }
109  branch_protector_ret = "pac_ret"
110  include_dirs = [
111    "$LOCATION_ROOT_DIR/frameworks/js/napi/include",
112    "$LOCATION_ROOT_DIR/interfaces/inner_api/include",
113    "$LOCATION_ROOT_DIR/frameworks/js/napi/notification/include",
114  ]
115
116  sources = local_base_sources
117
118  deps = [
119    "$LOCATION_ROOT_DIR/frameworks/base_module:lbsbase_module",
120    "$LOCATION_ROOT_DIR/frameworks/location_common/common:lbsservice_common",
121    "$LOCATION_ROOT_DIR/frameworks/native/geofence_sdk:geofence_sdk",
122    "$LOCATION_ROOT_DIR/frameworks/native/locator_sdk:locator_sdk",
123  ]
124
125  external_deps = [
126    "hilog:libhilog",
127    "ipc:ipc_single",
128    "napi:ace_napi",
129  ]
130
131  defines = []
132
133  if (notification_distributed_notification_service_enable) {
134    sources += local_notification_sources
135    external_deps += notification_external_deps
136    defines += [ "NOTIFICATION_ENABLE" ]
137  }
138  part_name = "location"
139  subsystem_name = "location"
140}
141
142ohos_shared_library("geolocationmanager") {
143  install_enable = true
144  sanitize = {
145    cfi = true
146    cfi_cross_dso = true
147    debug = false
148  }
149  branch_protector_ret = "pac_ret"
150  include_dirs = [
151    "$LOCATION_ROOT_DIR/frameworks/js/napi/include",
152    "$LOCATION_ROOT_DIR/interfaces/inner_api/include",
153    "$LOCATION_ROOT_DIR/frameworks/js/napi/notification/include",
154  ]
155
156  sources = local_base_sources
157
158  deps = [
159    "$LOCATION_ROOT_DIR/frameworks/base_module:lbsbase_module",
160    "$LOCATION_ROOT_DIR/frameworks/location_common/common:lbsservice_common",
161    "$LOCATION_ROOT_DIR/frameworks/native/geofence_sdk:geofence_sdk",
162    "$LOCATION_ROOT_DIR/frameworks/native/locator_sdk:locator_sdk",
163  ]
164
165  defines = [ "ENABLE_NAPI_MANAGER" ]
166
167  external_deps = [
168    "hilog:libhilog",
169    "ipc:ipc_single",
170    "napi:ace_napi",
171  ]
172
173  if (notification_distributed_notification_service_enable) {
174    sources += local_notification_sources
175    external_deps += notification_external_deps
176    defines += [ "NOTIFICATION_ENABLE" ]
177  }
178
179  if (location_feature_with_jsstack) {
180    defines += [ "SUPPORT_JSSTACK" ]
181    external_deps += [ "hiview:libxpower_event_js" ]
182  }
183  relative_install_dir = "module"
184  part_name = "location"
185  subsystem_name = "location"
186}
187