# Copyright (c) 2021 Huawei Device Co., Ltd. # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, software # distributed under the License is distributed on an "AS IS" BASIS, # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. # See the License for the specific language governing permissions and # limitations under the License. import("//foundation/communication/dsoftbus/dsoftbus.gni") cflags = [ "-DENABLE_USER_LOG", "-DDFINDER_SAVE_DEVICE_LIST", "-DNSTACKX_EXTEND_BUSINESSDATA", "-DNSTACKX_DFINDER_HIDUMP", ] if (defined(board_toolchain_type)) { if (board_toolchain_type != "iccarm") { cflags += [ "-Wall" ] } } else { cflags += [ "-Wall" ] } include_dirs = [] if (dsoftbus_standard_feature_dfinder_support_multi_nif) { cflags += [ "-DDFINDER_SUPPORT_MULTI_NIF" ] } if (defined(ohos_lite)) { if (ohos_kernel_type == "liteos_m") { import("//build/lite/config/component/lite_component.gni") config("dfinder_interface") { include_dirs = [ "interface" ] } static_library("nstackx_ctrl") { sources = [ "core/json_payload.c", "core/mini_discover/coap_adapter.c", "core/mini_discover/coap_app.c", "core/mini_discover/coap_discover.c", "core/nstackx_common.c", "core/nstackx_database.c", "core/nstackx_device.c", "core/nstackx_dfinder_hidump.c", "core/nstackx_dfinder_hievent.c", "core/nstackx_dfinder_log.c", "core/nstackx_statistics.c", ] include_dirs = [ "include", "include/mini_discover", "//third_party/cJSON", "../nstackx_util/interface", "../nstackx_util/platform/liteos", ] defines = [ "NSTACKX_WITH_LITEOS", "LWIP_LITEOS_A_COMPAT", "_GNU_SOURCE", "DFINDER_USE_MINI_NSTACKX", "DFINDER_SAVE_DEVICE_LIST", "NSTACKX_WITH_LITEOS_M", ] public_configs = [ ":dfinder_interface" ] deps = [ "../nstackx_util:nstackx_util.open" ] if (board_toolchain_type != "iccarm") { cflags += [ "-Wall", "-std=c99", ] cflags_cc = cflags } else { include_dirs += [ "//kernel/liteos_m/components/net/lwip-2.1/porting/include", "//third_party/lwip/src/include", ] cflags += [ "--diag_suppress", "Pa181", ] } } } else { import("//build/lite/config/component/lite_component.gni") config("dfinder_interface") { include_dirs = [ "interface" ] } shared_library("nstackx_ctrl") { sources = [ "core/coap_discover/coap_app.c", "core/coap_discover/coap_client.c", "core/coap_discover/coap_discover.c", "core/json_payload.c", "core/nstackx_common.c", "core/nstackx_database.c", "core/nstackx_device.c", "core/nstackx_dfinder_hidump.c", "core/nstackx_dfinder_hievent.c", "core/nstackx_dfinder_log.c", "core/nstackx_dfinder_mgt_msg_log.c", "core/nstackx_smartgenius.c", "core/nstackx_statistics.c", ] ctrl_include = [ "../nstackx_util/interface", "interface", "include", "include/coap_discover", "//third_party/libcoap/include", "//third_party/cJSON", ] include_dirs += ctrl_include public_configs = [ ":dfinder_interface" ] deps = [ "../nstackx_util:nstackx_util.open", "//build/lite/config/component/cJSON:cjson_shared", "//third_party/bounds_checking_function:libsec_shared", "//third_party/libcoap:libcoap", ] if (ohos_kernel_type == "liteos_a") { defines = [ "NSTACKX_WITH_LITEOS", "LWIP_LITEOS_A_COMPAT", "DFINDER_SAVE_DEVICE_LIST", ] } else if (ohos_kernel_type == "linux") { defines = [ "DFINDER_SAVE_DEVICE_LIST" ] } cflags += [ "-fPIC", "-std=c99", "-DDFINDER_MGT_MSG_LOG", ] cflags_cc = cflags ldflags = [ "-Wl,-z,relro,-z,now", "-s", "-fPIC", ] } } } else { import("//build/ohos.gni") config("dfinder_interface") { include_dirs = [ "interface" ] } ohos_shared_library("nstackx_ctrl") { cflags += [ "-DDFINDER_MGT_MSG_LOG" ] cflags_cc = cflags sources = [ "core/coap_discover/coap_app.c", "core/coap_discover/coap_client.c", "core/coap_discover/coap_discover.c", "core/json_payload.c", "core/nstackx_common.c", "core/nstackx_database.c", "core/nstackx_device.c", "core/nstackx_dfinder_hidump.c", "core/nstackx_dfinder_hievent.c", "core/nstackx_dfinder_log.c", "core/nstackx_dfinder_mgt_msg_log.c", "core/nstackx_smartgenius.c", "core/nstackx_statistics.c", ] include_dirs += [ "//third_party/bounds_checking_function/include", "../nstackx_util/platform/unix", ] ctrl_include = [ "../nstackx_util/interface", "interface", "include", "include/coap_discover", "//third_party/libcoap/include", "//third_party/cJSON", ] include_dirs += ctrl_include public_configs = [ ":dfinder_interface" ] deps = [ "../nstackx_util:nstackx_util.open", "//third_party/bounds_checking_function:libsec_shared", "//third_party/cJSON:cjson", "//third_party/libcoap:libcoap", ] subsystem_name = "communication" part_name = "dsoftbus" } }