blob: be41fd44d181e49943fb42bab651935d58c740d8 [file] [log] [blame]
# Copyright (c) 2020 Project CHIP Authors
#
# 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("//build_overrides/build.gni")
import("//build_overrides/chip.gni")
import("//build_overrides/lwip.gni")
import("${chip_root}/build/chip/buildconfig_header.gni")
import("${chip_root}/src/lwip/lwip.gni")
import("${lwip_root}/lwip.gni")
assert(chip_with_lwip)
if (lwip_platform == "") {
if (current_os != "freertos") {
lwip_platform = "standalone"
}
}
assert(lwip_platform == "external" || lwip_platform == "standalone" ||
lwip_platform == "cc13xx_26xx" || lwip_platform == "cc32xx" ||
lwip_platform == "silabs" || lwip_platform == "k32w0" ||
lwip_platform == "qpg" || lwip_platform == "mbed" ||
lwip_platform == "psoc6" || lwip_platform == "cyw30739" ||
lwip_platform == "bl602" || lwip_platform == "mw320" ||
lwip_platform == "bl702" || lwip_platform == "mt793x" ||
lwip_platform == "asr",
"Unsupported lwIP platform: ${lwip_platform}")
if (lwip_platform != "external") {
declare_args() {
# Enable lwIP debugging.
lwip_debug = is_debug
}
}
if (lwip_platform == "cc13xx_26xx") {
import("//build_overrides/ti_simplelink_sdk.gni")
} else if (lwip_platform == "cc32xx") {
import("//build_overrides/ti_simplelink_sdk.gni")
} else if (lwip_platform == "silabs") {
import("//build_overrides/efr32_sdk.gni")
} else if (lwip_platform == "qpg") {
import("//build_overrides/qpg_sdk.gni")
import("${qpg_sdk_build_root}/qpg_sdk.gni")
} else if (lwip_platform == "k32w0") {
import("//build_overrides/k32w0_sdk.gni")
} else if (lwip_platform == "psoc6") {
import("//build_overrides/psoc6.gni")
} else if (lwip_platform == "cyw30739") {
import("//build_overrides/cyw30739_sdk.gni")
} else if (lwip_platform == "bl602") {
import("//build_overrides/bouffalolab_iot_sdk.gni")
} else if (lwip_platform == "bl702") {
import("//build_overrides/bouffalolab_iot_sdk.gni")
} else if (lwip_platform == "mw320") {
import("//build_overrides/mw320_sdk.gni")
} else if (lwip_platform == "mt793x") {
import("//build_overrides/mt793x_sdk.gni")
} else if (lwip_platform == "asr") {
import("//build_overrides/asr.gni")
}
buildconfig_header("lwip_buildconfig") {
header = "lwip_buildconfig.h"
header_dir = "lwip"
defines = [ "HAVE_LWIP_UDP_BIND_NETIF=1" ]
if (lwip_platform != "external") {
if (lwip_debug) {
# Automatically enable LWIP_DEBUG for internal is_debug builds.
defines += [ "LWIP_DEBUG=1" ]
}
if (current_os == "android") {
defines += [ "LWIP_NO_STDINT_H=1" ]
}
}
}
if (current_os == "zephyr" || current_os == "mbed") {
group("lwip") {
}
} else if (lwip_platform == "external" || lwip_platform == "mw320") {
group("lwip") {
public_deps = [ ":lwip_buildconfig" ]
if (lwip_platform == "mw320") {
public_deps += [ "${mw320_sdk_build_root}:mw320_sdk" ]
}
}
group("all") {
deps = [ ":lwip" ]
}
} else if (lwip_platform == "psoc6") {
group("lwip") {
public_deps = [ ":lwip_buildconfig" ]
public_configs = [ "${chip_root}/src:includes" ]
public_configs += [ "${psoc6_sdk_build_root}:psoc6_sdk_config" ]
}
} else if (lwip_platform == "bl702_lwip") {
import("${bouffalolab_iot_sdk_build_root}/bl702/bl_iot_sdk.gni")
group("lwip") {
public_deps = [ ":lwip_buildconfig" ]
public_deps += [ "${bouffalolab_iot_sdk_build_root}/bl702:bl_iot_sdk" ]
}
group("all") {
deps = [ ":lwip" ]
}
} else if (lwip_platform == "qpg") {
config("lwip_config") {
include_dirs = [ "freertos" ]
}
lwip_target("lwip") {
public = [
"${qpg_sdk_root}/Components/ThirdParty/Lwip/arch/cc.h",
"${qpg_sdk_root}/Components/ThirdParty/Lwip/arch/perf.h",
"${qpg_sdk_root}/Components/ThirdParty/Lwip/lwipopts.h",
"${qpg_sdk_root}/Components/ThirdParty/Lwip/lwippools.h",
"freertos/arch/sys_arch.h",
]
sources = [ "${qpg_sdk_root}/Components/ThirdParty/Lwip/sys_arch.c" ]
public_deps = [ ":lwip_buildconfig" ]
public_deps += [ "${qpg_sdk_build_root}:qpg_sdk" ]
public_configs = [
":lwip_config",
"${chip_root}/src:includes",
]
}
} else if (lwip_platform == "bl602") {
group("lwip") {
public_deps = [ ":lwip_buildconfig" ]
public_deps += [ "${bouffalolab_iot_sdk_build_root}/bl602:bl_iot_sdk" ]
}
group("all") {
deps = [ ":lwip" ]
}
} else if (lwip_platform == "asr") {
group("lwip") {
public_deps = [ ":lwip_buildconfig" ]
public_configs = [ "${chip_root}/src:includes" ]
public_configs += [ "${asr_sdk_build_root}:asr_sdk_config" ]
}
group("all") {
deps = [ ":lwip" ]
}
} else {
config("lwip_config") {
include_dirs = [ lwip_platform ]
if (lwip_platform != "standalone" && lwip_platform != "mbed") {
include_dirs += [ "freertos" ]
}
}
lwip_target("lwip") {
public = [
"${lwip_platform}/arch/cc.h",
"${lwip_platform}/arch/perf.h",
"${lwip_platform}/lwipopts.h",
]
sources = []
if (lwip_platform == "standalone") {
public += [ "standalone/arch/sys_arch.h" ]
sources += [ "standalone/sys_arch.c" ]
} else if (lwip_platform == "cyw30739") {
} else if (lwip_platform == "mt793x") {
} else {
public += [
"${lwip_platform}/lwippools.h",
"freertos/arch/sys_arch.h",
]
sources += [ "freertos/sys_arch.c" ]
}
public_deps = [ ":lwip_buildconfig" ]
if (lwip_platform == "cc13xx_26xx") {
public_deps += [ "${ti_simplelink_sdk_build_root}:ti_simplelink_sdk" ]
} else if (lwip_platform == "cc32xx") {
public_deps += [ "${ti_simplelink_sdk_build_root}:ti_simplelink_sdk" ]
sources +=
[ "${chip_root}/third_party/lwip/repo/lwip/src/apps/mdns/mdns.c" ]
} else if (lwip_platform == "silabs") {
public_deps += [ "${efr32_sdk_build_root}:efr32_sdk" ]
} else if (lwip_platform == "standalone") {
public_deps += [ "${chip_root}/src/lib/support" ]
} else if (lwip_platform == "k32w0") {
public_deps += [ "${k32w0_sdk_build_root}:k32w0_sdk" ]
} else if (lwip_platform == "cyw30739") {
public_deps += [ "${cyw30739_sdk_build_root}:cyw30739_sdk" ]
} else if (lwip_platform == "bl602") {
public_deps += [ "${bouffalolab_iot_sdk_build_root}/bl602:bl602_sdk" ]
} else if (lwip_platform == "bl702") {
public_deps += [ "${bouffalolab_iot_sdk_build_root}/bl702:bl_iot_sdk" ]
} else if (lwip_platform == "mt793x") {
public_deps += [ "${mt793x_sdk_build_root}:mt793x_sdk" ]
}
public_configs = [
":lwip_config",
"${chip_root}/src:includes",
]
}
}