#Compiles the entire program then runs it, producing an executable. If the "test" argument is included, will try and run tests too (in the test folder). If the "full" argument is included, it will recopmile the PixelGameEngine (should it change)
#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 [ ! -f " ${ PROJECT_NAME } /pixelGameEngine.o " ]
then
printf "Pixel Game Engine compile object missing. Compiling for the first time..."
g++ ${ CUSTOM_PARAMS } -c ${ PROJECT_NAME } /pixelGameEngine.cpp
fi
if [ " $1 " = "test" ]
then
printf "Running tests...\n"
echo "#define TEST_SUITE" > ./test/test.h
if g++ $( find . -type f -name "*.cpp" -not -name " ${ PROJECT_NAME } /pixelGameEngine.cpp " ) pixelGameEngine.o ${ CUSTOM_PARAMS } -o ${ PROJECT_NAME } ; then
./${ PROJECT_NAME } " $@ "
fi
elif [ " $1 " = "full" ]
then
echo "" > ./test/test.h
g++ ${ CUSTOM_PARAMS } -c ${ PROJECT_NAME } /pixelGameEngine.cpp
if g++ $( find . -type f -name "*.cpp" -not -path "./test/*" -not -name " ${ PROJECT_NAME } /pixelGameEngine.cpp " ) ${ PROJECT_NAME } /pixelGameEngine.o ${ CUSTOM_PARAMS } -o ${ PROJECT_NAME } ; then
./${ PROJECT_NAME } " $@ "
fi
else
echo "" > ./test/test.h
if g++ $( find . -type f -name "*.cpp" -not -path "./test/*" -not -name " ${ PROJECT_NAME } /pixelGameEngine.cpp " ) ${ PROJECT_NAME } /pixelGameEngine.o ${ CUSTOM_PARAMS } -o ${ PROJECT_NAME } ; then
./${ PROJECT_NAME } " $@ "
fi
fi
printf "\n\n"