Skip to content

Commit a0f8726

Browse files
iOS tv-casting-app: updating build settings to allow arm64 simulator builds (project-chip#32680)
1 parent 5bb5c9e commit a0f8726

File tree

3 files changed

+28
-28
lines changed

3 files changed

+28
-28
lines changed

examples/tv-casting-app/darwin/MatterTvCastingBridge/MatterTvCastingBridge.xcodeproj/project.pbxproj

+4-5
Original file line numberDiff line numberDiff line change
@@ -60,7 +60,6 @@
6060
3C9437942B3B47A10096E5F4 /* MCErrorUtils.mm in Sources */ = {isa = PBXBuildFile; fileRef = 3C9437932B3B47A10096E5F4 /* MCErrorUtils.mm */; };
6161
3CCB87212869085400771BAD /* MatterTvCastingBridge.h in Headers */ = {isa = PBXBuildFile; fileRef = 3CCB87202869085400771BAD /* MatterTvCastingBridge.h */; settings = {ATTRIBUTES = (Public, ); }; };
6262
3CCB8737286A555500771BAD /* libTvCastingCommon.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 3CCB8735286A555500771BAD /* libTvCastingCommon.a */; };
63-
3CCB8738286A555500771BAD /* libmbedtls.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 3CCB8736286A555500771BAD /* libmbedtls.a */; settings = {ATTRIBUTES = (Required, ); }; };
6463
3CCB873F286A593700771BAD /* DiscoveredNodeData.mm in Sources */ = {isa = PBXBuildFile; fileRef = 3CCB8739286A593700771BAD /* DiscoveredNodeData.mm */; };
6564
3CCB8740286A593700771BAD /* CastingServerBridge.h in Headers */ = {isa = PBXBuildFile; fileRef = 3CCB873A286A593700771BAD /* CastingServerBridge.h */; };
6665
3CCB8741286A593700771BAD /* DiscoveredNodeData.h in Headers */ = {isa = PBXBuildFile; fileRef = 3CCB873B286A593700771BAD /* DiscoveredNodeData.h */; };
@@ -151,7 +150,6 @@
151150
3CCB871D2869085400771BAD /* MatterTvCastingBridge.framework */ = {isa = PBXFileReference; explicitFileType = wrapper.framework; includeInIndex = 0; path = MatterTvCastingBridge.framework; sourceTree = BUILT_PRODUCTS_DIR; };
152151
3CCB87202869085400771BAD /* MatterTvCastingBridge.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = MatterTvCastingBridge.h; sourceTree = "<group>"; };
153152
3CCB8735286A555500771BAD /* libTvCastingCommon.a */ = {isa = PBXFileReference; lastKnownFileType = archive.ar; name = libTvCastingCommon.a; path = lib/libTvCastingCommon.a; sourceTree = BUILT_PRODUCTS_DIR; };
154-
3CCB8736286A555500771BAD /* libmbedtls.a */ = {isa = PBXFileReference; lastKnownFileType = archive.ar; name = libmbedtls.a; path = lib/libmbedtls.a; sourceTree = BUILT_PRODUCTS_DIR; };
155153
3CCB8739286A593700771BAD /* DiscoveredNodeData.mm */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.objcpp; path = DiscoveredNodeData.mm; sourceTree = "<group>"; };
156154
3CCB873A286A593700771BAD /* CastingServerBridge.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = CastingServerBridge.h; sourceTree = "<group>"; };
157155
3CCB873B286A593700771BAD /* DiscoveredNodeData.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = DiscoveredNodeData.h; sourceTree = "<group>"; };
@@ -183,7 +181,6 @@
183181
buildActionMask = 2147483647;
184182
files = (
185183
3CCB8737286A555500771BAD /* libTvCastingCommon.a in Frameworks */,
186-
3CCB8738286A555500771BAD /* libmbedtls.a in Frameworks */,
187184
);
188185
runOnlyForDeploymentPostprocessing = 0;
189186
};
@@ -233,7 +230,6 @@
233230
isa = PBXGroup;
234231
children = (
235232
3CCB871F2869085400771BAD /* MatterTvCastingBridge */,
236-
3CCB8736286A555500771BAD /* libmbedtls.a */,
237233
3CCB8735286A555500771BAD /* libTvCastingCommon.a */,
238234
3CCB871E2869085400771BAD /* Products */,
239235
);
@@ -556,7 +552,6 @@
556552
DEBUG_INFORMATION_FORMAT = dwarf;
557553
ENABLE_STRICT_OBJC_MSGSEND = YES;
558554
ENABLE_TESTABILITY = YES;
559-
"EXCLUDED_ARCHS[sdk=iphonesimulator*]" = arm64;
560555
GCC_C_LANGUAGE_STANDARD = gnu11;
561556
GCC_DYNAMIC_NO_PIC = NO;
562557
GCC_NO_COMMON_BLOCKS = YES;
@@ -644,6 +639,10 @@
644639
3CCB87252869085400771BAD /* Debug */ = {
645640
isa = XCBuildConfiguration;
646641
buildSettings = {
642+
"ARCHS[sdk=iphonesimulator*]" = (
643+
arm64,
644+
x86_64,
645+
);
647646
CHIP_ROOT = "$(PROJECT_DIR)/../../../..";
648647
CODE_SIGN_STYLE = Automatic;
649648
COPY_PHASE_STRIP = NO;

examples/tv-casting-app/darwin/MatterTvCastingBridge/chip_xcode_build_connector.sh

+20-22
Original file line numberDiff line numberDiff line change
@@ -60,35 +60,31 @@ for define in "${defines[@]}"; do
6060
done
6161
target_defines=[${target_defines:1}]
6262

63+
declare target_arch=
6364
declare target_cpu=
64-
case $PLATFORM_PREFERRED_ARCH in
65-
i386)
66-
target_cpu=x86
67-
;;
68-
x86_64)
69-
target_cpu=x64
70-
;;
71-
armv7)
72-
target_cpu=arm
73-
;;
74-
arm64)
75-
target_cpu=arm64
76-
;;
77-
*)
78-
echo >&2
79-
;;
80-
esac
81-
82-
declare target_cflags='"-target","'"$PLATFORM_PREFERRED_ARCH"'-'"$LLVM_TARGET_TRIPLE_VENDOR"'-'"$LLVM_TARGET_TRIPLE_OS_VERSION"'"'
65+
declare target_cflags=
66+
declare current_arch="$(uname -m)"
8367

8468
read -r -a archs <<<"$ARCHS"
85-
8669
for arch in "${archs[@]}"; do
87-
target_cflags+=',"-arch","'"$arch"'"'
70+
if [ -z "$target_arch" ] || [ "$arch" = "$current_arch" ]; then
71+
target_arch="$arch"
72+
case "$arch" in
73+
x86_64) target_cpu="x64" ;;
74+
*) target_cpu="$arch" ;;
75+
esac
76+
fi
77+
if [ -n "$target_cflags" ]; then
78+
target_cflags+=','
79+
fi
80+
target_cflags+='"-arch","'"$arch"'"'
8881
done
8982

9083
[[ $ENABLE_BITCODE == YES ]] && {
91-
target_cflags+=',"-flto"'
84+
if [ -n "$target_cflags" ]; then
85+
target_cflags+=','
86+
fi
87+
target_cflags+='"-flto"'
9288
}
9389

9490
target_cflags+=',"-fno-c++-static-destructors"'
@@ -101,6 +97,8 @@ declare -a args=(
10197
'target_cpu="'"$target_cpu"'"'
10298
'target_defines='"$target_defines"
10399
'target_cflags=['"$target_cflags"']'
100+
"mac_target_arch=\"$target_arch\""
101+
"mac_deployment_target=\"$LLVM_TARGET_TRIPLE_OS_VERSION$LLVM_TARGET_TRIPLE_SUFFIX\""
104102
'build_tv_casting_common_a=true'
105103
)
106104

examples/tv-casting-app/darwin/TvCasting/TvCasting.xcodeproj/project.pbxproj

+4-1
Original file line numberDiff line numberDiff line change
@@ -340,7 +340,6 @@
340340
DEBUG_INFORMATION_FORMAT = dwarf;
341341
ENABLE_STRICT_OBJC_MSGSEND = YES;
342342
ENABLE_TESTABILITY = YES;
343-
"EXCLUDED_ARCHS[sdk=iphonesimulator*]" = arm64;
344343
GCC_C_LANGUAGE_STANDARD = gnu11;
345344
GCC_DYNAMIC_NO_PIC = NO;
346345
GCC_NO_COMMON_BLOCKS = YES;
@@ -426,6 +425,10 @@
426425
3CC0E9052841DD3500EC6A18 /* Debug */ = {
427426
isa = XCBuildConfiguration;
428427
buildSettings = {
428+
"ARCHS[sdk=iphonesimulator*]" = (
429+
arm64,
430+
x86_64,
431+
);
429432
ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;
430433
ASSETCATALOG_COMPILER_GLOBAL_ACCENT_COLOR_NAME = AccentColor;
431434
CLANG_ENABLE_MODULES = YES;

0 commit comments

Comments
 (0)