#!/bin/bash

time clang++ -std=c++14 \
        -I"/home/vittorioromeo/OHWorkspace/ecst/include" \
        -I"/home/vittorioromeo/OHWorkspace/vrm_core/include" \
        -I"/home/vittorioromeo/OHWorkspace/vrm_pp/include" \
        -W \
        -Wall \
        -Wextra \
        -O2 \
        -ffast-math \
        -ftree-vectorize \
        -pedantic \
        -DNDEBUG \
        -lpthread \
        -lsfml-system \
        -lsfml-graphics \
        -lsfml-window \
        -fdiagnostics-color=always \
        $1 -o /tmp/x.x &> error.out

if [ $? == 0 ]; then
    echo "Compiled." && cat ./error.out | ./simplify_error.py 0 && /tmp/x.x "${@:2}"
else
    echo "Failed." && cat ./error.out | ./simplify_error.py 0
fi
