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