Skip to content

Commit

Permalink
Merge pull request #550 from CosmWasm/sw/makefile-build-commands
Browse files Browse the repository at this point in the history
Cleanup build commands in Makefile
  • Loading branch information
webmaster128 authored Aug 13, 2024
2 parents 44e2980 + ce32bc1 commit debea64
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 15 deletions.
2 changes: 1 addition & 1 deletion .circleci/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -279,7 +279,7 @@ jobs:
- cargocache-v3-build_shared_library-rust:1.74.0-
- run:
name: Create release build of libwasmvm
command: make build-rust
command: make build-libwasmvm
- persist_to_workspace:
root: ./internal/api
paths:
Expand Down
20 changes: 11 additions & 9 deletions Makefile
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
.PHONY: all build build-rust build-go test

# Builds the Rust library libwasmvm
BUILDERS_PREFIX := cosmwasm/libwasmvm-builder:0100
# Contains a full Go dev environment including CGO support in order to run Go tests on the built shared library
Expand Down Expand Up @@ -30,33 +28,37 @@ test-filenames:
echo $(SHARED_LIB_DST)
echo $(SHARED_LIB_SRC)

all: build test

build: build-rust build-go

build-rust: build-rust-release
.PHONY: build
build:
make build-libwasmvm
make build-go

# Use debug build for quick testing.
# In order to use "--features backtraces" here we need a Rust nightly toolchain, which we don't have by default
build-rust-debug:
.PHONY: build-libwasmvm-debug
build-libwasmvm-debug:
(cd libwasmvm && cargo build)
cp libwasmvm/target/debug/$(SHARED_LIB_SRC) internal/api/$(SHARED_LIB_DST)
make update-bindings

# use release build to actually ship - smaller and much faster
build-rust-release:
.PHONY: build-libwasmvm
build-libwasmvm:
(cd libwasmvm && cargo build --release)
cp libwasmvm/target/release/$(SHARED_LIB_SRC) internal/api/$(SHARED_LIB_DST)
make update-bindings

.PHONY: build-go
build-go:
go build ./...
go build -o build/demo ./cmd/demo

.PHONY: test
test:
# Use package list mode to include all subdirectores. The -count=1 turns off caching.
RUST_BACKTRACE=1 go test -v -count=1 ./...

.PHONY: test-safety
test-safety:
# Use package list mode to include all subdirectores. The -count=1 turns off caching.
GOEXPERIMENT=cgocheck2 go test -race -v -count=1 ./...
Expand Down
10 changes: 5 additions & 5 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ library that can be used via FFI. It is compiled like this:

# Create release build for your current system. Uses whatever default Rust
# version you have installed.
make build-rust
make build-libwasmvm

# Create reproducible release builds for other systems (slow, don't use for development)
make release-build-alpine
Expand Down Expand Up @@ -135,7 +135,7 @@ which for example excludes all 32 bit systems.
| macOS | x86_64 | static | ✅​libwasmvmstatic_darwin.a | Fat/universal library with multiple archs ([#407]) |
| macOS | aarch64 | shared | ✅​libwasmvm.dylib | Fat/universal library with multiple archs ([#294]) |
| macOS | aarch64 | static | ✅​libwasmvmstatic_darwin.a | Fat/universal library with multiple archs ([#407]) |
| Windows (mingw) | x86_64 | shared | 🏗​wasmvm.dll | Shared library linking not working on Windows ([#389]) |
| Windows (mingw) | x86_64 | shared | 🏗​wasmvm.dll | Shared library linking not working on Windows ([#389]) |
| Windows (mingw) | x86_64 | static | 🚫​ | Unclear if this can work using a cross compiler; needs research on .lib (MSVC toolchain) vs. .a (GNU toolchain). ([#389]) |
| Windows (mingw) | aarch64 | shared | 🚫​ | Shared library linking not working on Windows ([#389]) |
| Windows (mingw) | aarch64 | static | 🚫​ | Unclear if this can work using a cross compiler; needs research on .lib (MSVC toolchain) vs. .a (GNU toolchain). ([#389]) |
Expand Down Expand Up @@ -171,6 +171,6 @@ import this code freely. If it is not present you will have to build it for your
system, and ideally add it to this repo with a PR (on your fork). We will set up
a proper CI system for building these binaries, but we are not there yet.

To build the rust side, try `make build-rust` and wait for it to compile. This
depends on `cargo` being installed with `rustc` version 1.47+. Generally, you
can just use `rustup` to install all this with no problems.
To build the rust side, try `make build-libwasmvm` and wait for it to compile.
This depends on `cargo` being installed with `rustc` version 1.47+. Generally,
you can just use `rustup` to install all this with no problems.

0 comments on commit debea64

Please sign in to comment.