1# Copyright (c) 2021-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("//build/ohos.gni")
15import("//foundation/communication/netmanager_ext/netmanager_ext_config.gni")
16
17group("common_target") {
18  deps = [
19    ":net_event_report",
20    ":net_manager_ext_common",
21  ]
22}
23
24config("netmgr_ext_common_config") {
25  include_dirs = [
26    "log/include",
27    "event_report/include",
28  ]
29}
30
31ohos_shared_library("net_manager_ext_common") {
32  sanitize = {
33    cfi = true
34    cfi_cross_dso = true
35    blocklist = "./cfi_blocklist.txt"
36    debug = false
37  }
38
39  branch_protector_ret = "pac_ret"
40
41  sources = [ "log/src/netmgr_ext_log_wrapper.cpp" ]
42
43  defines = [
44    "NETMGR_EXT_LOG_TAG = \"NetMgrExtCommon\"",
45    "LOG_DOMAIN = 0xD0015B0",
46  ]
47
48  if (is_standard_system) {
49    defines += [ "STANDARD_SYSTEM_ENABLE" ]
50  }
51
52  public_configs = [
53    ":netmgr_ext_common_config",
54    "$C_UTILS_ROOT/base:utils_config",
55  ]
56
57  cflags = [
58    "-fstack-protector-strong",
59    "-D_FORTIFY_SOURCE=2",
60    "-O2",
61  ]
62
63  if (is_double_framework) {
64    cflags_cc = [ "-DCONFIG_DUAL_FRAMEWORK" ]
65    cflags_cc += [ "-fstack-protector-strong" ]
66  } else {
67    cflags_cc = [ "-fstack-protector-strong" ]
68  }
69
70  cflags_cc += [
71    "-D_FORTIFY_SOURCE=2",
72    "-O2",
73  ]
74
75  if (is_standard_system) {
76    external_deps = [
77      "c_utils:utils",
78      "hilog:libhilog",
79    ]
80  } else {
81    external_deps = [
82      "c_utils:utils",
83      "hilog:libhilog",
84    ]
85  }
86
87  part_name = "netmanager_ext"
88  subsystem_name = "communication"
89}
90
91ohos_shared_library("net_event_report") {
92  sanitize = {
93    cfi = true
94    cfi_cross_dso = true
95    blocklist = "./cfi_blocklist.txt"
96    debug = false
97  }
98
99  branch_protector_ret = "pac_ret"
100
101  cflags = [
102    "-fstack-protector-strong",
103    "-D_FORTIFY_SOURCE=2",
104    "-O2",
105  ]
106
107  cflags_cc = [
108    "-fstack-protector-strong",
109    "-D_FORTIFY_SOURCE=2",
110    "-O2",
111  ]
112
113  sources = [ "event_report/src/net_event_report.cpp" ]
114
115  public_configs = [ ":netmgr_ext_common_config" ]
116
117  external_deps = [ "hisysevent:libhisysevent" ]
118
119  part_name = "netmanager_ext"
120  subsystem_name = "communication"
121}
122