139 lines
6.5 KiB
Bash
Executable File
139 lines
6.5 KiB
Bash
Executable File
#!/usr/bin/env bash
|
|
#
|
|
# build_bundle.sh - assemble a per-OS runnable bundle of the webcam virtual Kinect v1
|
|
# from already-built artifacts. It copies, it does not build (run the builds first, per
|
|
# docs/setup-linux.md and docs/setup-windows.md), so a bundle always reflects real,
|
|
# verified outputs rather than a fresh untested compile.
|
|
#
|
|
# Usage:
|
|
# packaging/build_bundle.sh linux [OUTDIR] # default OUTDIR: dist/kinect-linux
|
|
# packaging/build_bundle.sh windows [OUTDIR] # default OUTDIR: dist/kinect-windows
|
|
#
|
|
# What it MUST NOT do (and does not): bundle the MS Kinect 1.8 runtime, NiTE2, or any DEA
|
|
# asset. Those are linked from the docs and supplied by the user. This script only packages
|
|
# first-party build outputs plus the docs.
|
|
#
|
|
set -euo pipefail
|
|
|
|
ROOT="$(cd "$(dirname "${BASH_SOURCE[0]}")/.." && pwd)"
|
|
OS="${1:-}"
|
|
case "$OS" in
|
|
linux|windows) ;;
|
|
*) echo "usage: $0 <linux|windows> [outdir]" >&2; exit 2 ;;
|
|
esac
|
|
OUTDIR="${2:-$ROOT/dist/kinect-$OS}"
|
|
|
|
say() { printf '[bundle] %s\n' "$*"; }
|
|
die() { printf '[bundle] ERROR: %s\n' "$*" >&2; exit 1; }
|
|
need() { [ -e "$1" ] || die "missing artifact: $1 (build it first, see docs/setup-$OS.md)"; }
|
|
copy() { mkdir -p "$(dirname "$2")"; cp -a "$1" "$2"; say "+ ${2#$OUTDIR/}"; }
|
|
|
|
rm -rf "$OUTDIR"
|
|
mkdir -p "$OUTDIR"
|
|
|
|
# --- docs shared by every bundle ---
|
|
copy "$ROOT/README.md" "$OUTDIR/README.md"
|
|
copy "$ROOT/LICENSE" "$OUTDIR/LICENSE"
|
|
copy "$ROOT/ThirdPartyNotices.txt" "$OUTDIR/ThirdPartyNotices.txt"
|
|
copy "$ROOT/docs/setup-$OS.md" "$OUTDIR/docs/setup-$OS.md"
|
|
copy "$ROOT/docs/calibration.md" "$OUTDIR/docs/calibration.md"
|
|
copy "$ROOT/docs/troubleshooting.md" "$OUTDIR/docs/troubleshooting.md"
|
|
|
|
if [ "$OS" = linux ]; then
|
|
# --- the tracker (Python source; the user creates tracker/.venv per the setup guide) ---
|
|
# The .venv and model bundles are environment-specific and are NOT bundled; the setup guide
|
|
# reproduces them. We ship the source, pyproject, and a models/ placeholder with instructions.
|
|
mkdir -p "$OUTDIR/tracker"
|
|
for f in __init__.py contract.py control.py fake_pose.py joint_mapping.py pose.py \
|
|
publisher.py tracker.py pyproject.toml README.md; do
|
|
copy "$ROOT/tracker/$f" "$OUTDIR/tracker/$f"
|
|
done
|
|
mkdir -p "$OUTDIR/tracker/models"
|
|
cat > "$OUTDIR/tracker/models/README.txt" <<'EOF'
|
|
Download the MediaPipe pose_landmarker .task bundles here (lite/full/heavy).
|
|
See docs/setup-linux.md step 2a for the exact curl commands.
|
|
EOF
|
|
|
|
# --- OS-agnostic core library + the verified Linux OpenNI2 surface + e2e harness ---
|
|
core_lib=""
|
|
for cand in "$ROOT/build/linux/core/libnui_core.a" \
|
|
"$ROOT/attach/linux/build/core/libnui_core.a"; do
|
|
[ -e "$cand" ] && { core_lib="$cand"; break; }
|
|
done
|
|
[ -n "$core_lib" ] || die "missing libnui_core.a (build the core, see docs/setup-linux.md)"
|
|
copy "$core_lib" "$OUTDIR/lib/libnui_core.a"
|
|
|
|
need "$ROOT/fallback/linux-openni2/build/OpenNI2/Drivers/libSynthKinect.so.0"
|
|
copy "$ROOT/fallback/linux-openni2/build/OpenNI2/Drivers/libSynthKinect.so.0" \
|
|
"$OUTDIR/openni2/Drivers/libSynthKinect.so.0"
|
|
copy "$ROOT/fallback/linux-openni2/build/openni2_depth_consumer" \
|
|
"$OUTDIR/bin/openni2_depth_consumer"
|
|
[ -e "$ROOT/tools/e2e_linux_validation/build/depth_stats_consumer" ] && \
|
|
copy "$ROOT/tools/e2e_linux_validation/build/depth_stats_consumer" \
|
|
"$OUTDIR/bin/depth_stats_consumer"
|
|
|
|
[ -e "$ROOT/attach/linux/build/kinect_attach" ] && \
|
|
copy "$ROOT/attach/linux/build/kinect_attach" "$OUTDIR/bin/kinect_attach"
|
|
|
|
# the e2e harness + its deps, so a bundle can self-validate
|
|
copy "$ROOT/tools/e2e_linux_validation/run_e2e.py" \
|
|
"$OUTDIR/tools/e2e_linux_validation/run_e2e.py"
|
|
copy "$ROOT/tools/e2e_linux_validation/generate_dance_video.py" \
|
|
"$OUTDIR/tools/e2e_linux_validation/generate_dance_video.py"
|
|
|
|
cat > "$OUTDIR/RUN.txt" <<'EOF'
|
|
Linux bundle. Deploy openni2/Drivers/libSynthKinect.so.0 into your OpenNI2 install's
|
|
<libdir>/OpenNI2/Drivers, start the tracker (docs/setup-linux.md), then run
|
|
bin/openni2_depth_consumer. See docs/setup-linux.md for the full reproduction.
|
|
EOF
|
|
|
|
elif [ "$OS" = windows ]; then
|
|
# --- the native, zero-Python tracker: exe + its ONNX Runtime + pose model ---
|
|
tracker_dist="$ROOT/tracker-native/build/dist"
|
|
need "$tracker_dist/kinect-tracker.exe"
|
|
need "$tracker_dist/onnxruntime.dll"
|
|
need "$ROOT/tracker-native/models/pose_landmarks_detector.onnx"
|
|
copy "$tracker_dist/kinect-tracker.exe" "$OUTDIR/kinect-tracker.exe"
|
|
copy "$tracker_dist/onnxruntime.dll" "$OUTDIR/onnxruntime.dll"
|
|
copy "$ROOT/tracker-native/models/pose_landmarks_detector.onnx" \
|
|
"$OUTDIR/models/pose_landmarks_detector.onnx"
|
|
|
|
# --- the clean-room Kinect10.dll NUI shim, both arches ---
|
|
need "$ROOT/fallback/windows-nui/build/Kinect10-x86.dll"
|
|
need "$ROOT/fallback/windows-nui/build/Kinect10-x64.dll"
|
|
copy "$ROOT/fallback/windows-nui/build/Kinect10-x86.dll" "$OUTDIR/shim/x86/Kinect10.dll"
|
|
copy "$ROOT/fallback/windows-nui/build/Kinect10-x64.dll" "$OUTDIR/shim/x64/Kinect10.dll"
|
|
|
|
cat > "$OUTDIR/RUN.txt" <<'EOF'
|
|
Webcam virtual Kinect v1 - Windows player bundle (no build, no Python)
|
|
|
|
What's here:
|
|
kinect-tracker.exe the webcam -> Kinect pose tracker (run this)
|
|
onnxruntime.dll its runtime (keep beside the exe)
|
|
models/*.onnx the pose model (keep the models/ folder beside the exe)
|
|
shim/x86/Kinect10.dll 32-bit NUI shim (most DEA/spice2x builds)
|
|
shim/x64/Kinect10.dll 64-bit NUI shim
|
|
docs/calibration.md the cursor calibration note
|
|
docs/setup-windows.md full setup reference
|
|
LICENSE, ThirdPartyNotices.txt
|
|
|
|
Setup (once):
|
|
1. Install the Microsoft Kinect for Windows 1.8 Runtime. It is NOT bundled here;
|
|
get it from Microsoft. The game loads Kinect10.dll, so the runtime's own
|
|
dependencies must be present on the machine.
|
|
2. Copy shim/<arch>/Kinect10.dll into the DanceEvolution Arcade contents folder
|
|
next to gamekdm.dll, matching the game's bitness (x86 for 32-bit spice2x,
|
|
x64 for 64-bit). This puts our shim in place of the real Kinect10.dll.
|
|
|
|
Each session:
|
|
3. Plug in your webcam and run kinect-tracker.exe. Pick your camera (the choice
|
|
is remembered). Keep onnxruntime.dll and the models/ folder beside the exe.
|
|
4. Start capture, then click "Calibrate cursor" and raise your right arm as
|
|
prompted so the menu hand-cursor reaches every corner (see docs/calibration.md).
|
|
5. Launch DanceEvolution Arcade. It sees the virtual Kinect.
|
|
EOF
|
|
fi
|
|
|
|
say "bundle assembled at: $OUTDIR"
|
|
say "done."
|