-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathMakefile
67 lines (60 loc) · 2.83 KB
/
Makefile
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
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
artifacts:
cd proofs && make web-prover-circuits
check-llvm:
@PATH="/opt/homebrew/opt/llvm@18/bin:/opt/homebrew/opt/llvm/bin:$$PATH"; \
if ! command -v llvm-config > /dev/null 2>&1; then \
echo "Error: LLVM is not installed or not in PATH."; \
exit 1; \
fi; \
LLVM_VERSION=$$(llvm-config --version); \
if [ "$${LLVM_VERSION%%.*}" -lt 18 ]; then \
echo "Error: LLVM version must be 18 or higher. Found $$LLVM_VERSION."; \
exit 1; \
fi
wasm: artifacts
@# NOTE: This build depends on RUSTFLAGS in the client_wasm/.cargo/config.toml
-cargo install wasm-pack
-cd client_wasm/demo/static && rm -f build && ln -s ../../../proofs/web_proof_circuits build && cd ../../..
PATH="/opt/homebrew/opt/llvm@18/bin:/opt/homebrew/opt/llvm/bin:$$PATH"; \
LLVM_PATH=$$(dirname $$(command -v llvm-config)); \
PATH="$$LLVM_PATH:$$PATH"; \
cd client_wasm && \
rustup run nightly-2024-10-28 ~/.cargo/bin/wasm-pack build --release --target web ./ -- \
-Z build-std=panic_abort,std
wasm-debug: check-llvm artifacts
-cargo install wasm-pack
-cd client_wasm/demo/static && rm -f build && ln -s ../../../proofs/web_proof_circuits build && cd ../../..
PATH="/opt/homebrew/opt/llvm@18/bin:/opt/homebrew/opt/llvm/bin:$$PATH"; \
LLVM_PATH=$$(dirname $$(command -v llvm-config)); \
PATH="$$LLVM_PATH:$$PATH"; \
cd client_wasm && \
rustup run nightly-2024-10-28 ~/.cargo/bin/wasm-pack build --debug --target web ./ -- \
-Z build-std=panic_abort,std
ios: artifacts
-cargo install cbindgen
# Build simulator
rustup target add aarch64-apple-ios-sim --toolchain nightly-2024-10-28
RUSTFLAGS="-C panic=unwind" cargo +nightly-2024-10-28 build -p client_ios --release --target aarch64-apple-ios-sim # builds target/aarch64-apple-ios-sim/release/libclient_ios.a
mkdir -p target/sim/headers
~/.cargo/bin/cbindgen --lang c --crate client_ios --output target/sim/headers/Prover.h
mv target/aarch64-apple-ios-sim/release/libclient_ios.a target/sim/libProver.a
# Build device
rustup target add aarch64-apple-ios --toolchain nightly-2024-10-28
RUSTFLAGS="-C panic=unwind" cargo +nightly-2024-10-28 build -p client_ios --release --target aarch64-apple-ios # builds target/aarch64-apple-ios/release/libclient_ios.a
mkdir -p target/device/headers
~/.cargo/bin/cbindgen --lang c --crate client_ios --output target/device/headers/Prover.h
mv target/aarch64-apple-ios/release/libclient_ios.a target/device/libProver.a
# Create combined xcframework
xcodebuild -create-xcframework \
-library "target/sim/libProver.a" \
-headers target/sim/headers \
-library "target/device/libProver.a" \
-headers target/device/headers \
-output target/PlutoProver.xcframework
# Cleanup
rm -rf target/device target/sim
wasm-demo/node_modules:
cd client_wasm/demo && npm install
wasm-demo: wasm-demo/node_modules
cd client_wasm/demo && npm run start
.PHONY: wasm wasm-debug wasm-demo ios