Skip to content

Commit

Permalink
Add a way to disable openthread in build_examples.py
Browse files Browse the repository at this point in the history
This enables a build that has no runtime dependencies other than libc:

 0x0000000000000001 (NEEDED)             Shared library: [libdl.so.2]
 0x0000000000000001 (NEEDED)             Shared library: [libpthread.so.0]
 0x0000000000000001 (NEEDED)             Shared library: [librt.so.1]
 0x0000000000000001 (NEEDED)             Shared library: [libm.so.6]
 0x0000000000000001 (NEEDED)             Shared library: [libc.so.6]

This makes it easy to deploy on embedded Linux without installing other
libraries.

Tested via

 ./scripts/build/build_examples.py --target linux-arm64-chip-tool-ipv6only-no-ble-no-wifi-no-thread-asan-clang build
 ./scripts/build/build_examples.py --target linux-arm64-all-clusters-ipv6only-no-ble-no-wifi-no-thread-asan-clang build
  • Loading branch information
mspang committed Jul 6, 2022
1 parent 64b179a commit 1d968cb
Show file tree
Hide file tree
Showing 4 changed files with 199 additions and 3 deletions.
1 change: 1 addition & 0 deletions examples/all-clusters-app/linux/main-common.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@
#include <new>
#include <platform/DiagnosticDataProvider.h>
#include <platform/PlatformManager.h>
#include <signal.h>
#include <system/SystemPacketBuffer.h>
#include <transport/SessionManager.h>
#include <transport/raw/PeerAddress.h>
Expand Down
2 changes: 2 additions & 0 deletions scripts/build/build/targets.py
Original file line number Diff line number Diff line change
Expand Up @@ -270,6 +270,7 @@ def HostTargets():
builder.AppendVariant(name="ipv6only", enable_ipv4=False),
builder.AppendVariant(name="no-ble", enable_ble=False),
builder.AppendVariant(name="no-wifi", enable_wifi=False),
builder.AppendVariant(name="no-thread", enable_thread=False),
builder.AppendVariant(name="tsan", conflicts=['asan'], use_tsan=True),
builder.AppendVariant(name="asan", conflicts=['tsan'], use_asan=True),
builder.AppendVariant(name="libfuzzer", requires=[
Expand All @@ -279,6 +280,7 @@ def HostTargets():

builder.WhitelistVariantNameForGlob('no-interactive-ipv6only')
builder.WhitelistVariantNameForGlob('ipv6only')
builder.WhitelistVariantNameForGlob('ipv6only-no-ble-no-wifi-no-thread-clang')

for target in app_targets:
if ('-rpc-console' in target.name) or ('-python-bindings' in target.name) or ('nl-test-runner' in target.name):
Expand Down
11 changes: 8 additions & 3 deletions scripts/build/builders/host.py
Original file line number Diff line number Diff line change
Expand Up @@ -192,9 +192,11 @@ def PlatformName(self):

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,
def __init__(self, root, runner, app: HostApp, board=HostBoard.NATIVE,
enable_ipv4=True, enable_ble=True, enable_wifi=True,
enable_thread=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, enable_rpcs=False):
super(HostBuilder, self).__init__(
root=os.path.join(root, 'examples', app.ExamplePath()),
Expand All @@ -216,6 +218,9 @@ def __init__(self, root, runner, app: HostApp, board=HostBoard.NATIVE, enable_ip
if not enable_wifi:
self.extra_gn_options.append('chip_enable_wifi=false')

if not enable_thread:
self.extra_gn_options.append('chip_enable_openthread=false')

if use_tsan:
self.extra_gn_options.append('is_tsan=true')

Expand Down
Loading

0 comments on commit 1d968cb

Please sign in to comment.