#
# Copyright (c) 2024 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("iotc.gni")
import("adapter/adapter.gni")
import("core/core.gni")
import("sdk/sdk.gni")
iotc_inc = iotc_adapter_inc + iotc_core_inc + iotc_sdk_inc
iotc_src = iotc_adapter_src + iotc_core_src + iotc_sdk_src
iotc_def = iotc_adapter_def + iotc_core_def + iotc_sdk_def
iotc_dep = iotc_adapter_dep
iotc_inc += [
"$iotc_interface_path/kits/common",
"$iotc_interface_path/kits/oh_connect",
]
if (iotc_device_level == "mini") {
iotc_def += ["IOTC_CONF_DEVICE_LEVEL=0"]
iotc_def += ["IOTC_CONF_ADAPTER_SOCKET_LWIP_SUPPORT=1"]
} else if (iotc_device_level == "small") {
iotc_def += ["IOTC_CONF_DEVICE_LEVEL=1"]
} else {
iotc_def += ["IOTC_CONF_DEVICE_LEVEL=2"]
}
if (defined(ohos_lite)) {
import("//build/lite/config/component/lite_component.gni")
if (ohos_kernel_type == "liteos_m") {
if (ohos_build_type == "debug") {
iotc_def += ["IOTC_CONF_COAP_DEBUG_DUMP_PACKET=1"]
iotc_def += ["IOTC_CONF_BUILD_TYPE=1"]
iotc_def += ["IOT_CONF_LOG_DEFAULT_LEVEL=7"]
} else {
iotc_def += ["IOTC_CONF_LOG_BUILD_LEVEL=2"]
}
if(board_hi3863){
iotc_def += [
"HI3863_SDK_CONFIG_PATH=iotc",
]
}
static_library("iotc_static") {
sources = iotc_src
include_dirs = iotc_inc
defines = iotc_def
deps = iotc_dep
output_name = "iotc"
}
} else {
shared_library("iotc_stared") {
sources = iotc_src
include_dirs = iotc_inc
defines = iotc_def
deps = iotc_dep
output_name = "iotc"
}
}
} else {
import("//build/ohos.gni")
config("iotc_config") {
include_dirs = iotc_inc + [
"$iotc_interface_path/kits/common",
"$iotc_interface_path/kits/oh_connect",
]
if (iot_connect_sle_support) {
include_dirs += [
"//drivers/peripheral/nearlink/sle/ws73e/modules/sle/include/bsle/common",
"//drivers/peripheral/nearlink/sle/ws73e/modules/sle/include/bsle/sle",
]
}
cflags = [
"-Wall",
"-Werror",
"-fPIC",
]
cflags_cc = cflags
cflags += [ "-std=c99" ]
cflags_cc += [ "-std=c++17" ]
defines = iotc_def
}
ohos_shared_library("iotc_shared") {
sources = iotc_src
public_configs = [":iotc_config"]
deps = iotc_dep
deps += [
"//third_party/bounds_checking_function:libsec_shared",
"//third_party/mbedtls:mbedtls_shared",
"//third_party/cJSON:cjson",
]
if (iot_connect_sle_support) {
if (target_cpu == "arm") {
libs = [
"//drivers/peripheral/nearlink/sle/ws73e/modules/sle/application/lib/35xx/libsle_host_arm32.a",
]
} else if (target_cpu == "arm64") {
libs = [
"//drivers/peripheral/nearlink/sle/ws73e/modules/sle/application/lib/35xx/libsle_host_aarch64.a",
]
}
}
external_deps = [
"wifi:wifi_sdk",
"bluetooth:btframework",
"hilog:libhilog",
]
subsystem_name = "communication"
part_name = "iot_connect"
}
}