#Creates a release build that focuses on high runtime performance. Use "full" argument to completely rebuild PGE.
#C++
printf "Running program...\n\n\n"
output=$(dpkg -l | grep libx11-dev)
if [[ -z $output ]]
then
    sudo apt install libx11-dev libpulse-dev mesa-common-dev libpng-dev libstdc++-12-dev
fi
if [ "$1" == "full" ]; then
    rm "pixelGameEngine.o"
fi
if [ ! -f "pixelGameEngine.o" ]
then
    printf "Pixel Game Engine compile object missing. Compiling for the first time..."
    g++ -c pixelGameEngine.cpp
fi
if g++ $(find . -type f -name "*.cpp" -not -path "./test/*" -not -name "pixelGameEngine.cpp") pixelGameEngine.o ${CUSTOM_PARAMS} -o ${PROJECT_NAME}; then
    ./${PROJECT_NAME} "$@"
fi
printf "\n\n"
