-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathMakefile
More file actions
37 lines (32 loc) · 1.59 KB
/
Copy pathMakefile
File metadata and controls
37 lines (32 loc) · 1.59 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
CARGO ?= cargo
CBINDGEN ?= cbindgen
TARGET ?=
install-deps:
apt install -y curl unzip
curl -OL https://github.com/protocolbuffers/protobuf/releases/download/v3.20.0/protoc-3.20.0-linux-x86_64.zip
unzip -o protoc-3.20.0-linux-x86_64.zip -d ./proto
chmod 755 -R ./proto/bin
cp ./proto/bin/protoc /usr/local/bin/
cp -R ./proto/include/* /usr/local/include/
build-wasm-pkg :
$(CARGO) build --package runtime --release
$(CBINDGEN) --config=cbindgen.toml --crate runtime --output pkg/runtime-cpp/includes/runtime.h
cp target/release/libruntime.so pkg/runtime-cpp/libruntime.so
mkdir -p pkg/modules-wasm
$(CARGO) wasi build --package dex --release
cp target/wasm32-wasi/release/dex.wasm pkg/modules-wasm/dex.wasm
# NOTE: CRATE_CC_NO_DEFAULTS=1 is necessary so that cxx doesn't cause any cross-compilation
# issues when using `cc-rs`. Tracking issue: https://github.com/rust-lang/cc-rs/issues/710
# TODO: Merge this with core package when ain links both
build-grpc-pkg:
CRATE_CC_NO_DEFAULTS=1 $(CARGO) build --package ain-grpc --release $(if $(TARGET),--target $(TARGET),)
mkdir -p pkg/ain-grpc/include pkg/ain-grpc/lib
cp target/$(if $(TARGET),$(TARGET)/,)release/libain_grpc.a pkg/ain-grpc/lib/
cp target/libain_rpc.hpp pkg/ain-grpc/include/
cp target/libain_rpc.cpp pkg/ain-grpc/
build-core-pkg:
CRATE_CC_NO_DEFAULTS=1 $(CARGO) build --package ain-core --release $(if $(TARGET),--target $(TARGET),)
mkdir -p pkg/ain-core/include pkg/ain-core/lib
cp target/$(if $(TARGET),$(TARGET)/,)release/libain_core.a pkg/ain-core/lib/
cp target/libain_core.hpp pkg/ain-core/include/
cp target/libain_core.cpp pkg/ain-core/