• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
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
14if (defined(ohos_lite)) {
15  import("//build/lite/config/component/lite_component.gni")
16  import("//foundation/communication/dhcp/dhcp_lite.gni")
17} else {
18  import("//build/ohos.gni")
19  import("//foundation/communication/dhcp/dhcp.gni")
20}
21
22################################################################################
23if (defined(ohos_lite)) {
24  shared_library("dhcp_utils") {
25    sources = [
26      "src/dhcp_arp_checker.cpp",
27      "src/dhcp_common_utils.cpp",
28    ]
29
30    include_dirs = [
31      "$DHCP_ROOT_DIR/services",
32      "$DHCP_ROOT_DIR/services/utils/include",
33    ]
34    configs -= [ "//build/lite/config:language_cpp" ]
35    cflags = [
36      "-std=c++17",
37      "-fno-rtti",
38    ]
39    cflags_cc = [
40      "-std=c++17",
41      "-fno-rtti",
42    ]
43
44    deps = []
45    external_deps = []
46    defines = [
47      "_GNU_SOURCE",
48      "OHOS_ARCH_LITE",
49    ]
50  }
51} else {
52  config("dhcp_common_config") {
53    visibility = [ ":*" ]
54    include_dirs = [ "$DHCP_ROOT_DIR/services/utils/include" ]
55  }
56  ohos_shared_library("dhcp_utils") {
57    branch_protector_ret = "pac_ret"
58    sanitize = {
59      cfi = true  # Enable/disable control flow integrity detection
60      boundary_sanitize = true  # Enable boundary san detection
61      cfi_cross_dso = true  # Cross-SO CFI Checks
62      integer_overflow = true  # Enable integer overflow detection
63      ubsan = true  # Enable some Ubsan options
64      debug = false
65    }
66    install_enable = true
67    sources = [
68      "$DHCP_ROOT_DIR/services/utils/src/dhcp_arp_checker.cpp",
69      "$DHCP_ROOT_DIR/services/utils/src/dhcp_common_utils.cpp",
70      "$DHCP_ROOT_DIR/services/utils/src/dhcp_permission_utils.cpp",
71      "$DHCP_ROOT_DIR/services/utils/src/dhcp_sa_manager.cpp",
72      "$DHCP_ROOT_DIR/services/utils/src/dhcp_system_timer.cpp",
73      "$DHCP_ROOT_DIR/services/utils/src/dhcp_thread.cpp",
74    ]
75
76    include_dirs = [
77      "$DHCP_ROOT_DIR/interfaces/inner_api/include",
78      "$DHCP_ROOT_DIR/services",
79      "$DHCP_ROOT_DIR/services/utils/include",
80      "$DHCP_ROOT_DIR/frameworks/native/include",
81    ]
82
83    defines = []
84
85    if (is_asan) {
86      defines += [ "DTFUZZ_TEST" ]
87    }
88    deps = []
89    external_deps = [
90      "ability_runtime:wantagent_innerkits",
91      "access_token:libaccesstoken_sdk",
92      "access_token:libtokenid_sdk",
93      "c_utils:utils",
94      "hilog:libhilog",
95      "ipc:ipc_single",
96      "samgr:samgr_proxy",
97      "time_service:time_client",
98    ]
99
100    if (defined(global_parts_info) &&
101      defined(global_parts_info.resourceschedule_ffrt)) {
102      external_deps += [ "ffrt:libffrt" ]
103      defines += [ "DHCP_FFRT_ENABLE" ]
104    }
105
106    cflags_cc = memory_optimization_cflags_cc
107    cflags_cc += [
108      "-std=c++17",
109      "-fno-rtti",
110    ]
111    ldflags = memory_optimization_ldflags
112    ldflags += [
113      "-fPIC",
114      "-Wl,-E",
115    ]
116    version_script = "libdhcp_util.map"
117    public_configs = [ ":dhcp_common_config" ]
118    part_name = "dhcp"
119    subsystem_name = "communication"
120    innerapi_tags = [ "platformsdk" ]
121  }
122}
123