This repository has been archived by the owner on Sep 21, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 40
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
chore: Provide a script to generate headers that uses codegen_units=1…
… when building on macos to circumvent a header generation issue. Update CI and C makefile to use this script. Fixes #473
- Loading branch information
Showing
4 changed files
with
89 additions
and
9 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
#!/usr/bin/env bash | ||
set -e | ||
set -x | ||
|
||
SCRIPT_DIR=$( cd -- "$( dirname -- "${BASH_SOURCE[0]}" )" &> /dev/null && pwd ) | ||
PROJECT_DIR="$SCRIPT_DIR/../" | ||
|
||
pushd $PROJECT_DIR | ||
|
||
rm -rf ./target/headers | ||
mkdir -p ./target/headers | ||
cp -r ./rust/noosphere/include ./target/headers/ | ||
|
||
if [[ "$OSTYPE" == "darwin"* ]]; then | ||
# macos linker fails to generate all exports without this flag | ||
# https://github.com/subconsciousnetwork/noosphere/issues/473 | ||
CARGO_PROFILE_DEV_CODEGEN_UNITS=1 cargo run --verbose --package noosphere --example generate_header --features headers --locked | ||
else | ||
cargo run --verbose --package noosphere --example generate_header --features headers --locked | ||
fi | ||
|
||
mv ./noosphere.h ./target/headers/include/noosphere/noosphere.h | ||
|
||
popd | ||
|
||
set +x | ||
set +e |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,53 @@ | ||
#!/usr/bin/env bash | ||
set -e | ||
set -x | ||
|
||
SCRIPT_DIR=$( cd -- "$( dirname -- "${BASH_SOURCE[0]}" )" &> /dev/null && pwd ) | ||
PROJECT_DIR="$SCRIPT_DIR/../" | ||
|
||
pushd $PROJECT_DIR | ||
|
||
rm -rf ./LibNoosphere.xcframework | ||
|
||
$SCRIPT_DIR/generate_headers | ||
|
||
TARGETS=( | ||
"aarch64-apple-ios" | ||
"x86_64-apple-ios" | ||
"aarch64-apple-ios-sim" | ||
"x86_64-apple-darwin" | ||
"aarch64-apple-darwin" | ||
) | ||
|
||
for TARGET in "${TARGETS[@]}"; do | ||
rustup target install $TARGET | ||
cargo build --package noosphere --release --target $TARGET --locked | ||
# cargo build --package noosphert buie --target $TARGET --locked | ||
done | ||
|
||
mkdir -p ./target/macos | ||
mkdir -p ./target/simulator | ||
|
||
lipo -create \ | ||
./target/x86_64-apple-darwin/release/libnoosphere.a \ | ||
./target/aarch64-apple-darwin/release/libnoosphere.a \ | ||
-output ./target/macos/libnoosphere.a | ||
|
||
lipo -create \ | ||
./target/x86_64-apple-ios/release/libnoosphere.a \ | ||
./target/aarch64-apple-ios-sim/release/libnoosphere.a \ | ||
-output ./target/simulator/libnoosphere.a | ||
|
||
xcodebuild -create-xcframework \ | ||
-library ./target/macos/libnoosphere.a \ | ||
-headers ./target/headers/include/ \ | ||
-library ./target/simulator/libnoosphere.a \ | ||
-headers ./target/headers/include/ \ | ||
-library ./target/aarch64-apple-ios/release/libnoosphere.a \ | ||
-headers ./target/headers/include/ \ | ||
-output ./LibNoosphere.xcframework | ||
|
||
popd | ||
|
||
set +x | ||
set +e |