cargo: Enable lto and native bytecode.

This commit is contained in:
parazyd
2022-04-23 15:01:56 +02:00
parent 9f1e9b1401
commit ac98cb39c4
2 changed files with 14 additions and 6 deletions

View File

@@ -11,6 +11,11 @@ edition = "2021"
[lib]
name = "darkfi"
[profile.release]
debug = true
lto = "fat"
codegen-units = 1
[workspace]
members = [
"bin/zkas",

View File

@@ -6,6 +6,9 @@ PREFIX = /usr/local
# Cargo binary
CARGO = cargo
# Flags passed to cargo/rustc
RUSTFLAGS = -C target-cpu=native
# Binaries to be built
BINS = zkas drk darkfid gatewayd
@@ -24,17 +27,17 @@ token_lists:
$(MAKE) -C contrib/token all
$(BINS): token_lists $(BINDEPS)
$(CARGO) build --all-features --release --package $@
RUSTFLAGS="$(RUSTFLAGS)" $(CARGO) build --all-features --release --package $@
cp -f target/release/$@ $@
check:
$(CARGO) hack check --release --feature-powerset --all
RUSTFLAGS="$(RUSTFLAGS)" $(CARGO) hack check --release --feature-powerset --all
fix:
$(CARGO) clippy --release --all-features --fix --allow-dirty --all
RUSTFLAGS="$(RUSTFLAGS)" $(CARGO) clippy --release --all-features --fix --allow-dirty --all
clippy:
$(CARGO) clippy --release --all-features --all
RUSTFLAGS="$(RUSTFLAGS)" $(CARGO) clippy --release --all-features --all
# zkas source files which we want to compile for tests
VM_SRC = proof/arithmetic.zk proof/mint.zk proof/burn.zk
@@ -44,10 +47,10 @@ $(VM_BIN): zkas $(VM_SRC)
./zkas $(basename $@) -o $@
test: $(VM_BIN) test-tx
$(CARGO) test --release --all-features --all
RUSTFLAGS="$(RUSTFLAGS)" $(CARGO) test --release --all-features --all
test-tx:
$(CARGO) run --release --features=node,zkas --example tx
RUSTFLAGS="$(RUSTFLAGS)" $(CARGO) run --release --features=node,zkas --example tx
clean:
rm -f $(BINS)