Merge pull request #12 from vonhyou/utils

add script to build and run
This commit is contained in:
Shuo Feng 2024-03-04 03:02:17 -05:00 committed by GitHub
commit dbc959ef80
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

23
run.sh Executable file
View file

@ -0,0 +1,23 @@
#!/bin/bash
# Build the cmake project
cmake -S . -B build
cmake --build build
# Check if the build was successful
if [ ! -f "build/raytracer" ]; then
echo "Build directory not found. Build failed."
exit 1
fi
# Run the program for each json file in the specified filepath
for jsonfile in "assets"/*.json; do
if [ -f "$jsonfile" ]; then
echo "Processing $jsonfile..."
build/raytracer "$jsonfile"
else
echo "No JSON files found in $FILEPATH."
break
fi
done
rm -f build/raytracer