[gn] fix OpenThread build with -Wundef (#5436)

Always define all of OPENTHREAD_{FTD,MTD,RADIO} and add a define for
OPENTHREAD_POSIX.
This commit is contained in:
Michael Spang
2020-08-21 08:43:02 -07:00
committed by GitHub
parent c73320ff3e
commit d20a8951fe
3 changed files with 32 additions and 3 deletions
+16 -3
View File
@@ -28,6 +28,7 @@
import("etc/gn/openthread.gni")
config("openthread_config") {
defines = []
if (openthread_config_file != "") {
defines += [ "OPENTHREAD_CONFIG_FILE=${openthread_config_file}" ]
}
@@ -41,15 +42,27 @@ config("openthread_config") {
}
config("openthread_ftd_config") {
defines = [ "OPENTHREAD_FTD=1" ]
defines = [
"OPENTHREAD_FTD=1",
"OPENTHREAD_MTD=0",
"OPENTHREAD_RADIO=0",
]
}
config("openthread_mtd_config") {
defines = [ "OPENTHREAD_MTD=1" ]
defines = [
"OPENTHREAD_MTD=1",
"OPENTHREAD_FTD=0",
"OPENTHREAD_RADIO=0",
]
}
config("openthread_radio_config") {
defines = [ "OPENTHREAD_RADIO=1" ]
defines = [
"OPENTHREAD_RADIO=1",
"OPENTHREAD_FTD=0",
"OPENTHREAD_MTD=0",
]
}
group("libopenthread-ftd") {
+3
View File
@@ -55,6 +55,9 @@ declare_args() {
# Use external mbedtls. If blank, internal mbedtls will be used.
openthread_external_mbedtls = ""
# Enable building for POSIX platforms.
openthread_posix = current_os == "linux"
# Package name for OpenThread.
openthread_package_name = "OPENTHREAD"
+13
View File
@@ -25,6 +25,8 @@
# POSSIBILITY OF SUCH DAMAGE.
#
import("../../etc/gn/openthread.gni")
openthread_cli_sources = [
"cli.cpp",
"cli.hpp",
@@ -48,14 +50,25 @@ openthread_cli_sources = [
"x509_cert_key.hpp",
]
config("cli_config") {
defines = []
if (openthread_posix) {
defines += ["OPENTHREAD_POSIX=1"]
} else {
defines += ["OPENTHREAD_POSIX=0"]
}
}
static_library("libopenthread-cli-ftd") {
sources = openthread_cli_sources
public_deps = [ "../core:libopenthread-ftd" ]
public_configs = [":cli_config"]
visibility = [ "../../*" ]
}
static_library("libopenthread-cli-mtd") {
sources = openthread_cli_sources
public_deps = [ "../core:libopenthread-mtd" ]
public_configs = [":cli_config"]
visibility = [ "../../*" ]
}