#!/bin/bash # Default to x86 if no architecture is specified ARCH=${1:-x86} # Set the appropriate target based on the architecture if [ "$ARCH" = "armv7" ]; then TARGET="armv7-unknown-linux-gnueabi" sudo apt-get install -y gcc-arm-linux-gnueabi sudo apt-get install -y g++-arm-linux-gnueabi rustup target add armv7-unknown-linux-gnueabi export CARGO_TARGET_ARMV7_UNKNOWN_LINUX_GNUEABI_LINKER=arm-linux-gnueabi-gcc export CC_armv7_unknown_linux_gnueabi=arm-linux-gnueabi-gcc export CXX_armv7_unknown_linux_gnueabi=arm-linux-gnueabi-gcc elif [ "$ARCH" = "x86" ]; then TARGET="x86_64-unknown-linux-gnu" else echo "Unsupported architecture. Use 'x86' or 'armv7'." exit 1 fi echo "Building for $ARCH architecture..." # Build the benchmarks cargo bench --no-run --target $TARGET # Find the most recent benchmark executable BENCH_EXEC=$(ls -t target/$TARGET/release/deps/*-* | head -n1) if [ -z "$BENCH_EXEC" ]; then echo "No benchmark executable found" exit 1 fi echo "Found most recent benchmark executable: $BENCH_EXEC" cp $BENCH_EXEC ./benchmark_$ARCH echo "Running benchmark..." ./benchmark_$ARCH --bench