summaryrefslogtreecommitdiff
path: root/scripts/project_init.sh
blob: 4ee1c13197ee417956f74b159509f0265f1745c6 (plain)
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
#!/bin/sh
# Fetch minimal third-party dependencies

set -e

echo "Initializing demo64k dependencies..."

mkdir -p third_party

if [ ! -f third_party/stb_image_write.h ]; then
  echo "Fetching stb_image_write.h..."
  curl -L https://raw.githubusercontent.com/nothings/stb/master/stb_image_write.h \
    -o third_party/stb_image_write.h
else
  echo "stb_image_write.h already present."
fi

if [ ! -f third_party/miniaudio.h ]; then
  echo "Fetching miniaudio.h..."
  curl -L https://raw.githubusercontent.com/mackron/miniaudio/master/miniaudio.h     -o third_party/miniaudio.h
else
  echo "miniaudio.h already present."
fi

# glfw3webgpu (helper for GLFW + WebGPU)
mkdir -p third_party/glfw3webgpu
if [ ! -f third_party/glfw3webgpu/glfw3webgpu.h ]; then
  echo "Fetching glfw3webgpu..."
  curl -L https://raw.githubusercontent.com/eliemichel/glfw3webgpu/main/glfw3webgpu.h -o third_party/glfw3webgpu/glfw3webgpu.h
  curl -L https://raw.githubusercontent.com/eliemichel/glfw3webgpu/main/glfw3webgpu.c -o third_party/glfw3webgpu/glfw3webgpu.c
else
  echo "glfw3webgpu already present."
fi

# Check for brew dependencies (macOS)
if command -v brew >/dev/null 2>&1; then
  for pkg in wgpu-native glfw; do
    if ! brew list "$pkg" >/dev/null 2>&1; then
      echo "Warning: $pkg not found via brew. Installing..."
      brew install "$pkg"
    else
      echo "$pkg found (via brew)."
    fi
  done
else
  echo "Warning: Homebrew not found. Ensure wgpu-native and glfw are installed manually."
fi

echo "Done."