diff --git a/.gitignore b/.gitignore index c265372..b371bee 100644 --- a/.gitignore +++ b/.gitignore @@ -1,3 +1,4 @@ /target /binbreak_highscores.txt /.idea +/executables diff --git a/Cargo.lock b/Cargo.lock index 5067b3b..6e3567f 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -40,7 +40,7 @@ dependencies = [ [[package]] name = "binbreak" -version = "0.1.0" +version = "0.3.0" dependencies = [ "color-eyre", "crossterm 0.29.0", diff --git a/Cargo.toml b/Cargo.toml index 53b459c..7331c67 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "binbreak" -version = "0.1.0" +version = "0.3.0" description = "A terminal based binary number guessing game" authors = ["William Raendchen "] license = "MIT" diff --git a/build.sh b/build.sh new file mode 100755 index 0000000..26dee64 --- /dev/null +++ b/build.sh @@ -0,0 +1,46 @@ +#!/bin/bash + +# Build script for binbreak game +# Builds for Linux and Windows, copies executables to executables/ directory + +set -e # Exit on error + +echo "🔨 Building binbreak for multiple platforms..." +echo "" + +# Create executables directory if it doesn't exist +EXEC_DIR="executables" +mkdir -p "$EXEC_DIR" + +# Get version from Cargo.toml +VERSION=$(grep '^version' Cargo.toml | head -n1 | cut -d'"' -f2) + +# Build for Linux (native) +echo "📦 Building for Linux (x86_64)..." +cargo build --release +LINUX_BIN="binbreak-v${VERSION}-linux-x86_64" +cp "target/release/binbreak" "$EXEC_DIR/$LINUX_BIN" +echo "✅ Linux build complete: $EXEC_DIR/$LINUX_BIN" +echo "" + +# Build for Windows +echo "📦 Building for Windows (x86_64)..." +if ! rustup target list | grep -q "x86_64-pc-windows-gnu (installed)"; then + echo "⚠️ Installing Windows target (x86_64-pc-windows-gnu)..." + rustup target add x86_64-pc-windows-gnu +fi + +cargo build --release --target x86_64-pc-windows-gnu +WINDOWS_BIN="binbreak-v${VERSION}-windows-x86_64.exe" +cp "target/x86_64-pc-windows-gnu/release/binbreak.exe" "$EXEC_DIR/$WINDOWS_BIN" +echo "✅ Windows build complete: $EXEC_DIR/$WINDOWS_BIN" +echo "" + +# Print summary +echo "🎉 All builds complete!" +echo "" +echo "Executables:" +ls -lh "$EXEC_DIR" | tail -n +2 +echo "" +echo "Location: $EXEC_DIR/" +