Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(runtime) Use dynamic libraries instead of compiling the runtime #12

Merged
merged 2 commits into from
May 29, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 1 addition & 8 deletions .circleci/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -23,19 +23,12 @@ jobs:
export PATH="$HOME/.cargo/bin:$PATH"
test -f $HOME/.cargo/bin/just || cargo install just

# Compile the Rust part of the library.
- run:
name: Compile the Rust part of the Go library
command: |
export PATH="$HOME/.cargo/bin:$PATH"
just rust

# Compile and install the Go library.
- run:
name: Compile and install the Go library
command: |
export PATH="$HOME/.cargo/bin:$PATH"
just go
just build

# Run the library test suites.
- run:
Expand Down
20 changes: 11 additions & 9 deletions justfile
Original file line number Diff line number Diff line change
@@ -1,9 +1,5 @@
# Compile the Rust part for this specific system.
rust:
cargo build --release

# Compile the Go part.
go go-build-args='':
# Compile the library.
build go-build-args='-v':
#!/usr/bin/env bash
set -euo pipefail
cd wasmer
Expand All @@ -17,9 +13,15 @@ go go-build-args='':
*)
dylib_extension="so"
esac
test -f libwasmer_runtime_c_api.${dylib_extension} || \
if ! test -f libwasmer_runtime_c_api.${dylib_extension}; then
cargo build --release
ln -s ../target/release/deps/libwasmer_runtime_c_api-*.${dylib_extension} libwasmer_runtime_c_api.${dylib_extension}
go build -ldflags="-r $(pwd)" -v {{go-build-args}} .
fi
go build {{go-build-args}} .

# Compile the Rust part for this specific system.
rust:
cargo build --release

# Generate cgo debug objects.
debug-cgo:
Expand All @@ -30,7 +32,7 @@ debug-cgo:
# Run all the tests.
test:
#!/usr/bin/env bash
export LD_LIBRARY_PATH=$(pwd)/wasmer
#export DYLD_PRINT_LIBRARIES=y
cd wasmer/test/
# Run the tests.
go test -test.v $(find . -type f \( -name "*_test.go" \! -name "example_*.go" \! -name "benchmark*.go" \) ) imports.go
Expand Down
2 changes: 1 addition & 1 deletion wasmer/bridge.go
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
package wasmer

// #cgo LDFLAGS: -L./ -lwasmer_runtime_c_api
// #cgo LDFLAGS: -Wl,-rpath,${SRCDIR} -L${SRCDIR} -lwasmer_runtime_c_api
// #include "./wasmer.h"
//
import "C"
Expand Down
Binary file modified wasmer/libwasmer_runtime_c_api.dylib
100755 → 100644
Binary file not shown.
Binary file added wasmer/libwasmer_runtime_c_api.so
Binary file not shown.