1# Copyright (c) 2021 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 14DSOFTBUS_ROOT_PATH = "./../../.." 15import("$DSOFTBUS_ROOT_PATH/dsoftbus.gni") 16 17cflags = [ 18 "-DENABLE_USER_LOG", 19 "-DDFINDER_SAVE_DEVICE_LIST", 20 "-DNSTACKX_EXTEND_BUSINESSDATA", 21 "-DNSTACKX_DFINDER_HIDUMP", 22] 23 24if (defined(board_toolchain_type)) { 25 if (board_toolchain_type != "iccarm") { 26 cflags += [ "-Wall" ] 27 } 28} else { 29 cflags += [ "-Wall" ] 30} 31 32include_dirs = [] 33 34if (dsoftbus_standard_feature_dfinder_support_multi_nif) { 35 cflags += [ "-DDFINDER_SUPPORT_MULTI_NIF" ] 36} 37 38if (defined(ohos_lite)) { 39 if (ohos_kernel_type == "liteos_m") { 40 import("//build/lite/config/component/lite_component.gni") 41 config("dfinder_interface") { 42 include_dirs = [ "interface" ] 43 } 44 static_library("nstackx_ctrl") { 45 sources = [ 46 "core/json_payload.c", 47 "core/mini_discover/coap_adapter.c", 48 "core/mini_discover/coap_app.c", 49 "core/mini_discover/coap_discover.c", 50 "core/nstackx_common.c", 51 "core/nstackx_database.c", 52 "core/nstackx_device.c", 53 "core/nstackx_dfinder_hidump.c", 54 "core/nstackx_dfinder_hievent.c", 55 "core/nstackx_dfinder_log.c", 56 "core/nstackx_statistics.c", 57 ] 58 include_dirs = [ 59 "include", 60 "include/mini_discover", 61 "//third_party/cJSON", 62 "../nstackx_util/interface", 63 "../nstackx_util/platform/liteos", 64 ] 65 defines = [ 66 "NSTACKX_WITH_LITEOS", 67 "LWIP_LITEOS_A_COMPAT", 68 "_GNU_SOURCE", 69 "DFINDER_USE_MINI_NSTACKX", 70 "DFINDER_SAVE_DEVICE_LIST", 71 "NSTACKX_WITH_LITEOS_M", 72 ] 73 public_configs = [ ":dfinder_interface" ] 74 deps = [ "../nstackx_util:nstackx_util.open" ] 75 if (board_toolchain_type != "iccarm") { 76 cflags += [ 77 "-Wall", 78 "-std=c99", 79 ] 80 cflags_cc = cflags 81 } else { 82 include_dirs += [ 83 "//kernel/liteos_m/components/net/lwip-2.1/porting/include", 84 "//third_party/lwip/src/include", 85 ] 86 cflags += [ 87 "--diag_suppress", 88 "Pa181", 89 ] 90 } 91 } 92 } else { 93 import("//build/lite/config/component/lite_component.gni") 94 config("dfinder_interface") { 95 include_dirs = [ "interface" ] 96 } 97 shared_library("nstackx_ctrl") { 98 sources = [ 99 "core/coap_discover/coap_app.c", 100 "core/coap_discover/coap_client.c", 101 "core/coap_discover/coap_discover.c", 102 "core/json_payload.c", 103 "core/nstackx_common.c", 104 "core/nstackx_database.c", 105 "core/nstackx_device.c", 106 "core/nstackx_dfinder_hidump.c", 107 "core/nstackx_dfinder_hievent.c", 108 "core/nstackx_dfinder_log.c", 109 "core/nstackx_dfinder_mgt_msg_log.c", 110 "core/nstackx_smartgenius.c", 111 "core/nstackx_statistics.c", 112 ] 113 ctrl_include = [ 114 "../nstackx_util/interface", 115 "interface", 116 "include", 117 "include/coap_discover", 118 "//third_party/libcoap/include", 119 "//third_party/cJSON", 120 ] 121 include_dirs += ctrl_include 122 public_configs = [ ":dfinder_interface" ] 123 deps = [ 124 "../nstackx_util:nstackx_util.open", 125 "//build/lite/config/component/cJSON:cjson_shared", 126 "//third_party/bounds_checking_function:libsec_shared", 127 "//third_party/libcoap:libcoap", 128 ] 129 if (ohos_kernel_type == "liteos_a") { 130 defines = [ 131 "NSTACKX_WITH_LITEOS", 132 "LWIP_LITEOS_A_COMPAT", 133 "DFINDER_SAVE_DEVICE_LIST", 134 ] 135 } else if (ohos_kernel_type == "linux") { 136 defines = [ "DFINDER_SAVE_DEVICE_LIST" ] 137 } 138 cflags += [ 139 "-fPIC", 140 "-std=c99", 141 "-DDFINDER_MGT_MSG_LOG", 142 ] 143 cflags_cc = cflags 144 ldflags = [ 145 "-Wl,-z,relro,-z,now", 146 "-s", 147 "-fPIC", 148 ] 149 } 150 } 151} else { 152 import("//build/ohos.gni") 153 154 config("dfinder_interface") { 155 include_dirs = [ "interface" ] 156 } 157 ohos_shared_library("nstackx_ctrl") { 158 cflags += [ "-DDFINDER_MGT_MSG_LOG" ] 159 cflags_cc = cflags 160 sources = [ 161 "core/coap_discover/coap_app.c", 162 "core/coap_discover/coap_client.c", 163 "core/coap_discover/coap_discover.c", 164 "core/json_payload.c", 165 "core/nstackx_common.c", 166 "core/nstackx_database.c", 167 "core/nstackx_device.c", 168 "core/nstackx_dfinder_hidump.c", 169 "core/nstackx_dfinder_hievent.c", 170 "core/nstackx_dfinder_log.c", 171 "core/nstackx_dfinder_mgt_msg_log.c", 172 "core/nstackx_smartgenius.c", 173 "core/nstackx_statistics.c", 174 ] 175 include_dirs += [ 176 "//third_party/bounds_checking_function/include", 177 "../nstackx_util/platform/unix", 178 ] 179 ctrl_include = [ 180 "../nstackx_util/interface", 181 "interface", 182 "include", 183 "include/coap_discover", 184 "//third_party/libcoap/include", 185 "//third_party/cJSON", 186 ] 187 include_dirs += ctrl_include 188 public_configs = [ ":dfinder_interface" ] 189 deps = [ 190 "../nstackx_util:nstackx_util.open", 191 "//third_party/bounds_checking_function:libsec_shared", 192 "//third_party/cJSON:cjson", 193 "//third_party/libcoap:libcoap", 194 ] 195 subsystem_name = "communication" 196 innerapi_tags = [ "platformsdk_indirect" ] 197 part_name = "dsoftbus" 198 } 199} 200