-
Notifications
You must be signed in to change notification settings - Fork 14
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #115 from zemyblue/hotfix/static_library_on_mac
feat: Add static build for macos
- Loading branch information
Showing
8 changed files
with
54 additions
and
7 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
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,24 @@ | ||
#!/bin/bash | ||
set -o errexit -o nounset -o pipefail | ||
|
||
# ref: https://wapl.es/rust/2019/02/17/rust-cross-compile-linux-to-macos.html | ||
export PATH="/opt/osxcross/target/bin:$PATH" | ||
export LIBZ_SYS_STATIC=1 | ||
|
||
# See https://github.com/CosmWasm/wasmvm/issues/222#issuecomment-880616953 for two approaches to | ||
# enable stripping through cargo (if that is desired). | ||
|
||
echo "Starting aarch64-apple-darwin build" | ||
export CC=aarch64-apple-darwin20.4-clang | ||
export CXX=aarch64-apple-darwin20.4-clang++ | ||
cargo build --release --target aarch64-apple-darwin --example wasmvmstatic | ||
|
||
echo "Starting x86_64-apple-darwin build" | ||
export CC=o64-clang | ||
export CXX=o64-clang++ | ||
cargo build --release --target x86_64-apple-darwin --example wasmvmstatic | ||
|
||
# Create a universal library with both archs | ||
lipo -output artifacts/libwasmvmstatic_darwin.a -create \ | ||
target/x86_64-apple-darwin/release/examples/libwasmvmstatic.a \ | ||
target/aarch64-apple-darwin/release/examples/libwasmvmstatic.a |
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,6 @@ | ||
//go:build darwin && static_wasm && !sys_wasmvm | ||
|
||
package api | ||
|
||
// #cgo LDFLAGS: -L${SRCDIR} -lwasmvmstatic_darwin | ||
import "C" |
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 @@ | ||
pub use wasmvm::*; |