blob: 3cc14c4ee08e56a86c67bd54556dc8903e097961 [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 == "cc13x2_26x2" || lwip_platform == "efr32" ||
lwip_platform == "k32w0" || lwip_platform == "qpg" ||
lwip_platform == "mbed" || lwip_platform == "p6" ||
lwip_platform == "cyw30739" || lwip_platform == "bl602",
"Unsupported lwIP platform: ${lwip_platform}")
if (lwip_platform != "external") {
declare_args() {
# Enable lwIP debugging.
lwip_debug = is_debug
}
}
if (lwip_platform == "cc13x2_26x2") {
import("//build_overrides/ti_simplelink_sdk.gni")
} else if (lwip_platform == "efr32") {
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 == "p6") {
import("//build_overrides/p6.gni")
} else if (lwip_platform == "cyw30739") {
import("//build_overrides/cyw30739_sdk.gni")
} else if (lwip_platform == "bl602") {
import("//build_overrides/bl602_sdk.gni")
}
buildconfig_header("lwip_buildconfig") {
header = "lwip_buildconfig.h"
header_dir = "lwip"
defines = [ "HAVE_LWIP_UDP_BIND_NETIF=1" ]
if (lwip_platform != "external") {
if (is_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") {
group("lwip") {
public_deps = [ ":lwip_buildconfig" ]
}
group("all") {
deps = [ ":lwip" ]
}
} else if (lwip_platform == "p6") {
group("lwip") {
public_deps = [ ":lwip_buildconfig" ]
public_configs = [ "${chip_root}/src:includes" ]
public_configs += [ "${p6_sdk_build_root}:p6_sdk_config" ]
}
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 += [ "${bl602_sdk_build_root}:bl602_sdk" ]
}
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 {
public += [
"${lwip_platform}/lwippools.h",
"freertos/arch/sys_arch.h",
]
sources += [ "freertos/sys_arch.c" ]
}
public_deps = [ ":lwip_buildconfig" ]
if (lwip_platform == "cc13x2_26x2") {
public_deps += [ "${ti_simplelink_sdk_build_root}:ti_simplelink_sdk" ]
} else if (lwip_platform == "efr32") {
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 += [ "${bl602_sdk_build_root}:bl602_sdk" ]
}
public_configs = [
":lwip_config",
"${chip_root}/src:includes",
]
}
}