From df5557d1fc86479d6a1aa6a146c9cf2062065125 Mon Sep 17 00:00:00 2001 From: Abdelrahman Said Date: Mon, 18 Dec 2023 13:24:45 +0000 Subject: [PATCH] Update build scripts --- compile | 8 +++++--- run | 22 +++++++++++++++++++++- 2 files changed, 26 insertions(+), 4 deletions(-) diff --git a/compile b/compile index d99205d..07b329e 100644 --- a/compile +++ b/compile @@ -4,11 +4,13 @@ CC=clang CFLAGS="-g -Wall -Werror -pedantic -Iinclude $(pkg-config --cflags sdl2)" LIBS="$(pkg-config --libs sdl2)" -SRC="src/*.c" +RAYTRACER_SRC="src/window/*.c \ + src/raytracer/*.c \ +" BUILD=build_dir -OUT="$BUILD/main" +RAYTRACER_OUT="$BUILD/raytracer" mkdir -p $BUILD -(set -x ; $CC $CFLAGS $LIBS $SRC -o $OUT) +(set -x ; $CC $CFLAGS $LIBS $RAYTRACER_SRC -o $RAYTRACER_OUT) diff --git a/run b/run index 4485a73..b9b89d0 100644 --- a/run +++ b/run @@ -1,3 +1,23 @@ #!/bin/bash -./build_dir/main +USAGE="Usage: run (raytracer | rasteriser)" + +if [[ $# == 0 ]]; then + echo $USAGE + exit 1 +fi + +while [[ $# -gt 0 ]]; do + case $1 in + raytracer) + RENDERER="raytracer" + shift # past argument + ;; + -*|--*|*) + echo $USAGE + exit 1 + ;; + esac +done + +./build_dir/$RENDERER