#!/usr/bin/env bash set -Eeuo pipefail ROOT="$(cd -- "$(dirname -- "${BASH_SOURCE[0]}")/.." && pwd)" BUILD_ROOT="$ROOT/build/examples-arm64" rm -rf "$BUILD_ROOT" mkdir -p "$BUILD_ROOT/c" "$BUILD_ROOT/cpp" "$ROOT/examples/bin" cmake -S "$ROOT/examples/c" -B "$BUILD_ROOT/c" \ -DCMAKE_BUILD_TYPE=Release \ -DCMAKE_C_COMPILER=aarch64-linux-gnu-gcc cmake --build "$BUILD_ROOT/c" --parallel cmake -S "$ROOT/examples/cpp" -B "$BUILD_ROOT/cpp" \ -DCMAKE_BUILD_TYPE=Release \ -DCMAKE_C_COMPILER=aarch64-linux-gnu-gcc \ -DCMAKE_CXX_COMPILER=aarch64-linux-gnu-g++ cmake --build "$BUILD_ROOT/cpp" --parallel cp -f "$BUILD_ROOT/c/yolo_c_example" "$ROOT/examples/bin/yolo_c_example" cp -f "$BUILD_ROOT/cpp/yolo_cpp_example" "$ROOT/examples/bin/yolo_cpp_example" for binary in "$ROOT/examples/bin/yolo_c_example" "$ROOT/examples/bin/yolo_cpp_example"; do aarch64-linux-gnu-readelf -h "$binary" | grep -q 'Machine:.*AArch64' aarch64-linux-gnu-readelf -d "$binary" | grep -q 'libyolo_runtime.so.2' done for library in "$ROOT"/lib/*.so*; do aarch64-linux-gnu-readelf -h "$library" | grep -q 'Machine:.*AArch64' done rm -rf "$BUILD_ROOT" printf 'AARCH64_EXAMPLES_OK\n'