aluf/scripts/build_windows.bat

108 lines
3.4 KiB
Batchfile

@echo off
setlocal enabledelayedexpansion
:: ==============================================================================
:: PATHS
:: ==============================================================================
:: This script lives in scripts/
set "SCRIPT_DIR=%~dp0"
:: The build scripts live in windows/
pushd "%SCRIPT_DIR%..\windows"
set "WINDOWS_SCRIPTS_DIR=%CD%"
popd
:: The output dir is build_windows/
pushd "%SCRIPT_DIR%.."
set "PROJECT_ROOT=%CD%"
popd
set "OUTPUT_ROOT=%PROJECT_ROOT%\build_windows"
echo [MASTER] Project Root: %PROJECT_ROOT%
echo [MASTER] Scripts Dir: %WINDOWS_SCRIPTS_DIR%
echo [MASTER] Output Dir: %OUTPUT_ROOT%
echo.
:: ==============================================================================
:: 1. BUILD ARM64
:: ==============================================================================
echo [MASTER] Starting ARM64 Build...
echo ------------------------------------------------------------------------------
:: Navigate to the windows directory so the script runs in its native context
pushd "%WINDOWS_SCRIPTS_DIR%"
:: Run the script
call build_arm64.bat
if %errorlevel% neq 0 (
echo.
echo [MASTER] CRITICAL ERROR: ARM64 Build Failed.
popd
pause
exit /b %errorlevel%
)
:: Return to master context
popd
echo.
:: ==============================================================================
:: 2. ZIP ARM64
:: ==============================================================================
echo [MASTER] Packaging ARM64...
set "ARM64_SOURCE=%OUTPUT_ROOT%\arm64"
set "ARM64_ZIP=%OUTPUT_ROOT%\YrCrystals_Win_ARM64.zip"
if exist "%ARM64_SOURCE%\YrCrystals.exe" (
if exist "%ARM64_ZIP%" del "%ARM64_ZIP%"
powershell -NoProfile -Command "Compress-Archive -Path '%ARM64_SOURCE%\*' -DestinationPath '%ARM64_ZIP%' -Force"
echo [SUCCESS] Created: %ARM64_ZIP%
) else (
echo [ERROR] ARM64 Output directory missing or empty. Skipping Zip.
)
echo.
:: ==============================================================================
:: 3. BUILD x64
:: ==============================================================================
echo [MASTER] Starting x64 Build...
echo ------------------------------------------------------------------------------
pushd "%WINDOWS_SCRIPTS_DIR%"
call build_x64.bat
if %errorlevel% neq 0 (
echo.
echo [MASTER] CRITICAL ERROR: x64 Build Failed.
popd
pause
exit /b %errorlevel%
)
popd
echo.
:: ==============================================================================
:: 4. ZIP x64
:: ==============================================================================
echo [MASTER] Packaging x64...
set "X64_SOURCE=%OUTPUT_ROOT%\x64"
set "X64_ZIP=%OUTPUT_ROOT%\YrCrystals_Win_x64.zip"
if exist "%X64_SOURCE%\YrCrystals.exe" (
if exist "%X64_ZIP%" del "%X64_ZIP%"
powershell -NoProfile -Command "Compress-Archive -Path '%X64_SOURCE%\*' -DestinationPath '%X64_ZIP%' -Force"
echo [SUCCESS] Created: %X64_ZIP%
) else (
echo [ERROR] x64 Output directory missing or empty. Skipping Zip.
)
:: ==============================================================================
:: DONE
:: ==============================================================================
echo.
echo ------------------------------------------------------------------------------
echo [MASTER] All builds completed successfully.
echo [OUTPUT] %OUTPUT_ROOT%
echo ------------------------------------------------------------------------------
pause