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  "$LOCATION_GEOCONVERT_ROOT/source/geo_convert_service.cpp",
20  "$LOCATION_GEOCONVERT_ROOT/source/geo_convert_skeleton.cpp",
21  "$LOCATION_LOCATOR_ROOT/source/location_config_manager.cpp",
22]
23
24if (location_feature_with_geocode) {
25  ohos_shared_library("lbsservice_geocode") {
26    sources = local_base_sources
27
28    include_dirs = [
29      "$LOCATION_GEOCONVERT_ROOT/include",
30      "$LOCATION_LOCATOR_ROOT/include",
31      "$LOCATION_ROOT_DIR/interfaces/inner_api/include",
32    ]
33
34    sanitize = {
35      cfi = true
36      cfi_cross_dso = true
37      debug = false
38    }
39    branch_protector_ret = "pac_ret"
40
41    deps = [
42      "$LOCATION_ROOT_DIR/frameworks/base_module:lbsbase_module",
43      "$LOCATION_ROOT_DIR/frameworks/location_common/common:lbsservice_common",
44    ]
45
46    ldflags = [
47      "-Wl,--as-needed",
48      "-Wl,--gc-sections",
49    ]
50
51    cflags_cc = [
52      "-ffunction-sections",
53      "-fdata-sections",
54      "-Os",
55    ]
56
57    defines = []
58    if (location_feature_with_geocode) {
59      defines += [ "FEATURE_GEOCODE_SUPPORT" ]
60    }
61
62    external_deps = [
63      "ability_base:want",
64      "ability_runtime:ability_manager",
65      "eventhandler:libeventhandler",
66      "ffrt:libffrt",
67      "hilog:libhilog",
68      "ipc:ipc_single",
69      "safwk:system_ability_fwk",
70    ]
71
72    # Used to control the export of dynamic library symbols.
73    version_script = "liblbsservice_geocode_version_script.txt"
74
75    part_name = "location"
76    subsystem_name = "location"
77  }
78
79  ohos_static_library("lbsservice_geocode_static") {
80    sources = local_base_sources
81
82    include_dirs = [
83      "$LOCATION_GEOCONVERT_ROOT/include",
84      "$LOCATION_LOCATOR_ROOT/include",
85      "$LOCATION_ROOT_DIR/interfaces/inner_api/include",
86    ]
87
88    sanitize = {
89      cfi = true
90      cfi_cross_dso = true
91      debug = false
92    }
93    branch_protector_ret = "pac_ret"
94
95    deps = [
96      "$LOCATION_ROOT_DIR/frameworks/base_module:lbsbase_module",
97      "$LOCATION_ROOT_DIR/frameworks/location_common/common:lbsservice_common",
98    ]
99
100    ldflags = [
101      "-Wl,--as-needed",
102      "-Wl,--gc-sections",
103    ]
104
105    cflags_cc = [
106      "-ffunction-sections",
107      "-fdata-sections",
108    ]
109
110    defines = []
111    if (location_feature_with_geocode) {
112      defines += [ "FEATURE_GEOCODE_SUPPORT" ]
113    }
114
115    external_deps = [
116      "ability_base:want",
117      "ability_runtime:ability_manager",
118      "ffrt:libffrt",
119      "hilog:libhilog",
120      "ipc:ipc_single",
121      "safwk:system_ability_fwk",
122    ]
123
124    part_name = "location"
125    subsystem_name = "location"
126  }
127} else {
128  ohos_shared_library("lbsservice_geocode") {
129    part_name = "location"
130    subsystem_name = "location"
131  }
132
133  ohos_static_library("lbsservice_geocode_static") {
134    part_name = "location"
135    subsystem_name = "location"
136  }
137}
138