-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathbuild_windows.sh
More file actions
executable file
·37 lines (29 loc) · 1.32 KB
/
Copy pathbuild_windows.sh
File metadata and controls
executable file
·37 lines (29 loc) · 1.32 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
#!/bin/bash
# Cross-compile a Windows build from Linux using the MinGW-w64 GNU toolchain,
# then package exe + assets into a folder you can zip and ship.
source "$(dirname "$0")/game.env"
echo "=== Preparing Windows Build Environment ==="
rustup target add x86_64-pc-windows-gnu
echo "=== Building for Windows (Release) ==="
cargo build --release --target x86_64-pc-windows-gnu
if [ $? -eq 0 ]; then
echo "=== Build Successful! ==="
DIST_DIR="target/windows_dist"
echo "Packaging into $DIST_DIR..."
mkdir -p "$DIST_DIR"
# Copy the Windows executable
cp "target/x86_64-pc-windows-gnu/release/$GAME_NAME.exe" "$DIST_DIR/"
# Copy the assets folder (assets are also embedded in the exe via
# bevy_embedded_assets, but shipping the folder keeps hot-swapping easy)
cp -r assets "$DIST_DIR/"
echo "Done! The Windows build is ready."
echo "Folder: $DIST_DIR"
echo "You can zip this folder and send it to a Windows machine to play."
else
echo "=== Build Failed ==="
echo "You may need to install the MinGW-w64 C/C++ compiler for cross-compiling."
echo "Try one of the following depending on your Linux distribution:"
echo " Ubuntu/Debian: sudo apt install gcc-mingw-w64"
echo " Fedora: sudo dnf install mingw64-gcc"
echo " Arch: sudo pacman -S mingw-w64-gcc"
fi