X-Git-Url: https://harrygodden.com/git/?a=blobdiff_plain;f=build.sh;h=ab013e2b2371ec28eaa18311d656abe52d0b7a41;hb=eb539f4993a936fee522af4a977e39186de47396;hp=598e7fe57473fad96f2c69f7d71b5c0431735c27;hpb=87f9f2a4d239b9834afc1fa1ee07cc13b4a8217b;p=fishladder.git diff --git a/build.sh b/build.sh index 598e7fe..ab013e2 100755 --- a/build.sh +++ b/build.sh @@ -15,11 +15,13 @@ fi run_after=false do_build=true +compile_tools=false +compile_models=false while (( "$#" )); do case $1 in -r|--release) - flags="-O3" + flags="-O3 -Wno-unused-function -DNO_STEAM" echo "Release mode" ;; -p|--play) @@ -30,6 +32,14 @@ while (( "$#" )); do do_build=false echo "no-build" ;; + -t|--tools) + compile_tools=true + echo "build-tools" + ;; + -m|--models) + compile_models=true + echo "build-models" + ;; *) echo "Unkown param: $1" exit 1 @@ -38,6 +48,23 @@ while (( "$#" )); do shift done +# Tools +if [ "$compile_tools" = true ]; then + echo "Building tools" + mkdir tools -p + gcc -Wall -Wstrict-aliasing=3 $lib $flags mdlcomp.c gl/glad.c -o tools/mdlcomp $libs -Wl,-rpath=./ $defines + gcc -Wall -Wstrict-aliasing=3 $lib $flags fontcomp.c gl/glad.c -o tools/fontcomp $libs -Wl,-rpath=./ $defines +fi + +# Resources +if [ "$compile_models" = true ]; then + echo "Recompiling models" + for f in models/*.obj; + do echo "Compiling $f.."; + ./tools/mdlcomp $f $f.h + done +fi + # Main build if [ "$do_build" = true ]; then gcc -Wall -Wstrict-aliasing=3 $lib $flags $src gl/glad.c -o $target $libs -Wl,-rpath=./ $defines @@ -54,10 +81,14 @@ if [[ "$OSTYPE" == "linux-gnu"* ]]; then # Directories to initialize mkdir build.linux/cfg -p mkdir build.linux/textures -p + mkdir build.linux/sound -p + mkdir build.linux/maps -p cp $target ./build.linux/$target cp ./steam/libsteam_api.so ./build.linux/libsteam_api.so cp -r ./textures/ ./build.linux/ + cp -r ./sound/ ./build.linux/ + cp -r ./maps/ ./build.linux/ if [ "$run_after" = true ]; then echo "Playing" @@ -69,9 +100,13 @@ if [[ "$OSTYPE" == "linux-gnu"* ]]; then else mkdir build.win32/cfg -p mkdir build.win32/textures -p + mkdir build.win32/sound -p + mkdir build.win32/maps -p cp $target ./build.win32/$target cp -r ./textures/ ./build.win32/ + cp -r ./sound/ ./build.win32/ + cp -r ./maps/ ./build.win32/ cp ./lib/glfw3.dll ./build.win32/glfw3.dll if [ "$run_after" = true ]; then @@ -81,4 +116,4 @@ else ./$target cd ./../ fi -fi \ No newline at end of file +fi