cg-from-scratch/compile

34 lines
784 B
Bash
Executable File

#!/bin/bash
WAPP_INCLUDE="$(find ./intern/wapp/src -type d | xargs -I{} echo -n "-I{} ")"
WAPP_SRC="$(find ./intern/wapp/src -type f -name "*.c" | xargs -I{} echo -n "{} ")"
CC=clang
CFLAGS="-g -Wall -Werror -pedantic -Iinclude $WAPP_INCLUDE $(pkg-config --cflags sdl2)"
LIBS="$(pkg-config --libs sdl2) -lm"
RAYTRACER_SRC="src/window/*.c \
src/vector/*.c \
src/scene/*.c \
src/raytracer/*.c \
src/math/*.c \
"
RASTERISER_SRC="src/window/*.c \
src/vector/*.c \
src/scene/*.c \
src/list/*.c \
src/rasteriser/*.c \
src/math/*.c \
$WAPP_SRC \
"
BUILD=build_dir
RAYTRACER_OUT="$BUILD/raytracer"
RASTERISER_OUT="$BUILD/rasteriser"
mkdir -p $BUILD
(set -x ; $CC $CFLAGS $LIBS $RAYTRACER_SRC -o $RAYTRACER_OUT)
(set -x ; $CC $CFLAGS $LIBS $RASTERISER_SRC -o $RASTERISER_OUT)