Merge branch 'master' of harrygodden.com:/home/fishladder
[fishladder.git] / build.sh
index c24169d30f577750c4fc9d3945672f565d78b7e3..c22ad791c750c60902445519645bcefc33ac33f0 100755 (executable)
--- a/build.sh
+++ b/build.sh
@@ -54,6 +54,7 @@ if [ "$compile_tools" = true ]; then
        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
+       gcc $lib qoiconv.c -std=c99 -O3 -o tools/qoiconv
 fi
 
 # Resources
@@ -65,6 +66,14 @@ if [ "$compile_models" = true ]; then
        done
 fi
 
+# Convert all png to qoi
+echo "Compiling textures"
+mkdir _temp_textures
+for f in textures/*.png;
+       do echo "-> qoi: $f";
+       ./tools/qoiconv $f ./_temp_textures/"$(basename "$f" .png).qoi"
+done
+
 # Main build
 if [ "$do_build" = true ]; then
        gcc -Wall -Wstrict-aliasing=3 $lib $flags $src gl/glad.c -o $target $libs -Wl,-rpath=./ $defines
@@ -87,7 +96,8 @@ if [[ "$OSTYPE" == "linux-gnu"* ]]; then
 
        cp $target ./build.linux/$target
        cp ./steam/libsteam_api.so ./build.linux/libsteam_api.so
-       cp -r ./textures/ ./build.linux/
+       rm -r ./build.linux/textures
+       mv ./_temp_textures/ ./build.linux/textures
        cp -r ./sound/ ./build.linux/
        cp -r ./maps/ ./build.linux/
 
@@ -106,7 +116,8 @@ else
        mkdir build.win32/sav -p
        
        cp $target ./build.win32/$target
-       cp -r ./textures/ ./build.win32/
+       rm -r ./build.win32/textures
+       mv ./_temp_textures/ ./build.win32/textures
        cp -r ./sound/ ./build.win32/
        cp -r ./maps/ ./build.win32/
        cp ./lib/glfw3.dll ./build.win32/glfw3.dll