Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Restyle Add Matter client example for webOS OSE #13293

Closed
wants to merge 20 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
20 commits
Select commit Hold shift + click to select a range
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 8 additions & 2 deletions BUILD.gn
Original file line number Diff line number Diff line change
Expand Up @@ -133,7 +133,10 @@ if (current_toolchain != "${dir_pw_toolchain}/default:default") {

if (chip_build_tools) {
group("certification") {
data_deps = [ "${chip_root}/examples/chip-tool" ]
data_deps = [
"${chip_root}/examples/chip-tool",
"${chip_root}/examples/chip-tool-webos",
]

if (chip_enable_python_modules) {
if (enable_pylib) {
Expand Down Expand Up @@ -319,7 +322,10 @@ if (current_toolchain != "${dir_pw_toolchain}/default:default") {

if (enable_standalone_chip_tool_build) {
group("standalone_chip_tool") {
deps = [ "${chip_root}/examples/chip-tool(${standalone_toolchain})" ]
deps = [
"${chip_root}/examples/chip-tool(${standalone_toolchain})",
"${chip_root}/examples/chip-tool-webos(${standalone_toolchain})",
]
}
}

Expand Down
13 changes: 13 additions & 0 deletions build/config/BUILDCONFIG.gn
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,11 @@ if (current_os == "") {
current_os = target_os
}

#[webos] if target_os is webos, set current_os as linux.
if (target_os == "webos") {
current_os = "linux"
}

_build_overrides = {
import("//build_overrides/build.gni")
}
Expand Down Expand Up @@ -99,6 +104,14 @@ if (_chip_defaults.custom_toolchain != "") {
} else if (target_os == "tizen") {
_default_toolchain =
"${_build_overrides.build_root}/toolchain/tizen:tizen_${target_cpu}"
} else if (target_os == "webos") {
if (target_cpu == "arm" || target_cpu == "arm64") {
print("target_os = webos / target_cpu = ${target_cpu}")
_default_toolchain = "//build/toolchain/webos"
} else {
assert(false,
"Unsupported target_cpu: ${current_cpu}. Shall be arm for webOS")
}
} else {
assert(false, "No toolchain specified, please specify custom_toolchain")
}
Expand Down
5 changes: 4 additions & 1 deletion build/config/compiler/BUILD.gn
Original file line number Diff line number Diff line change
Expand Up @@ -201,9 +201,12 @@ config("strict_warnings") {
"-Wextra",
"-Wshadow",
"-Wunreachable-code",
"-Wvla",
]

if (target_os == "webos") {
cflags -= [ "-Wshadow" ]
}

cflags_cc = [ "-Wnon-virtual-dtor" ]

ldflags = []
Expand Down
9 changes: 9 additions & 0 deletions build/config/linux/avahi-client.pc
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
prefix=@prefix@
exec_prefix=${prefix}
libdir=@libdir@
includedir=${prefix}/include
Name: avahi-client
Description: Avahi Multicast DNS Responder (Client Support)
Version: @PACKAGE_VERSION@
Libs: -L${libdir} -lavahi-common -lavahi-client
Cflags: -D_REENTRANT -I${includedir}
3 changes: 3 additions & 0 deletions build/config/linux/pkg-config.py
Original file line number Diff line number Diff line change
Expand Up @@ -143,6 +143,8 @@ def main():
dest='version_as_components')
(options, args) = parser.parse_args()

options.sysroot = os.environ['PKG_CONFIG_SYSROOT_DIR']

# Make a list of regular expressions to strip out.
strip_out = []
if options.strip_out != None:
Expand All @@ -154,6 +156,7 @@ def main():
if options.debug:
sys.stderr.write('PKG_CONFIG_LIBDIR=%s\n' % libdir)
prefix = GetPkgConfigPrefixToStrip(options, args)

else:
prefix = ''

Expand Down
14 changes: 14 additions & 0 deletions build/config/target.gni
Original file line number Diff line number Diff line change
Expand Up @@ -19,4 +19,18 @@ declare_args() {
target_cflags_cc = []
target_cflags_c = []
target_ldflags = []
sysroot_webos = ""
}

#[webos] build for webos flag [START]
if (target_os == "webos") {
if (target_cpu == "arm" || target_cpu == "arm64") {
print("(target.gni) include webos/arm flag")
target_defines += []
target_cflags += [ "--sysroot=" + sysroot_webos ]
target_cflags_cc += []
target_cflags_c += []
target_ldflags += [ "--sysroot=" + sysroot_webos ]
}
}
#[webos] build for webos flag [END]
25 changes: 25 additions & 0 deletions build/toolchain/webos/BUILD.gn
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
# Copyright 2020 The Pigweed Authors
# 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("webos_toolchain.gni")

print(target_os)

webos_toolchain("webos") {
toolchain_args = {
target_os = "linux"
target_cpu = "${current_cpu}"
}
}
37 changes: 37 additions & 0 deletions build/toolchain/webos/webos_toolchain.gni
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
# 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() {
cc_webos = ""
cxx_webos = ""
ar_webos = ""
ld_webos = ""
}

import("//build/toolchain/gcc_toolchain.gni")

template("webos_toolchain") {
print("WebOS_ToolChian")
gcc_toolchain(target_name) {
ar = ar_webos
cc = cc_webos + " -O2 -Wno-format-security -Wno-error -Wno-cpp"
cxx = cxx_webos + " -O2 -Wno-format-security -Wno-error -Wno-cpp"
toolchain_args = {
current_cpu = "${current_cpu}"
current_os = invoker.current_os
is_clang = false
forward_variables_from(invoker.toolchain_args, "*")
}
}
}
25 changes: 25 additions & 0 deletions examples/chip-tool-webos/.gn
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
# 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")

# The location of the build configuration file.
buildconfig = "${build_root}/config/BUILDCONFIG.gn"

# CHIP uses angle bracket includes.
check_system_includes = true

default_args = {
import("//args.gni")
}
98 changes: 98 additions & 0 deletions examples/chip-tool-webos/BUILD.gn
Original file line number Diff line number Diff line change
@@ -0,0 +1,98 @@
# 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("${chip_root}/build/chip/tools.gni")
import("${chip_root}/src/lib/core/core.gni")

assert(chip_build_tools)

declare_args() {
# Use a separate eventloop for CHIP tasks
config_use_separate_eventloop_webos = true
}

executable("chip-tool-webos") {
sources = [
"commands/clusters/ModelCommand.cpp",
"commands/common/CHIPCommand.cpp",
"commands/common/CHIPCommand.h",
"commands/common/Command.cpp",
"commands/common/CommandInvoker.h",
"commands/common/Commands.cpp",
"commands/discover/DiscoverCommand.cpp",
"commands/discover/DiscoverCommissionablesCommand.cpp",
"commands/discover/DiscoverCommissionersCommand.cpp",

# TODO - enable CommissionedListCommand once DNS Cache is implemented
# "commands/pairing/CommissionedListCommand.cpp",
# "commands/pairing/CommissionedListCommand.h",
"commands/pairing/OpenCommissioningWindowCommand.cpp",
"commands/pairing/OpenCommissioningWindowCommand.h",
"commands/pairing/PairingCommand.cpp",
"commands/payload/AdditionalDataParseCommand.cpp",
"commands/payload/SetupPayloadParseCommand.cpp",
"commands/payload/SetupPayloadVerhoeff.cpp",
"commands/tests/TestCommand.cpp",
"config/PersistentStorage.cpp",
"webos/src/clientwatch.cpp",
"webos/src/lsutils.cpp",
"webos/src/main.cpp",
"webos/src/mattermanagerservice.cpp",
]

defines =
[ "CONFIG_USE_SEPARATE_EVENTLOOP=${config_use_separate_eventloop_webos}" ]
defines += [ "CHIP_TOOL_MODE=false" ]

deps = [
"${chip_root}/src/app/server",
"${chip_root}/src/app/server",
"${chip_root}/src/app/tests/suites/pics",
"${chip_root}/src/controller/data_model",
"${chip_root}/src/lib",
"${chip_root}/src/platform",
"${chip_root}/third_party/inipp",
]

cflags = [ "-Wconversion" ]

cflags_cc = [ "-fexceptions" ]

include_dirs = [
".",
"./webos/src",
"${chip_root}/zzz_generated/chip-tool",
"${chip_root}/src/lib",
"/home/worker/tv_reference/build-starfish/BUILD/work/o20-starfishmllib32-linux-gnueabi/lib32-chip/1.0-r0/lib32-recipe-sysroot/usr/include",
]

if (chip_enable_transport_trace) {
deps += [ "${chip_root}/examples/common/tracing:trace_handlers" ]
}

output_dir = root_out_dir

libs = [
"luna-service2",
"pbnjson_cpp",
"PmLogLib",
]
}

group("default") {
deps = [ ":chip-tool-webos" ]
}
23 changes: 23 additions & 0 deletions examples/chip-tool-webos/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
#
# Copyright (c) 2020-2021 Project CHIP Authors
# All rights reserved.
#
# 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.
#

FROM connectedhomeip/chip-cirque-device-base:latest

COPY out/debug/chip-tool /usr/bin/
COPY entrypoint.sh /

ENTRYPOINT ["/entrypoint.sh", "tool"]
Loading