Files
GenericQtClient/installer/compile-executable.sh

60 lines
1.4 KiB
Bash
Executable File

#!/bin/bash
echo amount of arguments: $#
if [[ $# -ne 4 ]]; then
echo "Build script has to be called with exactly two arguments."
echo "The version number (Major.Minor.Patch) as its first argument."
echo "... and the OS (linux, windows or macos) as the second argument"
echo "TODO: DOCUMENT ARGUMENTS 3 & 4!!!"
echo "Aborting..."
exit 1
fi
VERSION=$1
regex='^([0-9]+\.){0,2}(\*|[0-9]+)$'
if [[ $VERSION =~ $regex ]]; then
echo "Version accepted: $VERSION"
else
echo "Version '$VERSION' is not acceptable. Aborting..."
exit 1
fi
PLATFORM=$2
# TODO refactor this to use something like PLATFORMS.contains(PLATFORM)
if [[ $PLATFORM == linux ]]; then
echo "OS: $PLATFORM"
#QMAKE_EXE="qmake"
COMPILER_EXE="make"
elif [[ $PLATFORM == windows ]]; then
echo "OS: $PLATFORM"
#QMAKE_EXE="$QMAKE_LOCATION/qmake"
#COMPILER_EXE="$MINGWROOT/bin/mingw32-make"
elif [[ $PLATFORM == macos ]]; then
echo "OS: $PLATFORM"
#QMAKE_EXE="qmake"
COMPILER_EXE="make"
else
echo "Platform '$PLATFORM' is not acceptable. Aborting..."
exit 1
fi
echo "Starting build ..."
OLD_PWD=$(pwd)
BUILD_DIR="_build"
echo "starting in: ${OLD_PWD}"
# if [[ -e $BUILD_DIR/$TARGET ]]; then
# echo "old build dir has old content, cleaning the build directory..."
# rm -r $BUILD_DIR/*
# fi
cd $BUILD_DIR
echo "Building in $(pwd) ..."
echo "Building whole project..."
echo "Running CMake..."
cmake -DCMAKE_BUILD_TYPE=Release ../../
echo "Compiling..."
$COMPILER_EXE