The recorder was the gap: it is FTF's own customised SDK example (a 1139-line K4A MKV writer), not a stock sample, and it lived only in one machine's build tree. Bring its source into the repo and build it as part of install. It writes K4A-format MKV — the format the rest of Ithaca reads — so it stays, and gets its libk4a from the Orbbec K4A wrapper rather than Microsoft's Azure Kinect SDK, which is set aside. build_k4a_wrapper.sh builds that wrapper; build_sdk.sh injects the recorder into the SDK examples tree and builds it there against the wrapper (it depends on the SDK's own cmake targets). Found by rpath at runtime, so no LD_LIBRARY_PATH. install.sh now builds wrapper -> SDK+recorder -> preview server, each reusing an existing build so the Nano is untouched. If the wrapper is unavailable the install still completes preview-only and says so. Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
68 lines
2.3 KiB
Bash
Executable File
68 lines
2.3 KiB
Bash
Executable File
#!/usr/bin/env bash
|
|
# Makes sure the Orbbec K4A wrapper is built for THIS platform, and prints where
|
|
# it is as K4A_WRAPPER_DIR=... for build_sdk.sh (the recorder example needs its
|
|
# headers) and for the recorder's runtime rpath (its libk4a.so/libk4arecord.so).
|
|
#
|
|
# This is the libk4a provider — Orbbec's own, NOT Microsoft's Azure Kinect SDK.
|
|
# It bundles its own OrbbecSDK internally, so it builds standalone. The recorder
|
|
# dlopens the libk4a it produces (RTLD_DEEPBIND) rather than link-time linking it,
|
|
# which is why only its build/lib path matters at runtime, not link time.
|
|
#
|
|
# Reuses an existing build (leaving a working node untouched) or clones + builds.
|
|
set -euo pipefail
|
|
|
|
here=$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)
|
|
eval "$("$here/detect_platform.sh")"
|
|
|
|
REPO_URL="${OB_K4A_REPO:-https://github.com/orbbec/OrbbecSDK-K4A-Wrapper}"
|
|
# The tag the Nano runs. A caller can override to one known to build on a newer
|
|
# JetPack.
|
|
REF="${OB_K4A_REF:-v1.10.4}"
|
|
|
|
find_wrapper() {
|
|
local d="$1"
|
|
[[ -f "$d/include/k4a/k4a.h" ]] || return 1
|
|
[[ -f "$d/build/lib/libk4a.so" ]] || return 1
|
|
echo "$d"
|
|
}
|
|
|
|
for candidate in "${K4A_WRAPPER_DIR:-}" \
|
|
"$HOME/OrbbecSDK-K4A-Wrapper" \
|
|
"$HOME/Downloads/OrbbecSDK-K4A-Wrapper"; do
|
|
[[ -z "$candidate" ]] && continue
|
|
if find_wrapper "$candidate" >/dev/null 2>&1; then
|
|
echo ">> Wrapper K4A deja bati, reutilise: $candidate" >&2
|
|
echo "K4A_WRAPPER_DIR=$candidate"
|
|
exit 0
|
|
fi
|
|
done
|
|
|
|
dir="${K4A_WRAPPER_DIR:-$HOME/OrbbecSDK-K4A-Wrapper}"
|
|
echo ">> Wrapper K4A absent — clone et compilation (JetPack ${JETPACK}, ${SOC})" >&2
|
|
echo ">> ${REPO_URL} @ ${REF} -> ${dir}" >&2
|
|
|
|
if [[ ! -d "$dir/.git" ]]; then
|
|
# --recursive: the wrapper carries its OrbbecSDK and depth engine as submodules.
|
|
git clone --recursive --depth 1 --branch "$REF" "$REPO_URL" "$dir" >&2
|
|
fi
|
|
|
|
mkdir -p "$dir/build"
|
|
(
|
|
cd "$dir/build"
|
|
cmake .. -DCMAKE_BUILD_TYPE=Release >&2
|
|
make -j"$(nproc)" k4a k4arecord >&2
|
|
)
|
|
|
|
if ! find_wrapper "$dir" >/dev/null 2>&1; then
|
|
cat >&2 <<EOF
|
|
|
|
!! La compilation du wrapper K4A ne s'est pas terminee comme attendu
|
|
!! (libk4a.so absent de $dir/build/lib).
|
|
!! Bâtis-le une fois a la main, puis relance install.sh avec :
|
|
!! K4A_WRAPPER_DIR=$dir ./install.sh
|
|
EOF
|
|
exit 1
|
|
fi
|
|
echo ">> Wrapper K4A bati: $dir" >&2
|
|
echo "K4A_WRAPPER_DIR=$dir"
|