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_sa_manager.cpp", 76 "src/dhcp_server.cpp", 77 ] 78 config("dhcp_sdk_header") { 79 visibility = [ ":*" ] 80 include_dirs = local_sdk_include_dirs 81 } 82 config("dhcp_sdk_config") { 83 visibility = [ ":*" ] 84 include_dirs = local_sdk_include_dirs 85 cflags = [ 86 "-std=c++17", 87 "-fno-rtti", 88 ] 89 if (target_cpu == "arm") { 90 cflags += [ "-DBINDER_IPC_32BIT" ] 91 } 92 } 93 ohos_source_set("dhcp_client_proxy_impl") { 94 branch_protector_ret = "pac_ret" 95 sanitize = { 96 cfi = true 97 boundary_sanitize = true 98 cfi_cross_dso = true 99 debug = false 100 } 101 part_name = "dhcp" 102 subsystem_name = "communication" 103 sources = [ 104 "src/dhcp_client_impl.cpp", 105 "src/dhcp_client_proxy.cpp", 106 ] 107 configs = [ 108 ":dhcp_sdk_config", 109 ":dhcp_sdk_header", 110 ] 111 defines = [] 112 external_deps = [ 113 "c_utils:utils", 114 "hilog:libhilog", 115 "ipc:ipc_single", 116 "samgr:samgr_proxy", 117 ] 118 } 119 120 ohos_source_set("dhcp_server_proxy_impl") { 121 branch_protector_ret = "pac_ret" 122 sanitize = { 123 cfi = true 124 boundary_sanitize = true 125 cfi_cross_dso = true 126 debug = false 127 } 128 part_name = "dhcp" 129 subsystem_name = "communication" 130 sources = [ 131 "src/dhcp_server_impl.cpp", 132 "src/dhcp_server_proxy.cpp", 133 ] 134 configs = [ 135 ":dhcp_sdk_config", 136 ":dhcp_sdk_header", 137 ] 138 defines = [] 139 external_deps = [ 140 "c_utils:utils", 141 "hilog:libhilog", 142 "ipc:ipc_single", 143 "samgr:samgr_proxy", 144 ] 145 } 146 147 ohos_shared_library("dhcp_sdk") { 148 branch_protector_ret = "pac_ret" 149 sanitize = { 150 cfi = true 151 boundary_sanitize = true 152 cfi_cross_dso = true 153 debug = false 154 } 155 install_enable = true 156 sources = local_sdk_sources 157 sources += [ "src/dhcp_server_callback_stub.cpp" ] 158 deps = [ 159 ":dhcp_client_proxy_impl", 160 ":dhcp_server_proxy_impl", 161 ] 162 external_deps = [ 163 "c_utils:utils", 164 "hilog:libhilog", 165 "ipc:ipc_single", 166 "safwk:system_ability_fwk", 167 "samgr:samgr_proxy", 168 ] 169 defines = [] 170 cflags_cc = [ 171 "-std=c++17", 172 "-fno-rtti", 173 ] 174 ldflags = [ 175 "-fPIC", 176 "-Wl,-E", 177 ] 178 configs = [ 179 ":dhcp_sdk_config", 180 ":dhcp_sdk_header", 181 ] 182 public_configs = [ ":dhcp_sdk_header" ] 183 part_name = "dhcp" 184 subsystem_name = "communication" 185 innerapi_tags = [ "platformsdk" ] 186 } 187} 188