• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1# Copyright (C) 2021-2023 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
22local_sdk_include_dirs = [
23  "$DHCP_ROOT_DIR/services",
24  "$DHCP_ROOT_DIR/interfaces",
25  "$DHCP_ROOT_DIR/interfaces/inner_api",
26  "$DHCP_ROOT_DIR/interfaces/kits/c",
27  "$DHCP_ROOT_DIR/interfaces/inner_api/include",
28  "$DHCP_ROOT_DIR/interfaces/inner_api/interfaces",
29  "$DHCP_ROOT_DIR/frameworks/native/include",
30  "$DHCP_ROOT_DIR/frameworks/native/interfaces",
31  "$DHCP_ROOT_DIR/frameworks/native/c_adapter/inc",
32]
33
34if (defined(ohos_lite)) {
35  shared_library("dhcp_sdk") {
36    sources = [
37      "c_adapter/src/dhcp_c_service.cpp",
38      "c_adapter/src/dhcp_c_utils.cpp",
39      "src/dhcp_client.cpp",
40      "src/dhcp_client_callback_stub_lite.cpp",
41      "src/dhcp_client_proxy_lite.cpp",
42      "src/dhcp_event.cpp",
43      "src/dhcp_server.cpp",
44      "src/dhcp_server_callback_stub_lite.cpp",
45      "src/dhcp_server_impl.cpp",
46      "src/dhcp_server_proxy_lite.cpp",
47    ]
48    include_dirs = local_sdk_include_dirs
49    include_dirs += [ "//commonlibrary/c_utils/base/include" ]
50
51    deps = [
52      "//base/hiviewdfx/hilog_lite/frameworks/featured:hilog_shared",
53      "//foundation/communication/ipc/interfaces/innerkits/c/ipc:ipc_single",
54      "//foundation/systemabilitymgr/samgr_lite/samgr:samgr",
55      "//third_party/bounds_checking_function:libsec_shared",
56    ]
57    configs -= [ "//build/lite/config:language_cpp" ]
58    cflags_cc = [
59      "-std=c++17",
60      "-fno-rtti",
61    ]
62    defines = [ "OHOS_ARCH_LITE" ]
63    ldflags = [
64      "-fPIC",
65      "-Wl,-E",
66    ]
67  }
68} else {
69  local_sdk_sources = [
70    "c_adapter/src/dhcp_c_service.cpp",
71    "c_adapter/src/dhcp_c_utils.cpp",
72    "src/dhcp_client.cpp",
73    "src/dhcp_client_callback_stub.cpp",
74    "src/dhcp_event.cpp",
75    "src/dhcp_server.cpp",
76  ]
77  config("dhcp_sdk_header") {
78    visibility = [ ":*" ]
79    include_dirs = local_sdk_include_dirs
80  }
81  config("dhcp_sdk_config") {
82    visibility = [ ":*" ]
83    include_dirs = local_sdk_include_dirs
84    cflags = [
85      "-std=c++17",
86      "-fno-rtti",
87    ]
88    if (target_cpu == "arm") {
89      cflags += [ "-DBINDER_IPC_32BIT" ]
90    }
91  }
92  ohos_source_set("dhcp_client_proxy_impl") {
93    branch_protector_ret = "pac_ret"
94    sanitize = {
95      cfi = true  # Enable/disable control flow integrity detection
96      boundary_sanitize = true  # Enable boundary san detection
97      cfi_cross_dso = true  # Cross-SO CFI Checks
98      integer_overflow = true  # Enable integer overflow detection
99      ubsan = true  # Enable some Ubsan options
100      debug = false
101    }
102    part_name = "dhcp"
103    subsystem_name = "communication"
104    sources = [
105      "src/dhcp_client_impl.cpp",
106      "src/dhcp_client_proxy.cpp",
107    ]
108    configs = [
109      ":dhcp_sdk_config",
110      ":dhcp_sdk_header",
111    ]
112    defines = []
113    deps = [ "$DHCP_ROOT_DIR/services/utils:dhcp_utils" ]
114    external_deps = [
115      "c_utils:utils",
116      "hilog:libhilog",
117      "ipc:ipc_single",
118      "samgr:samgr_proxy",
119    ]
120  }
121
122  ohos_source_set("dhcp_server_proxy_impl") {
123    branch_protector_ret = "pac_ret"
124    sanitize = {
125      cfi = true  # Enable/disable control flow integrity detection
126      boundary_sanitize = true  # Enable boundary san detection
127      cfi_cross_dso = true  # Cross-SO CFI Checks
128      integer_overflow = true  # Enable integer overflow detection
129      ubsan = true  # Enable some Ubsan options
130      debug = false
131    }
132    part_name = "dhcp"
133    subsystem_name = "communication"
134    sources = [
135      "src/dhcp_server_impl.cpp",
136      "src/dhcp_server_proxy.cpp",
137    ]
138    configs = [
139      ":dhcp_sdk_config",
140      ":dhcp_sdk_header",
141    ]
142    defines = []
143    deps = [ "$DHCP_ROOT_DIR/services/utils:dhcp_utils" ]
144    external_deps = [
145      "c_utils:utils",
146      "hilog:libhilog",
147      "ipc:ipc_single",
148      "samgr:samgr_proxy",
149    ]
150  }
151
152  ohos_shared_library("dhcp_sdk") {
153    branch_protector_ret = "pac_ret"
154    sanitize = {
155      cfi = true  # Enable/disable control flow integrity detection
156      boundary_sanitize = true  # Enable boundary san detection
157      cfi_cross_dso = true  # Cross-SO CFI Checks
158      integer_overflow = true  # Enable integer overflow detection
159      ubsan = true  # Enable some Ubsan options
160      debug = false
161    }
162    install_enable = true
163    sources = local_sdk_sources
164    sources += [ "src/dhcp_server_callback_stub.cpp" ]
165    deps = [
166      ":dhcp_client_proxy_impl",
167      ":dhcp_server_proxy_impl",
168    ]
169    external_deps = [
170      "c_utils:utils",
171      "hilog:libhilog",
172      "ipc:ipc_single",
173      "safwk:system_ability_fwk",
174      "samgr:samgr_proxy",
175    ]
176    defines = []
177    cflags_cc = memory_optimization_cflags_cc
178    cflags_cc += [
179      "-std=c++17",
180      "-fno-rtti",
181    ]
182    ldflags = memory_optimization_ldflags
183    ldflags += [
184      "-fPIC",
185      "-Wl,-E",
186    ]
187    configs = [
188      ":dhcp_sdk_config",
189      ":dhcp_sdk_header",
190    ]
191    public_configs = [ ":dhcp_sdk_header" ]
192    version_script = "libdhcp_sdk.map"
193    part_name = "dhcp"
194    subsystem_name = "communication"
195    innerapi_tags = [ "platformsdk" ]
196  }
197}
198