#!/usr/bin/env sh
set -e
cxx=c++
if [ -n "$CXX_HOST" ]; then cxx=$CXX_HOST; fi
build_dir=host-build
if [ -n "$1" ]; then build_dir=$1; fi
mkdir -p "$build_dir"
$cxx -std=c++17 -Wall -Wextra -Werror -pedantic \
  -fsanitize=address,undefined -fno-omit-frame-pointer \
  -Itests/host-shim -Iinclude tests/isr_drivers_host.cpp \
  -o "$build_dir/isr_drivers_host"
ASAN_OPTIONS=detect_leaks=1 "$build_dir/isr_drivers_host"
echo "PASS host: explicit FromISR views, drop-newest and one accumulated yield"
