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