Skip to content

Instantly share code, notes, and snippets.

@bdelmas
Created January 2, 2019 09:13
Show Gist options
  • Save bdelmas/2c68038af401a90539e23e9d397618ce to your computer and use it in GitHub Desktop.
Save bdelmas/2c68038af401a90539e23e9d397618ce to your computer and use it in GitHub Desktop.
A Justfile where Rust compiles with PGO
all: check doc build build-release test
build:
time cargo build --all
build-release:
time cargo build --all --release
check:
cargo check --all
doc:
cargo doc --all
run +ARGS="":
cargo run -- {{ARGS}}
run-release +ARGS="":
cargo run --release -- {{ARGS}}
test:
cargo test --all
watch TARGET="all":
watchexec -cre rs -- just "{{TARGET}}"
make-bvh SCENE:
@just run -vv build scenes/{{SCENE}}.yml -o scenes/{{SCENE}}.cbor
render-and-open SCENE +FLAGS="":
@just make-bvh {{SCENE}}
@time just run -vv render {{FLAGS}} scenes/{{SCENE}}.cbor -o /tmp/csci5607-final-{{SCENE}}.png
feh /tmp/csci5607-final-{{SCENE}}.png
render-and-open-fast SCENE +FLAGS="":
@just make-bvh {{SCENE}}
@time just run-release -vv render {{FLAGS}} scenes/{{SCENE}}.cbor -o /tmp/csci5607-final-{{SCENE}}.png
feh /tmp/csci5607-final-{{SCENE}}.png
render-and-open-slow SCENE +FLAGS="":
@time just run -vv render-slow {{FLAGS}} scenes/{{SCENE}}.yml -o /tmp/csci5607-final-{{SCENE}}.png
feh /tmp/csci5607-final-{{SCENE}}.png
animation SCENE +FLAGS="": build-release
@mkdir -p out/{{SCENE}}
@just run-release -vv animation {{FLAGS}} scenes/{{SCENE}}.yml -o out/{{SCENE}}
ffmpeg -r 20 -f image2 -s 800x600 -i out/{{SCENE}}/%05d.png -vcodec libx264 -crf 25 -pix_fmt yuv420p out/{{SCENE}}.mp4
deployable:
@just make-bvh cornell
env RUSTFLAGS="-Z pgo-gen=target/pgo/pgo.profraw" cargo +nightly run \
--release \
--target-dir target/pgo/gen \
-- -vv render scenes/cornell.cbor -o /tmp/csci5607-final-cornell.png
rustup run nightly llvm-profdata merge -o target/pgo/pgo.profdata target/pgo/pgo.profraw
env RUSTFLAGS="-Z pgo-use=target/pgo/pgo.profdata" cargo +nightly build \
--release \
--target-dir target/deployable
docker: deployable
docker build -t remexre/csci5607-final .
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment