-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathrun.sh
More file actions
executable file
·31 lines (26 loc) · 1.11 KB
/
Copy pathrun.sh
File metadata and controls
executable file
·31 lines (26 loc) · 1.11 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
#!/usr/bin/env bash
#
# Run the String demo (Sponza scene).
#
# Sponza is gitignored (~280 MB — too large to track), so it isn't baked into the Nix store and
# the wrapped binary's default STRING_RESOURCES_DIR (which points at the store) doesn't contain
# it. This script stitches the store's built shaders together with the on-disk sandbox/assets
# tree (which *does* have sponza) into one resources dir, and points the binary at it.
#
# The binary wraps STRING_RESOURCES_DIR with --set-default (see flake.nix), so the value we
# export here wins. Validation layers + loader paths still come from the wrapper.
#
# Usage: ./run.sh
set -euo pipefail
repo="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
echo "Building..."
out="$(nix build --no-link --print-out-paths "$repo#")"
res="$(mktemp -d -t string-resources.XXXXXX)"
trap 'rm -rf "$res"' EXIT
ln -sfn "$out/include/string/shaders" "$res/shaders"
ln -sfn "$repo/sandbox/assets" "$res/assets"
export STRING_RESOURCES_DIR="$res"
echo "STRING_RESOURCES_DIR=$res"
echo " shaders -> $out/include/string/shaders"
echo " assets -> $repo/sandbox/assets"
exec "$out/bin/string_demo"