Musings from the mountains himwant.org

Add Depth Anything v3 Burn WASM

+52 -2
+52 -2
.tangled/workflows/deploy.yaml
··· 7 7 nixpkgs: 8 8 - nodejs 9 9 - bash 10 - 10 + - git 11 + - cacert 12 + - cargo 13 + - rustc 14 + - wasm-pack 15 + - gcc 16 + - clang 11 17 steps: 12 18 - name: install dependencies 13 19 command: npm install 14 20 21 + - name: build external wasm models 22 + environment: 23 + MODEL_REPOS: >- 24 + https://tangled.org/akshitgaur2005.tngl.sh/depth_anything_v3_burn|depth 25 + command: | 26 + # --- FIX START --- 27 + # 1. Force using clang for cross-compilation 28 + export CC_wasm32_unknown_unknown=clang 29 + export CFLAGS_wasm32_unknown_unknown="-Wno-macro-redefined" 30 + 31 + # 2. STRIP NIX WRAPPERS: 32 + # Nix injects flags for x86_64 Linux (like -I/nix/store/.../include). 33 + # We must remove them so the compiler doesn't pull in Linux headers for WASM. 34 + unset NIX_CFLAGS_COMPILE 35 + unset NIX_LDFLAGS 36 + unset C_INCLUDE_PATH 37 + unset LD_LIBRARY_PATH 38 + # --- FIX END --- 39 + 40 + mkdir -p public/wasm 41 + mkdir -p temp_build 42 + cd temp_build 43 + 44 + for entry in $MODEL_REPOS; do 45 + url="${entry%%|*}" 46 + name="${entry##*|}" 47 + 48 + echo "--- Processing: $name from $url ---" 49 + git clone "$url" "$name" 50 + 51 + cd "$name" 52 + echo "Checking out 'web' branch..." 53 + git checkout web 54 + 55 + echo "Building WASM..." 56 + wasm-pack build --target web --out-dir ../../public/wasm/$name --no-typescript --release 57 + 58 + rm -f ../../public/wasm/$name/.gitignore 59 + cd .. 60 + done 61 + 62 + cd .. 63 + rm -rf temp_build 64 + 15 65 - name: build site 16 66 # Use 'npm run build' which runs 'astro build' 17 67 command: npm run build 18 68 19 69 - name: deploy 20 70 command: | 21 - npx --yes wrangler pages deploy dist --project-name himwant --branch main 71 + npx --yes wrangler pages deploy dist --project-name himwant --branch main