X-Git-Url: https://git.lizzy.rs/?a=blobdiff_plain;f=snapshot.sh;h=3aa830939e84793f3c42047206c4cf8339becbef;hb=77d98fc9a3a882390e06f3618f70de5cde59124c;hp=9c1098fc482e74c3cfdcc7c174f8753af72db74c;hpb=6d60079b8f06b9701c4e823d33ac11a843814183;p=dragonblocks_alpha.git diff --git a/snapshot.sh b/snapshot.sh index 9c1098f..3aa8309 100755 --- a/snapshot.sh +++ b/snapshot.sh @@ -1,23 +1,47 @@ #!/bin/bash +set -e + VERSION=`git tag --points-at HEAD` if [[ $VERSION = "" ]]; then VERSION=`git rev-parse --short HEAD` fi -DIR=dragonblocks_alpha-$VERSION -mkdir .build -cp -r * .build/ -cd .build/ -mkdir build -cd build -if ! (cmake -B . -S ../src -DCMAKE_BUILD_TYPE=Release -DRESSOURCE_PATH="\"\"" -DCMAKE_C_FLAGS="-Ofast" && make clean && make -j$(nproc)); then - cd ../.. - rm -rf .build - exit 1 + +BUILD=build-release +SNAPSHOT=dragonblocks_alpha-$VERSION +TOOLCHAIN= +DOTEXE= +DOTSH=".sh" +FLAGS="-Ofast" +if [[ "$1" != "" ]]; then + BUILD=build-$1 + SNAPSHOT=dragonblocks_alpha-$1-$VERSION + TOOLCHAIN=$1.cmake + DOTEXE=".exe" + DOTSH=".bat" + FLAGS="$FLAGS -static" fi -cp dragonblocks dragonblocks_server .. -cd .. -rm -rf .git* deps src build BUILDING.md snapshot.sh upload.sh dragonblocks_alpha-* screenshot-*.png -cd .. -mv .build $DIR -zip -r $DIR.zip $DIR/* -rm -rf $DIR + +mkdir -p $BUILD + +cmake -B $BUILD -S src \ + -DCMAKE_BUILD_TYPE="Release" \ + -DASSET_PATH="assets/" \ + -DCMAKE_C_FLAGS="$FLAGS" \ + -DCMAKE_CXX_FLAGS="$FLAGS" \ + -DCMAKE_TOOLCHAIN_FILE="$TOOLCHAIN" + +make --no-print-directory -C $BUILD -j$(nproc) + +rm -rf $SNAPSHOT +mkdir $SNAPSHOT + +cp -r \ + assets \ + $BUILD/dragonblocks_client$DOTEXE \ + $BUILD/dragonblocks_server$DOTEXE \ + singleplayer$DOTSH \ + LICENSE \ + README.md \ + $SNAPSHOT + +zip -r $SNAPSHOT.zip $SNAPSHOT/*