1# Copyright (C) 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
17ohos_ndk_headers("location_ndk_header") {
18  dest_dir = "$ndk_headers_out_dir/location"
19  sources = [
20    "$LOCATION_ROOT_DIR/interfaces/c_api/include/oh_location.h",
21    "$LOCATION_ROOT_DIR/interfaces/c_api/include/oh_location_type.h",
22  ]
23}
24
25ohos_ndk_library("liblocation_ndk") {
26  ndk_description_file =
27      "$LOCATION_NATIVE_DIR/location_ndk/liblocation.ndk.json"
28  output_name = "location_ndk"
29  output_extension = "so"
30  min_compact_version = "13"
31}
32
33config("location_ndk_config") {
34  visibility = [ ":*" ]
35  include_dirs = [
36    "$LOCATION_ROOT_DIR/interfaces/c_api/include",
37    "$LOCATION_ROOT_DIR/frameworks/native/location_ndk/include",
38  ]
39}
40
41ohos_shared_library("location_ndk") {
42  sources = [
43    "$LOCATION_NATIVE_DIR/location_ndk/source/location_info_callback_host.cpp",
44    "$LOCATION_NATIVE_DIR/location_ndk/source/locator_c_impl.cpp",
45  ]
46  output_extension = "so"
47  defines = [ "API_EXPORT=__attribute__((visibility (\"default\")))" ]
48
49  configs = [ ":location_ndk_config" ]
50
51  branch_protector_ret = "pac_ret"
52  sanitize = {
53    cfi = true
54    cfi_cross_dso = true
55    debug = false
56  }
57
58  deps = [
59    "$LOCATION_ROOT_DIR/frameworks/base_module:lbsbase_module",
60    "$LOCATION_ROOT_DIR/frameworks/location_common/common:lbsservice_common",
61    "$LOCATION_ROOT_DIR/frameworks/native/location_ndk:liblocation_ndk",
62    "$LOCATION_ROOT_DIR/frameworks/native/locator_sdk:locator_sdk",
63  ]
64
65  external_deps = [
66    "hilog:libhilog",
67    "ipc:ipc_single",
68  ]
69
70  relative_install_dir = "ndk"
71  part_name = "location"
72  subsystem_name = "location"
73}
74