45 lines
1.0 KiB
Bash
Executable File
45 lines
1.0 KiB
Bash
Executable File
#!/bin/bash
|
|
set -eo pipefail
|
|
|
|
LOG_FILE="build_win.log"
|
|
> "$LOG_FILE"
|
|
|
|
log() { echo "$1"; echo "$1" >> "$LOG_FILE"; }
|
|
|
|
log "================================"
|
|
log "ChatGUI Build Script (MSYS2 UCRT64)"
|
|
log "================================"
|
|
log ""
|
|
|
|
SRC_DIR="$(cd "$(dirname "$0")" && pwd)"
|
|
BUILD_DIR="$SRC_DIR/build"
|
|
|
|
log "Source: $SRC_DIR"
|
|
log "Build: $BUILD_DIR"
|
|
log ""
|
|
|
|
log "[1/3] Configuring CMake..."
|
|
cmake -S "$SRC_DIR" -B "$BUILD_DIR" -G "MSYS Makefiles" 2>&1 | tee -a "$LOG_FILE"
|
|
test ${PIPESTATUS[0]} -eq 0 || { log "CMake configure FAILED"; exit 1; }
|
|
|
|
log ""
|
|
log "[2/3] Building..."
|
|
cmake --build "$BUILD_DIR" 2>&1 | tee -a "$LOG_FILE"
|
|
test ${PIPESTATUS[0]} -eq 0 || { log "Build FAILED"; exit 1; }
|
|
|
|
log ""
|
|
log "[3/3] Verifying..."
|
|
EXE="$BUILD_DIR/chatgui.exe"
|
|
if [ -f "$EXE" ]; then
|
|
SIZE=$(du -h "$EXE" | cut -f1)
|
|
log " OK: chatgui.exe ($SIZE)"
|
|
log ""
|
|
log "================================"
|
|
log "Build SUCCESS"
|
|
log "================================"
|
|
log "Executable: $EXE"
|
|
else
|
|
log " FAIL: chatgui.exe not found"
|
|
exit 1
|
|
fi
|