]> git.lizzy.rs Git - dragonblocks_alpha.git/blob - snapshot.sh
Rework structure
[dragonblocks_alpha.git] / snapshot.sh
1 #!/bin/bash
2 set -e
3
4 VERSION=`git tag --points-at HEAD`
5 if [[ $VERSION = "" ]]; then
6         VERSION=`git rev-parse --short HEAD`
7 fi
8
9 BUILD=build-release
10 SNAPSHOT=dragonblocks_alpha-$VERSION
11 TOOLCHAIN=
12 DOTEXE=
13 DOTSH=".sh"
14 if [[ "$1" == "mingw" ]]; then
15         BUILD=build-mingw
16         SNAPSHOT=dragonblocks_alpha-win64-$VERSION
17         TOOLCHAIN=mingw.cmake
18         DOTEXE=".exe"
19         DOTSH=".bat"
20 fi
21
22 mkdir -p $BUILD
23
24 cmake -B $BUILD -S src \
25         -DCMAKE_BUILD_TYPE="Release" \
26         -DASSET_PATH="assets/" \
27         -DCMAKE_C_FLAGS="-Ofast" \
28         -DCMAKE_TOOLCHAIN_FILE="$TOOLCHAIN"
29
30 make --no-print-directory -C $BUILD -j$(nproc)
31
32 rm -rf $SNAPSHOT
33 mkdir $SNAPSHOT
34
35 cp -r \
36         assets \
37         $BUILD/dragonblocks_client$DOTEXE \
38         $BUILD/dragonblocks_server$DOTEXE \
39         singleplayer$DOTSH \
40         LICENSE \
41         README.md \
42         $SNAPSHOT
43
44 zip -r $SNAPSHOT.zip $SNAPSHOT/*