Files
EMBS/Practicals/hlsdev/fetch-headers.sh

54 lines
1.7 KiB
Bash
Executable File

#!/usr/bin/env bash
#
# Copy the real Vitis HLS headers down from the CS server.
#
# Only header files are copied - a few MB, not the 60 GB toolchain - so clangd
# and ./sim.sh work against the genuine ap_int.h / hls_stream.h instead of the
# stand-in in hlsdev/include-stub.
#
# You will be asked for your gateway password / Duo approval, because the
# server is behind the IT Services SSH gateway.
#
# Usage:
# ./fetch-headers.sh # copy
# ./fetch-headers.sh --dry-run # just report what is there and how big it is
#
set -euo pipefail
here="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
inc="$here/include"
host="${EMBS_HOST:-csteach0.york.ac.uk}"
vitis="${VITIS_ROOT:-/opt/york/cs/net/xilinx_vivado-2025.1-x86_64-1/2025.1/Vitis}"
sim_inc="$vitis/include"
syn_inc="$vitis/common/technology/autopilot"
echo "host : $host"
echo "sim inc : $sim_inc"
echo "syn inc : $syn_inc"
echo
echo "Asking the server what is there ..."
ssh "$host" "
du -sh '$sim_inc' '$syn_inc' 2>/dev/null || true
echo
echo 'ap_int.h / hls_stream.h found at:'
find '$sim_inc' '$syn_inc' -maxdepth 2 \\( -name ap_int.h -o -name hls_stream.h -o -name ap_fixed.h \\) 2>/dev/null
" || { echo "error: could not reach $host" >&2; exit 1; }
if [ "${1:-}" = "--dry-run" ]; then
echo
echo "--dry-run: nothing copied."
exit 0
fi
mkdir -p "$inc"
echo
echo "Copying headers (watch for the password prompt) ..."
rsync -a --info=progress2 "$host:$sim_inc/" "$inc/"
rsync -a --info=progress2 "$host:$syn_inc/" "$inc/"
echo
echo "Done. $(find "$inc" -name '*.h' | wc -l | tr -d ' ') headers now in $inc"
echo "clangd and ./sim.sh will use these in preference to the stub."