commit 281863a9bed45b9a5df034f7b5cdeff36ee6377c Author: Victor Hans-Georg Waitz <3013050@stud.hs-mannheim.de> Date: Fri Oct 4 17:17:46 2024 +0200 Added build script diff --git a/build.sh b/build.sh new file mode 100644 index 0000000..e1a056b --- /dev/null +++ b/build.sh @@ -0,0 +1,36 @@ +#!/bin/bash + + +input_string="$1" + +if [ -z "$input_string" ]; then + echo "Error: No zig script name provided. Exiting." + exit 1 +fi + +INPUT_NAME=$input_string + +FOLDER_NAME="output" + +SCRIPT_DIR="$(dirname "$0")" + +FOLDER_PATH="$SCRIPT_DIR/$FOLDER_NAME" + + +if [ ! -d "$FOLDER_PATH" ]; then + mkdir "$FOLDER_PATH" +fi + +cd output + +zig build-exe "../$INPUT_NAME" + +executable_name="${INPUT_NAME%.zig}" + +if [ -f "$executable_name" ]; then + + ./"$executable_name" +else + echo "Error: Executable '$executable_name' not found. Build might have failed. Exiting." + exit 1 +fi