# 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") NSTACKX_ROOT = "//foundation/communication/dsoftbus/components/nstackx" if (defined(ohos_lite)) { import("//build/lite/config/component/lite_component.gni") if (ohos_kernel_type == "liteos_a") { config("nstackx_util_header") { include_dirs = [ "interface", "platform/liteos", ] } } else if (ohos_kernel_type == "linux") { config("nstackx_util_header") { include_dirs = [ "interface", "platform/unix", ] } } shared_library("nstackx_util.open") { if (ohos_kernel_type == "liteos_a") { cflags = [ "-Wall", "-D_GNU_SOURCE", "-DNSTACKX_WITH_LITEOS", "-DLWIP_DONT_PROVIDE_BYTEORDER_FUNCTIONS", "-DLWIP_LITEOS_A_COMPAT", "-DMBEDTLS_INCLUDED", ] cflags_cc = cflags include_dirs = [ "include", "interface", "platform/liteos", "$NSTACKX_ROOT/nstackx_core/", "//third_party/bounds_checking_function/include/", ] sources = [ "core/nstackx_dev.c", "core/nstackx_event.c", "core/nstackx_log.c", "core/nstackx_mbedtls.c", "core/nstackx_socket.c", "core/nstackx_timer.c", "core/nstackx_util.c", "platform/liteos/sys_dev.c", "platform/liteos/sys_epoll.c", "platform/liteos/sys_event.c", "platform/liteos/sys_log.c", "platform/liteos/sys_socket.c", "platform/liteos/sys_timer.c", "platform/liteos/sys_util.c", ] deps = [ "//third_party/mbedtls" ] } else if (ohos_kernel_type == "linux") { cflags = [ "-Wall", "-DNSTACKX_WITH_HMOS_LINUX", "-DMBEDTLS_INCLUDED", ] cflags_cc = cflags include_dirs = [ "include", "interface", "platform/unix", "$NSTACKX_ROOT/nstackx_core/", "//third_party/bounds_checking_function/include/", ] sources = [ "core/nstackx_dev.c", "core/nstackx_event.c", "core/nstackx_log.c", "core/nstackx_mbedtls.c", "core/nstackx_socket.c", "core/nstackx_timer.c", "core/nstackx_util.c", "platform/unix/sys_dev.c", "platform/unix/sys_epoll.c", "platform/unix/sys_event.c", "platform/unix/sys_log.c", "platform/unix/sys_socket.c", "platform/unix/sys_timer.c", "platform/unix/sys_util.c", ] deps = [ "//third_party/mbedtls", "//third_party/mbedtls:mbedtls_shared", ] } public_configs = [ ":nstackx_util_header" ] } } else { import("//build/ohos.gni") config("nstackx_util_header") { include_dirs = [ "interface", "platform/unix", ] } ohos_shared_library("nstackx_util.open") { cflags = [ "-Wall", "-DMBEDTLS_INCLUDED", "-DNSTACKX_WITH_HMOS_LINUX", ] cflags_cc = cflags include_dirs = [ "include", "interface", "platform/unix", "$NSTACKX_ROOT/nstackx_core/", "//utils/native/base/include/", ] sources = [ "core/nstackx_dev.c", "core/nstackx_event.c", "core/nstackx_log.c", "core/nstackx_mbedtls.c", "core/nstackx_socket.c", "core/nstackx_timer.c", "core/nstackx_util.c", "platform/unix/sys_dev.c", "platform/unix/sys_epoll.c", "platform/unix/sys_event.c", "platform/unix/sys_log.c", "platform/unix/sys_socket.c", "platform/unix/sys_timer.c", "platform/unix/sys_util.c", ] deps = [ "//third_party/mbedtls", "//utils/native/base:utilsecurec_shared", ] public_configs = [ ":nstackx_util_header" ] part_name = "dsoftbus_standard" subsystem_name = "communication" } }