Skip to content

Commit

Permalink
[Matter.framework][darwin-framework-tool] Add chip_system_config_use_…
Browse files Browse the repository at this point in the history
…network_framework flag support
  • Loading branch information
vivien-apple committed Nov 7, 2024
1 parent 2a75b85 commit 9b05890
Show file tree
Hide file tree
Showing 3 changed files with 20 additions and 5 deletions.
14 changes: 10 additions & 4 deletions examples/darwin-framework-tool/BUILD.gn
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,9 @@ declare_args() {

# Enable automatic leak checks before the application exits
enable_leak_checking = !is_asan && target_os == "mac"

# Use the Network.framework instead of POSIX sockets
use_network_framework = false
}

sdk = "macosx"
Expand Down Expand Up @@ -125,6 +128,12 @@ action("build-darwin-framework") {
args += [ "--no-enable-encoding-sentinel-enum-values" ]
}

if (defined(use_network_framework) && use_network_framework) {
args += [ "--use-network-framework" ]
} else {
args += [ "--no-use-network-framework" ]
}

output_name = "Matter.framework"
outputs = [
"${root_out_dir}/macos_framework_output/Build/Products/${output_sdk_type}/${output_name}",
Expand Down Expand Up @@ -277,10 +286,7 @@ executable("darwin-framework-tool") {
"${root_out_dir}/macos_framework_output/Build/Intermediates.noindex/Matter.build/${output_sdk_type}/Matter.build/out/gen/include",
]

defines = [
"CHIP_HAVE_CONFIG_H=1",
"CHIP_SYSTEM_CONFIG_USE_SOCKETS=1",
]
defines = [ "CHIP_HAVE_CONFIG_H=1" ]

frameworks += [
"CoreFoundation.framework",
Expand Down
5 changes: 4 additions & 1 deletion scripts/build/build_darwin_framework.py
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,8 @@ def build_darwin_framework(args):
'CHIP_IS_ASAN': args.asan,
'CHIP_IS_BLE': args.ble,
'CHIP_IS_CLANG': args.clang,
'CHIP_ENABLE_ENCODING_SENTINEL_ENUM_VALUES': args.enable_encoding_sentinel_enum_values
'CHIP_ENABLE_ENCODING_SENTINEL_ENUM_VALUES': args.enable_encoding_sentinel_enum_values,
'CHIP_USE_NETWORK_FRAMEWORK': args.use_network_framework
}
for option in options:
command += ["{}={}".format(option, "YES" if options[option] else "NO")]
Expand Down Expand Up @@ -176,6 +177,8 @@ def build_darwin_framework(args):
parser.add_argument('--clang', action=argparse.BooleanOptionalAction)
parser.add_argument('--enable-encoding-sentinel-enum-values', action=argparse.BooleanOptionalAction)
parser.add_argument('--compdb', action=argparse.BooleanOptionalAction)
parser.add_argument('--use-network-framework',
action=argparse.BooleanOptionalAction)

args = parser.parse_args()
build_darwin_framework(args)
6 changes: 6 additions & 0 deletions src/darwin/Framework/chip_xcode_build_connector.sh
Original file line number Diff line number Diff line change
Expand Up @@ -187,6 +187,12 @@ esac
)
}

[[ $CHIP_USE_NETWORK_FRAMEWORK == YES ]] && {
args+=(
'chip_system_config_use_network_framework=true'
)
}

# search current (or $2) and its parent directories until
# a name match is found, which is output on stdout
find_in_ancestors() {
Expand Down

0 comments on commit 9b05890

Please sign in to comment.