Skip to content

Commit

Permalink
Allow building CHIP without lwip checked out (#2683)
Browse files Browse the repository at this point in the history
* Allow building CHIP without lwip checked out

This used to work prior to #2325, which added an unconditional
dependency on lwip even if we're using sockets. Make it conditional.

* Fix typo
  • Loading branch information
mspang authored Sep 17, 2020
1 parent 276e4e2 commit b7dd656
Show file tree
Hide file tree
Showing 6 changed files with 39 additions and 7 deletions.
10 changes: 6 additions & 4 deletions src/BUILD.gn
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@
import("//build_overrides/chip.gni")

import("${chip_root}/gn/chip/tests.gni")
import("${chip_root}/src/lwip/lwip.gni")

config("includes") {
include_dirs = [
Expand Down Expand Up @@ -46,11 +47,12 @@ if (chip_build_tests) {
"${chip_root}/src/transport/tests",
]

if (chip_with_lwip) {
deps += [ "${chip_root}/src/lwip/tests" ]
}

if (current_os != "zephyr") {
deps += [
"${chip_root}/src/lib/shell/tests",
"${chip_root}/src/lwip/tests",
]
deps += [ "${chip_root}/src/lib/shell/tests" ]
}
}
}
6 changes: 5 additions & 1 deletion src/inet/BUILD.gn
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ import("//build_overrides/nlio.gni")

import("${chip_root}/gn/chip/buildconfig_header.gni")
import("${chip_root}/gn/chip/tests.gni")
import("${chip_root}/src/lwip/lwip.gni")
import("${chip_root}/src/platform/device.gni")
import("inet.gni")

Expand Down Expand Up @@ -97,11 +98,14 @@ static_library("inet") {
public_deps = [
":inet_config_header",
"${chip_root}/src/lib/support",
"${chip_root}/src/lwip",
"${chip_root}/src/system",
"${nlio_root}:nlio",
]

if (chip_with_lwip) {
public_deps += [ "${chip_root}/src/lwip" ]
}

if (chip_inet_config_enable_raw_endpoint) {
sources += [
"RawEndPoint.cpp",
Expand Down
3 changes: 3 additions & 0 deletions src/lwip/BUILD.gn
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,11 @@ import("//build_overrides/chip.gni")
import("//build_overrides/lwip.gni")

import("${chip_root}/gn/chip/buildconfig_header.gni")
import("${chip_root}/src/lwip/lwip.gni")
import("${lwip_root}/lwip.gni")

assert(chip_with_lwip)

declare_args() {
# lwIP platform: standalone, freertos.
lwip_platform = ""
Expand Down
18 changes: 18 additions & 0 deletions src/lwip/lwip.gni
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
# 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.

declare_args() {
# Have the lwIP library available.
chip_with_lwip = current_os != "zephyr"
}
3 changes: 2 additions & 1 deletion src/lwip/tests/BUILD.gn
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,9 @@ import("//build_overrides/chip.gni")

import("${chip_root}/gn/chip/chip_test.gni")
import("${chip_root}/gn/chip/chip_test_group.gni")
import("${chip_root}/src/lwip/lwip.gni")

assert(current_os != "zephyr")
assert(chip_with_lwip)

chip_test("TestLwIP") {
sources = [ "tests.c" ]
Expand Down
6 changes: 5 additions & 1 deletion src/system/system.gni
Original file line number Diff line number Diff line change
Expand Up @@ -12,9 +12,13 @@
# See the License for the specific language governing permissions and
# limitations under the License.

import("//build_overrides/chip.gni")

import("${chip_root}/src/lwip/lwip.gni")

declare_args() {
# Use the lwIP library.
chip_system_config_use_lwip = current_os == "freertos"
chip_system_config_use_lwip = chip_with_lwip && current_os == "freertos"

# Use BSD/POSIX socket API.
chip_system_config_use_sockets = current_os != "freertos"
Expand Down

0 comments on commit b7dd656

Please sign in to comment.