Skip to content

Commit

Permalink
RPC: Add linux light rpc to build script (#19719)
Browse files Browse the repository at this point in the history
Add a target for building the linux lighting app with
RPCs enabled.
  • Loading branch information
rgoliver authored and pull[bot] committed Jul 21, 2022
1 parent 6a16514 commit 1536836
Show file tree
Hide file tree
Showing 4 changed files with 35 additions and 3 deletions.
4 changes: 2 additions & 2 deletions examples/common/pigweed/rpc_services/Descriptor.h
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,7 @@ class Descriptor : public pw_rpc::nanopb::Descriptor::Service<Descriptor>
EndpointId endpoint_id = emberAfEndpointFromIndex(index);
if (endpoint_id == 0)
continue;
chip_rpc_Endpoint out{ endpoint : endpoint_id };
chip_rpc_Endpoint out{ .endpoint = endpoint_id };
writer.Write(out);
}
}
Expand All @@ -99,7 +99,7 @@ class Descriptor : public pw_rpc::nanopb::Descriptor::Service<Descriptor>
for (uint8_t cluster_index = 0; cluster_index < cluster_count; cluster_index++)
{
const EmberAfCluster * cluster = emberAfGetNthCluster(endpoint, cluster_index, server);
chip_rpc_Cluster out{ cluster_id : cluster->clusterId };
chip_rpc_Cluster out{ .cluster_id = cluster->clusterId };
writer.Write(out);
}
writer.Finish();
Expand Down
1 change: 1 addition & 0 deletions scripts/build/build/targets.py
Original file line number Diff line number Diff line change
Expand Up @@ -247,6 +247,7 @@ def HostTargets():
app_targets.append(target.Extend('thermostat', app=HostApp.THERMOSTAT))
app_targets.append(target.Extend('minmdns', app=HostApp.MIN_MDNS))
app_targets.append(target.Extend('light', app=HostApp.LIGHT))
app_targets.append(target.Extend('light-rpc', app=HostApp.LIGHT, enable_rpcs=True))
app_targets.append(target.Extend('lock', app=HostApp.LOCK))
app_targets.append(target.Extend('shell', app=HostApp.SHELL))
app_targets.append(target.Extend(
Expand Down
5 changes: 4 additions & 1 deletion scripts/build/builders/host.py
Original file line number Diff line number Diff line change
Expand Up @@ -195,7 +195,7 @@ class HostBuilder(GnBuilder):
def __init__(self, root, runner, app: HostApp, board=HostBoard.NATIVE, enable_ipv4=True,
enable_ble=True, enable_wifi=True, use_tsan=False, use_asan=False, separate_event_loop=True,
use_libfuzzer=False, use_clang=False, interactive_mode=True, extra_tests=False,
use_platform_mdns=False):
use_platform_mdns=False, enable_rpcs=False):
super(HostBuilder, self).__init__(
root=os.path.join(root, 'examples', app.ExamplePath()),
runner=runner)
Expand All @@ -204,6 +204,9 @@ def __init__(self, root, runner, app: HostApp, board=HostBoard.NATIVE, enable_ip
self.board = board
self.extra_gn_options = []

if enable_rpcs:
self.extra_gn_options.append('import("//with_pw_rpc.gni")')

if not enable_ipv4:
self.extra_gn_options.append('chip_inet_config_enable_ipv4=false')

Expand Down
28 changes: 28 additions & 0 deletions scripts/build/testdata/build_linux_on_x64.txt
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,16 @@ bash -c '
PKG_CONFIG_PATH="SYSROOT_AARCH64/lib/aarch64-linux-gnu/pkgconfig" \
gn gen --check --fail-on-unused-args --export-compile-commands --root={root}/examples/lighting-app/linux '"'"'--args=chip_inet_config_enable_ipv4=false target_cpu="arm64" is_clang=true chip_crypto="mbedtls" sysroot="SYSROOT_AARCH64"'"'"' {out}/linux-arm64-light-ipv6only'

# Generating linux-arm64-light-rpc
bash -c '
PKG_CONFIG_PATH="SYSROOT_AARCH64/lib/aarch64-linux-gnu/pkgconfig" \
gn gen --check --fail-on-unused-args --export-compile-commands --root={root}/examples/lighting-app/linux '"'"'--args=import("//with_pw_rpc.gni") target_cpu="arm64" is_clang=true chip_crypto="mbedtls" sysroot="SYSROOT_AARCH64"'"'"' {out}/linux-arm64-light-rpc'

# Generating linux-arm64-light-rpc-ipv6only
bash -c '
PKG_CONFIG_PATH="SYSROOT_AARCH64/lib/aarch64-linux-gnu/pkgconfig" \
gn gen --check --fail-on-unused-args --export-compile-commands --root={root}/examples/lighting-app/linux '"'"'--args=import("//with_pw_rpc.gni") chip_inet_config_enable_ipv4=false target_cpu="arm64" is_clang=true chip_crypto="mbedtls" sysroot="SYSROOT_AARCH64"'"'"' {out}/linux-arm64-light-rpc-ipv6only'

# Generating linux-arm64-lock
bash -c '
PKG_CONFIG_PATH="SYSROOT_AARCH64/lib/aarch64-linux-gnu/pkgconfig" \
Expand Down Expand Up @@ -173,6 +183,12 @@ gn gen --check --fail-on-unused-args --export-compile-commands --root={root}/exa
# Generating linux-x64-light-ipv6only
gn gen --check --fail-on-unused-args --export-compile-commands --root={root}/examples/lighting-app/linux --args=chip_inet_config_enable_ipv4=false {out}/linux-x64-light-ipv6only

# Generating linux-x64-light-rpc
gn gen --check --fail-on-unused-args --export-compile-commands --root={root}/examples/lighting-app/linux '--args=import("//with_pw_rpc.gni")' {out}/linux-x64-light-rpc

# Generating linux-x64-light-rpc-ipv6only
gn gen --check --fail-on-unused-args --export-compile-commands --root={root}/examples/lighting-app/linux '--args=import("//with_pw_rpc.gni") chip_inet_config_enable_ipv4=false' {out}/linux-x64-light-rpc-ipv6only

# Generating linux-x64-lock
gn gen --check --fail-on-unused-args --export-compile-commands --root={root}/examples/lock-app/linux {out}/linux-x64-lock

Expand Down Expand Up @@ -260,6 +276,12 @@ ninja -C {out}/linux-arm64-light
# Building linux-arm64-light-ipv6only
ninja -C {out}/linux-arm64-light-ipv6only

# Building linux-arm64-light-rpc
ninja -C {out}/linux-arm64-light-rpc

# Building linux-arm64-light-rpc-ipv6only
ninja -C {out}/linux-arm64-light-rpc-ipv6only

# Building linux-arm64-lock
ninja -C {out}/linux-arm64-lock

Expand Down Expand Up @@ -353,6 +375,12 @@ ninja -C {out}/linux-x64-light
# Building linux-x64-light-ipv6only
ninja -C {out}/linux-x64-light-ipv6only

# Building linux-x64-light-rpc
ninja -C {out}/linux-x64-light-rpc

# Building linux-x64-light-rpc-ipv6only
ninja -C {out}/linux-x64-light-rpc-ipv6only

# Building linux-x64-lock
ninja -C {out}/linux-x64-lock

Expand Down

0 comments on commit 1536836

Please sign in to comment.