Page MenuHomePhabricator

D9602.id32434.diff
No OneTemporary

D9602.id32434.diff

diff --git a/native/ios/Comm.xcodeproj/project.pbxproj b/native/ios/Comm.xcodeproj/project.pbxproj
--- a/native/ios/Comm.xcodeproj/project.pbxproj
+++ b/native/ios/Comm.xcodeproj/project.pbxproj
@@ -1249,7 +1249,8 @@
"\"${PODS_CONFIGURATION_BUILD_DIR}/react-native-safe-area-context\"",
"\"${PODS_CONFIGURATION_BUILD_DIR}/react-native-video\"",
/usr/lib/swift,
- "$(SRCROOT)/../native_rust_library/target/universal/release",
+ "$(SRCROOT)/../native_rust_library/target/aarch64-apple-ios/release",
+ "$(SRCROOT)/../native_rust_library/target/x86_64-apple-ios/release",
);
OTHER_CPLUSPLUSFLAGS = (
"-DFOLLY_MOBILE=1",
@@ -1384,7 +1385,8 @@
"\"${PODS_CONFIGURATION_BUILD_DIR}/react-native-safe-area-context\"",
"\"${PODS_CONFIGURATION_BUILD_DIR}/react-native-video\"",
/usr/lib/swift,
- "$(SRCROOT)/../native_rust_library/target/universal/release",
+ "$(SRCROOT)/../native_rust_library/target/aarch64-apple-ios/release",
+ "$(SRCROOT)/../native_rust_library/target/x86_64-apple-ios/release",
);
ONLY_ACTIVE_ARCH = YES;
OTHER_CPLUSPLUSFLAGS = (
diff --git a/scripts/build-rust-native-library.sh b/scripts/build-rust-native-library.sh
--- a/scripts/build-rust-native-library.sh
+++ b/scripts/build-rust-native-library.sh
@@ -11,6 +11,16 @@
source "$COMM_NIX_PATH"
fi
+# Set the architecture based on Xcode's ARCHS variable
+if [[ "$ARCHS" == "arm64" ]]; then
+ TARGET="aarch64-apple-ios"
+elif [[ "$ARCHS" == "x86_64" ]]; then
+ TARGET="x86_64-apple-ios"
+else
+ echo "Unsupported architecture: $ARCHS"
+ exit 1
+fi
+
# The $PATH used by Xcode likely won't contain Cargo, fix that.
# In addition, the $PATH used by XCode has lots of Apple-specific
# developer tools that your Cargo isn't expecting to use, fix that.
@@ -25,13 +35,12 @@
# Set C++ standard and build cxx bridge
export CXXFLAGS="-std=c++14"
-env PATH="${build_path}" cargo build --release
-# Build universal static library (works on simulator and iOS)
-env PATH="${build_path}" cargo lipo --release
+# Use the determined TARGET for the build
+env PATH="${build_path}" cargo build --release --target="$TARGET"
# Unset the flag specifying C++ standard
unset CXXFLAGS
# Copy the CXX files to the cargo project root to make them
# available to XCode
-cp "$(readlink target/cxxbridge/native_rust_library/src/lib.rs.cc)" .
-cp "$(readlink target/cxxbridge/native_rust_library/src/lib.rs.h)" .
-cp "$(readlink target/cxxbridge/rust/cxx.h)" .
+cp "$(readlink target/${TARGET}/cxxbridge/native_rust_library/src/lib.rs.cc)" .
+cp "$(readlink target/${TARGET}/cxxbridge/native_rust_library/src/lib.rs.h)" .
+cp "$(readlink target/${TARGET}/cxxbridge/rust/cxx.h)" .

File Metadata

Mime Type
text/plain
Expires
Mon, Nov 25, 4:34 PM (21 h, 30 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
2580438
Default Alt Text
D9602.id32434.diff (2 KB)

Event Timeline