Skip to content

Commit

Permalink
Also set mac_target_arch based on the first entry in ARCHS. Set is_de…
Browse files Browse the repository at this point in the history
…bug correctly.
  • Loading branch information
ksperling-apple committed Oct 21, 2022
1 parent eb47e13 commit 9a0a05d
Showing 1 changed file with 15 additions and 11 deletions.
26 changes: 15 additions & 11 deletions src/darwin/Framework/chip_xcode_build_connector.sh
Original file line number Diff line number Diff line change
Expand Up @@ -60,14 +60,18 @@ for define in "${defines[@]}"; do
done
target_defines=[${target_defines:1}]

declare target_arch=
declare target_cpu=
declare target_cflags=""
declare target_cflags=

read -r -a archs <<<"$ARCHS"

for arch in "${archs[@]}"; do
if [ -z "$target_cpu"] ]; then
target_cpu="$arch"
if [ -z "$target_arch"] ]; then
target_arch="$arch"
case "$arch" in
x86_64) target_cpu="x64";;
*) target_cpu="$arch";;
esac
fi
if [ -n "$target_cflags" ]; then
target_cflags+=','
Expand All @@ -87,14 +91,14 @@ declare -a args=(
'chip_enable_wifi=false'
'chip_log_message_max_size=4096' # might as well allow nice long log messages
'chip_disable_platform_kvs=true'
'target_cpu="'"$target_cpu"'"'
'target_defines='"$target_defines"
'target_cflags=['"$target_cflags"']'
'mac_target_arch="'"$PLATFORM_PREFERRED_ARCH"'"'
'mac_deployment_target="'"$LLVM_TARGET_TRIPLE_OS_VERSION"''"$LLVM_TARGET_TRIPLE_SUFFIX"'"'
"target_cpu=\"$target_cpu\""
"target_defines=$target_defines"
"target_cflags=[$target_cflags]"
"mac_target_arch=\"$target_arch\""
"mac_deployment_target=\"$LLVM_TARGET_TRIPLE_OS_VERSION$LLVM_TARGET_TRIPLE_SUFFIX\""
)

[[ $CONFIGURATION != Debug* ]] && args+='is_debug=true'
[[ $CONFIGURATION == Debug ]] && args+=('is_debug=true')

[[ $PLATFORM_FAMILY_NAME != macOS ]] && {
args+=(
Expand Down Expand Up @@ -148,7 +152,7 @@ find_in_ancestors() {
# put build intermediates in TEMP_DIR
cd "$TEMP_DIR"

# gnerate and build
# generate and build
gn --root="$CHIP_ROOT" gen --check out --args="${args[*]}"
exec ninja -v -C out
}

0 comments on commit 9a0a05d

Please sign in to comment.