Enhance Windows build scripts for improved functionality and user experience

- Refactored batch and PowerShell build scripts to streamline argument parsing and enhance error handling.
- Added support for cleaning build directories and improved feedback for missing dependencies.
- Updated project file generation logic to handle missing configuration files more gracefully.
- Introduced a new validation script to ensure the build environment is correctly set up before building.
- Removed obsolete setup scripts to simplify the repository structure.
This commit is contained in:
scawful
2025-09-28 00:47:16 -04:00
parent 9a51c1d5a7
commit 50bf1f9d71
10 changed files with 736 additions and 723 deletions

143
scripts/README.md Normal file
View File

@@ -0,0 +1,143 @@
# YAZE Build Scripts
This directory contains build and setup scripts for YAZE development on different platforms.
## Windows Scripts
### Setup Scripts
- **`setup-windows-dev.ps1`** - Complete Windows development environment setup (PowerShell)
- **`setup-vcpkg-windows.ps1`** - vcpkg setup only (PowerShell)
- **`setup-vcpkg-windows.bat`** - vcpkg setup only (Batch)
### Build Scripts
- **`build-windows.ps1`** - Build YAZE on Windows (PowerShell)
- **`build-windows.bat`** - Build YAZE on Windows (Batch)
### Validation Scripts
- **`validate-windows-build.ps1`** - Validate Windows build environment
### Project Generation
- **`generate-vs-projects.py`** - Generate Visual Studio project files (Cross-platform Python)
- **`generate-vs-projects.ps1`** - Generate Visual Studio project files (PowerShell)
- **`generate-vs-projects.bat`** - Generate Visual Studio project files (Batch)
## Quick Start (Windows)
### Option 1: Automated Setup (Recommended)
```powershell
.\scripts\setup-windows-dev.ps1
```
### Option 2: Manual Setup
```powershell
# 1. Setup vcpkg
.\scripts\setup-vcpkg-windows.ps1
# 2. Generate project files
python scripts/generate-vs-projects.py
# 3. Build
.\scripts\build-windows.ps1
```
### Option 3: Using Batch Scripts
```batch
REM Setup vcpkg
.\scripts\setup-vcpkg-windows.bat
REM Generate project files
python scripts/generate-vs-projects.py
REM Build
.\scripts\build-windows.bat
```
## Script Options
### setup-windows-dev.ps1
- `-SkipVcpkg` - Skip vcpkg setup
- `-SkipVS` - Skip Visual Studio check
- `-SkipBuild` - Skip test build
### build-windows.ps1
- `-Configuration` - Build configuration (Debug, Release, RelWithDebInfo, MinSizeRel)
- `-Platform` - Target platform (x64, x86, ARM64)
- `-Clean` - Clean build directories before building
- `-Verbose` - Verbose build output
### build-windows.bat
- First argument: Configuration (Debug, Release, RelWithDebInfo, MinSizeRel)
- Second argument: Platform (x64, x86, ARM64)
- `clean` - Clean build directories
- `verbose` - Verbose build output
## Examples
```powershell
# Build Release x64 (default)
.\scripts\build-windows.ps1
# Build Debug x64
.\scripts\build-windows.ps1 -Configuration Debug -Platform x64
# Build Release x86
.\scripts\build-windows.ps1 -Configuration Release -Platform x86
# Clean build
.\scripts\build-windows.ps1 -Clean
# Verbose build
.\scripts\build-windows.ps1 -Verbose
# Validate environment
.\scripts\validate-windows-build.ps1
```
```batch
REM Build Release x64 (default)
.\scripts\build-windows.bat
REM Build Debug x64
.\scripts\build-windows.bat Debug x64
REM Build Release x86
.\scripts\build-windows.bat Release x86
REM Clean build
.\scripts\build-windows.bat clean
```
## Troubleshooting
### Common Issues
1. **PowerShell Execution Policy**
```powershell
Set-ExecutionPolicy -ExecutionPolicy RemoteSigned -Scope CurrentUser
```
2. **MSBuild Not Found**
- Install Visual Studio 2022 with C++ workload
- Or add MSBuild to PATH
3. **vcpkg Issues**
- Run `.\scripts\setup-vcpkg-windows.ps1` to reinstall
- Check internet connection for dependency downloads
4. **Python Not Found**
- Install Python 3.8+ from python.org
- Make sure Python is in PATH
### Getting Help
1. Run validation script: `.\scripts\validate-windows-build.ps1`
2. Check the [Windows Development Guide](../docs/windows-development-guide.md)
3. Review build output for specific error messages
## Other Scripts
- **`create_release.sh`** - Create GitHub releases (Linux/macOS)
- **`extract_changelog.py`** - Extract changelog for releases
- **`quality_check.sh`** - Code quality checks (Linux/macOS)
- **`test_asar_integration.py`** - Test Asar integration
- **`agent.sh`** - AI agent helper script (Linux/macOS)

View File

@@ -1,9 +1,31 @@
@echo off @echo off
REM Simple Windows build script for YAZE REM YAZE Windows Build Script (Batch Version)
REM This script sets up the environment and builds the project using Visual Studio REM This script builds the YAZE project on Windows using MSBuild
setlocal enabledelayedexpansion setlocal enabledelayedexpansion
REM Parse command line arguments
set BUILD_CONFIG=Release
set BUILD_PLATFORM=x64
set CLEAN_BUILD=0
set VERBOSE=0
:parse_args
if "%~1"=="" goto :args_done
if /i "%~1"=="Debug" set BUILD_CONFIG=Debug
if /i "%~1"=="Release" set BUILD_CONFIG=Release
if /i "%~1"=="RelWithDebInfo" set BUILD_CONFIG=RelWithDebInfo
if /i "%~1"=="MinSizeRel" set BUILD_CONFIG=MinSizeRel
if /i "%~1"=="x64" set BUILD_PLATFORM=x64
if /i "%~1"=="x86" set BUILD_PLATFORM=x86
if /i "%~1"=="ARM64" set BUILD_PLATFORM=ARM64
if /i "%~1"=="clean" set CLEAN_BUILD=1
if /i "%~1"=="verbose" set VERBOSE=1
shift
goto :parse_args
:args_done
echo ======================================== echo ========================================
echo YAZE Windows Build Script echo YAZE Windows Build Script
echo ======================================== echo ========================================
@@ -17,8 +39,7 @@ if not exist "YAZE.sln" (
echo ✓ YAZE.sln found echo ✓ YAZE.sln found
REM Check for Visual Studio REM Check for MSBuild
echo Checking for Visual Studio...
where msbuild >nul 2>&1 where msbuild >nul 2>&1
if %errorlevel% neq 0 ( if %errorlevel% neq 0 (
echo ERROR: MSBuild not found. Please install Visual Studio 2022 or later. echo ERROR: MSBuild not found. Please install Visual Studio 2022 or later.
@@ -30,24 +51,10 @@ if %errorlevel% neq 0 (
echo ✓ MSBuild found echo ✓ MSBuild found
REM Check for vcpkg REM Check for vcpkg
echo Checking for vcpkg...
if not exist "vcpkg.json" ( if not exist "vcpkg.json" (
echo ERROR: vcpkg.json not found. Please ensure vcpkg is properly configured. echo WARNING: vcpkg.json not found. vcpkg integration may not work properly.
pause
exit /b 1
) )
echo ✓ vcpkg.json found
REM Set up environment variables
echo Setting up build environment...
set BUILD_CONFIG=Release
set BUILD_PLATFORM=x64
REM Allow user to override configuration
if "%1" neq "" set BUILD_CONFIG=%1
if "%2" neq "" set BUILD_PLATFORM=%2
echo Build Configuration: %BUILD_CONFIG% echo Build Configuration: %BUILD_CONFIG%
echo Build Platform: %BUILD_PLATFORM% echo Build Platform: %BUILD_PLATFORM%
@@ -57,19 +64,46 @@ if not exist "build" mkdir build
if not exist "build\bin" mkdir build\bin if not exist "build\bin" mkdir build\bin
if not exist "build\obj" mkdir build\obj if not exist "build\obj" mkdir build\obj
REM Clean build if requested
if %CLEAN_BUILD%==1 (
echo Cleaning build directories...
if exist "build\bin" rmdir /s /q "build\bin" 2>nul
if exist "build\obj" rmdir /s /q "build\obj" 2>nul
if not exist "build\bin" mkdir build\bin
if not exist "build\obj" mkdir build\obj
echo ✓ Build directories cleaned
)
REM Generate yaze_config.h if it doesn't exist REM Generate yaze_config.h if it doesn't exist
if not exist "yaze_config.h" ( if not exist "yaze_config.h" (
echo Generating yaze_config.h... echo Generating yaze_config.h...
copy "src\yaze_config.h.in" "yaze_config.h" >nul if exist "src\yaze_config.h.in" (
powershell -Command "(Get-Content 'yaze_config.h') -replace '@yaze_VERSION_MAJOR@', '0' -replace '@yaze_VERSION_MINOR@', '3' -replace '@yaze_VERSION_PATCH@', '1' | Set-Content 'yaze_config.h'" copy "src\yaze_config.h.in" "yaze_config.h" >nul
echo ✓ Generated yaze_config.h powershell -Command "(Get-Content 'yaze_config.h') -replace '@yaze_VERSION_MAJOR@', '0' -replace '@yaze_VERSION_MINOR@', '3' -replace '@yaze_VERSION_PATCH@', '1' | Set-Content 'yaze_config.h'"
echo ✓ Generated yaze_config.h
) else (
echo WARNING: yaze_config.h.in not found, creating basic config
echo // yaze config file > yaze_config.h
echo #define YAZE_VERSION_MAJOR 0 >> yaze_config.h
echo #define YAZE_VERSION_MINOR 3 >> yaze_config.h
echo #define YAZE_VERSION_PATCH 1 >> yaze_config.h
)
) )
REM Build using MSBuild REM Build using MSBuild
echo Building with MSBuild... echo Building with MSBuild...
echo Command: msbuild YAZE.sln /p:Configuration=%BUILD_CONFIG% /p:Platform=%BUILD_PLATFORM% /p:VcpkgEnabled=true /p:VcpkgManifestInstall=true /m /verbosity:minimal
msbuild YAZE.sln /p:Configuration=%BUILD_CONFIG% /p:Platform=%BUILD_PLATFORM% /p:VcpkgEnabled=true /p:VcpkgManifestInstall=true /m /verbosity:minimal set MSBUILD_ARGS=YAZE.sln /p:Configuration=%BUILD_CONFIG% /p:Platform=%BUILD_PLATFORM% /p:VcpkgEnabled=true /p:VcpkgManifestInstall=true /m
if %VERBOSE%==1 (
set MSBUILD_ARGS=%MSBUILD_ARGS% /verbosity:detailed
) else (
set MSBUILD_ARGS=%MSBUILD_ARGS% /verbosity:minimal
)
echo Command: msbuild %MSBUILD_ARGS%
msbuild %MSBUILD_ARGS%
if %errorlevel% neq 0 ( if %errorlevel% neq 0 (
echo ERROR: Build failed with exit code %errorlevel% echo ERROR: Build failed with exit code %errorlevel%
@@ -124,6 +158,7 @@ echo To build other configurations:
echo %~nx0 Debug x64 echo %~nx0 Debug x64
echo %~nx0 Release x86 echo %~nx0 Release x86
echo %~nx0 RelWithDebInfo ARM64 echo %~nx0 RelWithDebInfo ARM64
echo %~nx0 clean
echo. echo.
pause pause

View File

@@ -1,81 +1,133 @@
# PowerShell script to build YAZE on Windows # YAZE Windows Build Script
# This script sets up the environment and builds the project using Visual Studio # This script builds the YAZE project on Windows using MSBuild
param( param(
[string]$Configuration = "Release", [string]$Configuration = "Release",
[string]$Platform = "x64", [string]$Platform = "x64",
[switch]$Clean = $false, [switch]$Clean,
[switch]$Verbose = $false [switch]$Verbose
) )
$ErrorActionPreference = "Stop" # Set error handling
$ErrorActionPreference = "Continue"
Write-Host "========================================" -ForegroundColor Cyan # Colors for output
Write-Host "YAZE Windows Build Script" -ForegroundColor Cyan $Colors = @{
Write-Host "========================================" -ForegroundColor Cyan Success = "Green"
Warning = "Yellow"
Error = "Red"
Info = "Cyan"
White = "White"
}
function Write-Status {
param([string]$Message, [string]$Color = "White")
Write-Host $Message -ForegroundColor $Colors[$Color]
}
function Test-Command {
param([string]$Command)
try {
$null = Get-Command $Command -ErrorAction Stop
return $true
} catch {
return $false
}
}
function Get-MSBuildPath {
$vsWhere = "${env:ProgramFiles(x86)}\Microsoft Visual Studio\Installer\vswhere.exe"
if (Test-Path $vsWhere) {
$vsInstall = & $vsWhere -latest -products * -requires Microsoft.VisualStudio.Component.VC.Tools.x86.x64 -property installationPath
if ($vsInstall) {
$msbuildPath = Join-Path $vsInstall "MSBuild\Current\Bin\MSBuild.exe"
if (Test-Path $msbuildPath) {
return $msbuildPath
}
}
}
return $null
}
# Main script
Write-Status "========================================" "Info"
Write-Status "YAZE Windows Build Script" "Info"
Write-Status "========================================" "Info"
# Validate parameters
$ValidConfigs = @("Debug", "Release", "RelWithDebInfo", "MinSizeRel")
$ValidPlatforms = @("x64", "x86", "ARM64")
if ($ValidConfigs -notcontains $Configuration) {
Write-Status "ERROR: Invalid configuration '$Configuration'. Valid options: $($ValidConfigs -join ', ')" "Error"
exit 1
}
if ($ValidPlatforms -notcontains $Platform) {
Write-Status "ERROR: Invalid platform '$Platform'. Valid options: $($ValidPlatforms -join ', ')" "Error"
exit 1
}
Write-Status "Build Configuration: $Configuration" "Warning"
Write-Status "Build Platform: $Platform" "Warning"
# Check if we're in the right directory # Check if we're in the right directory
if (-not (Test-Path "YAZE.sln")) { if (-not (Test-Path "YAZE.sln")) {
Write-Error "YAZE.sln not found. Please run this script from the project root directory." Write-Status "ERROR: YAZE.sln not found. Please run this script from the project root directory." "Error"
exit 1 exit 1
} }
Write-Host "✓ YAZE.sln found" -ForegroundColor Green Write-Status " Found YAZE.sln" "Success"
# Check for Visual Studio # Check for MSBuild
Write-Host "Checking for Visual Studio..." -ForegroundColor Yellow $msbuildPath = Get-MSBuildPath
try { if (-not $msbuildPath) {
$msbuildPath = Get-Command msbuild -ErrorAction Stop Write-Status "ERROR: MSBuild not found. Please install Visual Studio 2022 with C++ workload." "Error"
Write-Host "✓ MSBuild found at: $($msbuildPath.Source)" -ForegroundColor Green
} catch {
Write-Error "MSBuild not found. Please install Visual Studio 2022 or later with the C++ development workload."
exit 1 exit 1
} }
Write-Status "✓ MSBuild found at: $msbuildPath" "Success"
# Check for vcpkg # Check for vcpkg
Write-Host "Checking for vcpkg..." -ForegroundColor Yellow
if (-not (Test-Path "vcpkg.json")) { if (-not (Test-Path "vcpkg.json")) {
Write-Error "vcpkg.json not found. Please ensure vcpkg is properly configured." Write-Status "WARNING: vcpkg.json not found. vcpkg integration may not work properly." "Warning"
exit 1
} }
Write-Host "✓ vcpkg.json found" -ForegroundColor Green
# Display build configuration
Write-Host "Build Configuration: $Configuration" -ForegroundColor Yellow
Write-Host "Build Platform: $Platform" -ForegroundColor Yellow
# Create build directories # Create build directories
Write-Host "Creating build directories..." -ForegroundColor Yellow Write-Status "Creating build directories..." "Warning"
$directories = @("build", "build\bin", "build\obj") $directories = @("build", "build\bin", "build\obj")
foreach ($dir in $directories) { foreach ($dir in $directories) {
if (-not (Test-Path $dir)) { if (-not (Test-Path $dir)) {
New-Item -ItemType Directory -Path $dir -Force | Out-Null New-Item -ItemType Directory -Path $dir -Force | Out-Null
Write-Host "✓ Created directory: $dir" -ForegroundColor Green Write-Status "✓ Created directory: $dir" "Success"
} }
} }
# Clean build if requested # Clean build if requested
if ($Clean) { if ($Clean) {
Write-Host "Cleaning build directories..." -ForegroundColor Yellow Write-Status "Cleaning build directories..." "Warning"
if (Test-Path "build\bin") { if (Test-Path "build\bin") {
Remove-Item -Recurse -Force "build\bin\*" -ErrorAction SilentlyContinue Remove-Item -Recurse -Force "build\bin\*" -ErrorAction SilentlyContinue
} }
if (Test-Path "build\obj") { if (Test-Path "build\obj") {
Remove-Item -Recurse -Force "build\obj\*" -ErrorAction SilentlyContinue Remove-Item -Recurse -Force "build\obj\*" -ErrorAction SilentlyContinue
} }
Write-Host "✓ Build directories cleaned" -ForegroundColor Green Write-Status "✓ Build directories cleaned" "Success"
} }
# Generate yaze_config.h if it doesn't exist # Generate yaze_config.h if it doesn't exist
if (-not (Test-Path "yaze_config.h")) { if (-not (Test-Path "yaze_config.h")) {
Write-Host "Generating yaze_config.h..." -ForegroundColor Yellow Write-Status "Generating yaze_config.h..." "Warning"
if (Test-Path "src\yaze_config.h.in") { if (Test-Path "src\yaze_config.h.in") {
Copy-Item "src\yaze_config.h.in" "yaze_config.h" Copy-Item "src\yaze_config.h.in" "yaze_config.h"
(Get-Content 'yaze_config.h') -replace '@yaze_VERSION_MAJOR@', '0' -replace '@yaze_VERSION_MINOR@', '3' -replace '@yaze_VERSION_PATCH@', '1' | Set-Content 'yaze_config.h' $content = Get-Content "yaze_config.h" -Raw
Write-Host "✓ Generated yaze_config.h" -ForegroundColor Green $content = $content -replace '@yaze_VERSION_MAJOR@', '0'
$content = $content -replace '@yaze_VERSION_MINOR@', '3'
$content = $content -replace '@yaze_VERSION_PATCH@', '1'
Set-Content "yaze_config.h" $content
Write-Status "✓ Generated yaze_config.h" "Success"
} else { } else {
Write-Warning "yaze_config.h.in not found, creating basic config" Write-Status "WARNING: yaze_config.h.in not found, creating basic config" "Warning"
@" @"
// yaze config file // yaze config file
#define YAZE_VERSION_MAJOR 0 #define YAZE_VERSION_MAJOR 0
@@ -86,7 +138,7 @@ if (-not (Test-Path "yaze_config.h")) {
} }
# Build using MSBuild # Build using MSBuild
Write-Host "Building with MSBuild..." -ForegroundColor Yellow Write-Status "Building with MSBuild..." "Warning"
$msbuildArgs = @( $msbuildArgs = @(
"YAZE.sln" "YAZE.sln"
@@ -94,7 +146,7 @@ $msbuildArgs = @(
"/p:Platform=$Platform" "/p:Platform=$Platform"
"/p:VcpkgEnabled=true" "/p:VcpkgEnabled=true"
"/p:VcpkgManifestInstall=true" "/p:VcpkgManifestInstall=true"
"/m" # Multi-processor build "/m"
) )
if ($Verbose) { if ($Verbose) {
@@ -103,66 +155,66 @@ if ($Verbose) {
$msbuildArgs += "/verbosity:minimal" $msbuildArgs += "/verbosity:minimal"
} }
$msbuildCommand = "msbuild $($msbuildArgs -join ' ')" $msbuildCommand = "& `"$msbuildPath`" $($msbuildArgs -join ' ')"
Write-Host "Command: $msbuildCommand" -ForegroundColor Gray Write-Status "Command: $msbuildCommand" "Info"
try { try {
& msbuild @msbuildArgs & $msbuildPath @msbuildArgs
if ($LASTEXITCODE -ne 0) { if ($LASTEXITCODE -ne 0) {
throw "MSBuild failed with exit code $LASTEXITCODE" throw "MSBuild failed with exit code $LASTEXITCODE"
} }
Write-Host "✓ Build completed successfully" -ForegroundColor Green Write-Status "✓ Build completed successfully" "Success"
} catch { } catch {
Write-Error "Build failed: $_" Write-Status "Build failed: $_" "Error"
exit 1 exit 1
} }
# Verify executable was created # Verify executable was created
$exePath = "build\bin\$Configuration\yaze.exe" $exePath = "build\bin\$Configuration\yaze.exe"
if (-not (Test-Path $exePath)) { if (-not (Test-Path $exePath)) {
Write-Error "Executable not found at expected path: $exePath" Write-Status "ERROR: Executable not found at expected path: $exePath" "Error"
exit 1 exit 1
} }
Write-Host "✓ Executable created: $exePath" -ForegroundColor Green Write-Status "✓ Executable created: $exePath" "Success"
# Test that the executable runs (basic test) # Test that the executable runs
Write-Host "Testing executable startup..." -ForegroundColor Yellow Write-Status "Testing executable..." "Warning"
try { try {
$testResult = & $exePath --help 2>&1 $testResult = & $exePath --help 2>&1
$exitCode = $LASTEXITCODE $exitCode = $LASTEXITCODE
# Check if it's the test main or app main # Check if it's the test main or app main
if ($testResult -match "Google Test|gtest") { if ($testResult -match "Google Test|gtest") {
Write-Error "Executable is running test main instead of app main!" Write-Status "ERROR: Executable is running test main instead of app main!" "Error"
Write-Host "Output: $testResult" -ForegroundColor Red Write-Status "Output: $testResult" "Error"
exit 1 exit 1
} }
Write-Host "✓ Executable runs correctly (exit code: $exitCode)" -ForegroundColor Green Write-Status "✓ Executable runs correctly (exit code: $exitCode)" "Success"
} catch { } catch {
Write-Warning "Could not test executable: $_" Write-Status "WARNING: Could not test executable: $_" "Warning"
} }
# Display file info # Display file info
$exeInfo = Get-Item $exePath $exeInfo = Get-Item $exePath
$fileSizeMB = [math]::Round($exeInfo.Length / 1MB, 2) $fileSizeMB = [math]::Round($exeInfo.Length / 1MB, 2)
Write-Host "Executable size: $fileSizeMB MB" -ForegroundColor Cyan Write-Status "Executable size: $fileSizeMB MB" "Info"
Write-Host "========================================" -ForegroundColor Cyan Write-Status "========================================" "Info"
Write-Host "✓ YAZE Windows build completed successfully!" -ForegroundColor Green Write-Status "✓ YAZE Windows build completed successfully!" "Success"
Write-Host "========================================" -ForegroundColor Cyan Write-Status "========================================" "Info"
Write-Host "" Write-Status ""
Write-Host "Build Configuration: $Configuration" -ForegroundColor White Write-Status "Build Configuration: $Configuration" "White"
Write-Host "Build Platform: $Platform" -ForegroundColor White Write-Status "Build Platform: $Platform" "White"
Write-Host "Executable: $exePath" -ForegroundColor White Write-Status "Executable: $exePath" "White"
Write-Host "" Write-Status ""
Write-Host "To run YAZE:" -ForegroundColor Yellow Write-Status "To run YAZE:" "Warning"
Write-Host " $exePath" -ForegroundColor White Write-Status " $exePath" "White"
Write-Host "" Write-Status ""
Write-Host "To build other configurations:" -ForegroundColor Yellow Write-Status "To build other configurations:" "Warning"
Write-Host " .\scripts\build-windows.ps1 -Configuration Debug -Platform x64" -ForegroundColor White Write-Status " .\scripts\build-windows.ps1 -Configuration Debug -Platform x64" "White"
Write-Host " .\scripts\build-windows.ps1 -Configuration Release -Platform x86" -ForegroundColor White Write-Status " .\scripts\build-windows.ps1 -Configuration Release -Platform x86" "White"
Write-Host " .\scripts\build-windows.ps1 -Configuration RelWithDebInfo -Platform ARM64" -ForegroundColor White Write-Status " .\scripts\build-windows.ps1 -Configuration RelWithDebInfo -Platform ARM64" "White"
Write-Host " .\scripts\build-windows.ps1 -Clean" -ForegroundColor White Write-Status " .\scripts\build-windows.ps1 -Clean" "White"
Write-Host "" Write-Status ""

View File

@@ -1,68 +1,81 @@
@echo off @echo off
echo ======================================== REM YAZE vcpkg Setup Script (Batch Version)
echo yaze Visual Studio Setup Script REM This script sets up vcpkg for YAZE development on Windows
echo ========================================
echo.
REM Check if vcpkg is installed setlocal enabledelayedexpansion
if not exist "%VCPKG_ROOT%" (
echo ERROR: VCPKG_ROOT environment variable is not set! echo ========================================
echo Please install vcpkg and set the VCPKG_ROOT environment variable. echo YAZE vcpkg Setup Script
echo Example: set VCPKG_ROOT=C:\vcpkg echo ========================================
echo.
echo Download vcpkg from: https://github.com/Microsoft/vcpkg REM Check if we're in the right directory
echo After installation, run: .\vcpkg integrate install if not exist "vcpkg.json" (
echo ERROR: vcpkg.json not found. Please run this script from the project root directory.
pause pause
exit /b 1 exit /b 1
) )
echo VCPKG_ROOT is set to: %VCPKG_ROOT% echo ✓ vcpkg.json found
echo.
REM Check if vcpkg.exe exists REM Check for Git
if not exist "%VCPKG_ROOT%\vcpkg.exe" ( where git >nul 2>&1
echo ERROR: vcpkg.exe not found at %VCPKG_ROOT%\vcpkg.exe if %errorlevel% neq 0 (
echo Please verify your vcpkg installation. echo ERROR: Git not found. Please install Git for Windows.
echo Download from: https://git-scm.com/download/win
pause pause
exit /b 1 exit /b 1
) )
echo Installing dependencies via vcpkg... echo ✓ Git found
echo This may take several minutes on first run.
echo.
REM Install dependencies for x64-windows REM Clone vcpkg if needed
echo Installing x64-windows dependencies... if not exist "vcpkg" (
"%VCPKG_ROOT%\vcpkg.exe" install zlib:x64-windows echo Cloning vcpkg...
"%VCPKG_ROOT%\vcpkg.exe" install libpng:x64-windows git clone https://github.com/Microsoft/vcpkg.git vcpkg
"%VCPKG_ROOT%\vcpkg.exe" install sdl2[vulkan]:x64-windows if %errorlevel% neq 0 (
"%VCPKG_ROOT%\vcpkg.exe" install abseil:x64-windows echo ERROR: Failed to clone vcpkg
"%VCPKG_ROOT%\vcpkg.exe" install gtest:x64-windows pause
exit /b 1
)
echo ✓ vcpkg cloned successfully
) else (
echo ✓ vcpkg directory already exists
)
echo. REM Bootstrap vcpkg
echo Installing x86-windows dependencies... if not exist "vcpkg\vcpkg.exe" (
"%VCPKG_ROOT%\vcpkg.exe" install zlib:x86-windows echo Bootstrapping vcpkg...
"%VCPKG_ROOT%\vcpkg.exe" install libpng:x86-windows cd vcpkg
"%VCPKG_ROOT%\vcpkg.exe" install sdl2[vulkan]:x86-windows call bootstrap-vcpkg.bat
"%VCPKG_ROOT%\vcpkg.exe" install abseil:x86-windows if %errorlevel% neq 0 (
"%VCPKG_ROOT%\vcpkg.exe" install gtest:x86-windows echo ERROR: Failed to bootstrap vcpkg
cd ..
pause
exit /b 1
)
cd ..
echo ✓ vcpkg bootstrapped successfully
) else (
echo ✓ vcpkg already bootstrapped
)
echo. REM Install dependencies
echo Integrating vcpkg with Visual Studio... echo Installing dependencies...
"%VCPKG_ROOT%\vcpkg.exe" integrate install vcpkg\vcpkg.exe install --triplet x64-windows
if %errorlevel% neq 0 (
echo WARNING: Some dependencies may not have installed correctly
) else (
echo ✓ Dependencies installed successfully
)
echo.
echo ======================================== echo ========================================
echo Setup Complete! echo ✓ vcpkg setup complete!
echo ======================================== echo ========================================
echo. echo.
echo You can now: echo You can now build YAZE using:
echo 1. Open yaze.sln in Visual Studio 2022 echo .\scripts\build-windows.ps1
echo 2. Select Debug or Release configuration echo or
echo 3. Choose x64 or x86 platform echo .\scripts\build-windows.bat
echo 4. Press F5 to build and run
echo. echo.
echo If you have a Zelda 3 ROM file, place it in the project root
echo and name it 'zelda3.sfc' for automatic copying. pause
echo.
pause

View File

@@ -1,54 +1,106 @@
# Setup script for vcpkg on Windows (PowerShell) # YAZE vcpkg Setup Script
# This script helps set up vcpkg for YAZE Windows builds # This script sets up vcpkg for YAZE development on Windows
Write-Host "Setting up vcpkg for YAZE Windows builds..." -ForegroundColor Green param(
[string]$Triplet = "x64-windows"
)
# Check if vcpkg directory exists # Set error handling
$ErrorActionPreference = "Continue"
# Colors for output
$Colors = @{
Success = "Green"
Warning = "Yellow"
Error = "Red"
Info = "Cyan"
White = "White"
}
function Write-Status {
param([string]$Message, [string]$Color = "White")
Write-Host $Message -ForegroundColor $Colors[$Color]
}
function Test-Command {
param([string]$Command)
try {
$null = Get-Command $Command -ErrorAction Stop
return $true
} catch {
return $false
}
}
# Main script
Write-Status "========================================" "Info"
Write-Status "YAZE vcpkg Setup Script" "Info"
Write-Status "========================================" "Info"
Write-Status "Target triplet: $Triplet" "Warning"
# Check if we're in the right directory
if (-not (Test-Path "vcpkg.json")) {
Write-Status "ERROR: vcpkg.json not found. Please run this script from the project root directory." "Error"
exit 1
}
Write-Status "✓ Found vcpkg.json" "Success"
# Check for Git
if (-not (Test-Command "git")) {
Write-Status "ERROR: Git not found. Please install Git for Windows." "Error"
Write-Status "Download from: https://git-scm.com/download/win" "Info"
exit 1
}
Write-Status "✓ Git found" "Success"
# Clone vcpkg if needed
if (-not (Test-Path "vcpkg")) { if (-not (Test-Path "vcpkg")) {
Write-Host "Cloning vcpkg..." -ForegroundColor Yellow Write-Status "Cloning vcpkg..." "Warning"
git clone https://github.com/Microsoft/vcpkg.git & git clone https://github.com/Microsoft/vcpkg.git vcpkg
if ($LASTEXITCODE -ne 0) { if ($LASTEXITCODE -eq 0) {
Write-Host "Error: Failed to clone vcpkg repository" -ForegroundColor Red Write-Status "✓ vcpkg cloned successfully" "Success"
Read-Host "Press Enter to continue" } else {
Write-Status "✗ Failed to clone vcpkg" "Error"
exit 1 exit 1
} }
} else {
Write-Status "✓ vcpkg directory already exists" "Success"
} }
# Bootstrap vcpkg # Bootstrap vcpkg
Set-Location vcpkg $vcpkgExe = "vcpkg\vcpkg.exe"
if (-not (Test-Path "vcpkg.exe")) { if (-not (Test-Path $vcpkgExe)) {
Write-Host "Bootstrapping vcpkg..." -ForegroundColor Yellow Write-Status "Bootstrapping vcpkg..." "Warning"
Push-Location vcpkg
& .\bootstrap-vcpkg.bat & .\bootstrap-vcpkg.bat
if ($LASTEXITCODE -ne 0) { if ($LASTEXITCODE -eq 0) {
Write-Host "Error: Failed to bootstrap vcpkg" -ForegroundColor Red Write-Status "✓ vcpkg bootstrapped successfully" "Success"
Read-Host "Press Enter to continue" } else {
Write-Status "✗ Failed to bootstrap vcpkg" "Error"
Pop-Location
exit 1 exit 1
} }
Pop-Location
} else {
Write-Status "✓ vcpkg already bootstrapped" "Success"
} }
# Integrate vcpkg with Visual Studio (optional) # Install dependencies
Write-Host "Integrating vcpkg with Visual Studio..." -ForegroundColor Yellow Write-Status "Installing dependencies for triplet: $Triplet" "Warning"
& .\vcpkg.exe integrate install & $vcpkgExe install --triplet $Triplet
if ($LASTEXITCODE -eq 0) {
Write-Status "✓ Dependencies installed successfully" "Success"
} else {
Write-Status "⚠ Some dependencies may not have installed correctly" "Warning"
}
# Set environment variable for this session Write-Status "========================================" "Info"
$vcpkgRoot = Get-Location Write-Status "✓ vcpkg setup complete!" "Success"
$env:VCPKG_ROOT = $vcpkgRoot.Path Write-Status "========================================" "Info"
Write-Host "VCPKG_ROOT set to: $($env:VCPKG_ROOT)" -ForegroundColor Green Write-Status ""
Write-Status "You can now build YAZE using:" "Warning"
Set-Location .. Write-Status " .\scripts\build-windows.ps1" "White"
Write-Status ""
Write-Host ""
Write-Host "vcpkg setup complete!" -ForegroundColor Green
Write-Host ""
Write-Host "To use vcpkg with YAZE:" -ForegroundColor Cyan
Write-Host "1. Use the Windows presets in CMakePresets.json:" -ForegroundColor White
Write-Host " - windows-debug (Debug build)" -ForegroundColor Gray
Write-Host " - windows-release (Release build)" -ForegroundColor Gray
Write-Host ""
Write-Host "2. Or set VCPKG_ROOT environment variable:" -ForegroundColor White
Write-Host " `$env:VCPKG_ROOT = `"$vcpkgRoot`"" -ForegroundColor Gray
Write-Host ""
Write-Host "3. Dependencies will be automatically installed via vcpkg manifest mode" -ForegroundColor White
Write-Host ""
Read-Host "Press Enter to continue"

View File

@@ -1,177 +0,0 @@
@echo off
REM Setup script for Windows development environment
REM This script installs the necessary tools for YAZE development on Windows
setlocal enabledelayedexpansion
set FORCE=false
REM Parse command line arguments
:parse_args
if "%~1"=="" goto :args_done
if "%~1"=="--force" set FORCE=true
shift
goto :parse_args
:args_done
echo Setting up Windows development environment for YAZE...
REM Check if we're on Windows
if not "%OS%"=="Windows_NT" (
echo This script is designed for Windows only.
exit /b 1
)
REM Check if running as administrator
net session >nul 2>&1
if errorlevel 1 (
echo This script requires administrator privileges to install software.
echo Please run Command Prompt as Administrator and try again.
exit /b 1
)
REM Install Chocolatey if not present
where choco >nul 2>&1
if errorlevel 1 (
echo Installing Chocolatey package manager...
powershell -Command "Set-ExecutionPolicy Bypass -Scope Process -Force; [System.Net.ServicePointManager]::SecurityProtocol = [System.Net.ServicePointManager]::SecurityProtocol -bor 3072; iex ((New-Object System.Net.WebClient).DownloadString('https://community.chocolatey.org/install.ps1'))"
REM Refresh environment variables
call refreshenv
echo Chocolatey installed successfully
) else (
echo Chocolatey already installed
)
REM Install required tools
echo.
echo Installing required development tools...
REM CMake
where cmake >nul 2>&1
if errorlevel 1 (
echo Installing CMake...
choco install -y cmake
if errorlevel 1 (
echo Failed to install CMake
) else (
echo CMake installed successfully
)
) else (
echo CMake already installed
)
REM Git
where git >nul 2>&1
if errorlevel 1 (
echo Installing Git...
choco install -y git
if errorlevel 1 (
echo Failed to install Git
) else (
echo Git installed successfully
)
) else (
echo Git already installed
)
REM Ninja
where ninja >nul 2>&1
if errorlevel 1 (
echo Installing Ninja...
choco install -y ninja
if errorlevel 1 (
echo Failed to install Ninja
) else (
echo Ninja installed successfully
)
) else (
echo Ninja already installed
)
REM Python 3
where python3 >nul 2>&1
if errorlevel 1 (
echo Installing Python 3...
choco install -y python3
if errorlevel 1 (
echo Failed to install Python 3
) else (
echo Python 3 installed successfully
)
) else (
echo Python 3 already installed
)
REM Refresh environment variables
call refreshenv
REM Verify installations
echo.
echo Verifying installations...
where cmake >nul 2>&1
if errorlevel 1 (
echo ✗ CMake not found
) else (
echo ✓ CMake found
)
where git >nul 2>&1
if errorlevel 1 (
echo ✗ Git not found
) else (
echo ✓ Git found
)
where ninja >nul 2>&1
if errorlevel 1 (
echo ✗ Ninja not found
) else (
echo ✓ Ninja found
)
where python3 >nul 2>&1
if errorlevel 1 (
echo ✗ Python 3 not found
) else (
echo ✓ Python 3 found
)
REM Check for Visual Studio
echo.
echo Checking for Visual Studio...
where vswhere >nul 2>&1
if errorlevel 1 (
if exist "C:\Program Files (x86)\Microsoft Visual Studio\Installer\vswhere.exe" (
set VSWHERE="C:\Program Files (x86)\Microsoft Visual Studio\Installer\vswhere.exe"
) else (
echo ✗ vswhere not found - cannot detect Visual Studio
goto :setup_complete
)
) else (
set VSWHERE=vswhere
)
%VSWHERE% -latest -products * -requires Microsoft.VisualStudio.Component.VC.Tools.x86.x64 -property installationPath >nul 2>&1
if errorlevel 1 (
echo ✗ Visual Studio 2022 with C++ workload not found
echo Please install Visual Studio 2022 with the 'Desktop development with C++' workload
) else (
echo ✓ Visual Studio found
)
:setup_complete
echo.
echo 🎉 Windows development environment setup complete!
echo.
echo Next steps:
echo 1. Run the Visual Studio project generation script:
echo .\scripts\generate-vs-projects.bat
echo 2. Or use CMake presets:
echo cmake --preset windows-debug
echo 3. Open YAZE.sln in Visual Studio and build
pause

View File

@@ -1,195 +1,193 @@
# PowerShell script to set up Windows development environment for YAZE # YAZE Windows Development Setup Script
# This script helps developers get started with building YAZE on Windows # This script sets up a complete Windows development environment for YAZE
param( param(
[switch]$SkipVcpkg = $false, [switch]$SkipVcpkg,
[switch]$SkipVS = $false [switch]$SkipVS,
[switch]$SkipBuild
) )
$ErrorActionPreference = "Stop" # Set error handling
$ErrorActionPreference = "Continue"
Write-Host "========================================" -ForegroundColor Cyan # Colors for output
Write-Host "YAZE Windows Development Setup" -ForegroundColor Cyan $Colors = @{
Write-Host "========================================" -ForegroundColor Cyan Success = "Green"
Warning = "Yellow"
# Check if we're in the right directory Error = "Red"
if (-not (Test-Path "YAZE.sln")) { Info = "Cyan"
Write-Error "YAZE.sln not found. Please run this script from the project root directory." White = "White"
exit 1
} }
Write-Host "✓ Found YAZE project files" -ForegroundColor Green function Write-Status {
param([string]$Message, [string]$Color = "White")
Write-Host $Message -ForegroundColor $Colors[$Color]
}
# Check for Visual Studio function Test-Command {
if (-not $SkipVS) { param([string]$Command)
Write-Host "Checking for Visual Studio..." -ForegroundColor Yellow try {
$null = Get-Command $Command -ErrorAction Stop
return $true
} catch {
return $false
}
}
function Test-VisualStudio {
$vsWhere = "${env:ProgramFiles(x86)}\Microsoft Visual Studio\Installer\vswhere.exe" $vsWhere = "${env:ProgramFiles(x86)}\Microsoft Visual Studio\Installer\vswhere.exe"
if (Test-Path $vsWhere) { if (Test-Path $vsWhere) {
$vsInstall = & $vsWhere -latest -products * -requires Microsoft.VisualStudio.Component.VC.Tools.x86.x64 -property installationPath $vsInstall = & $vsWhere -latest -products * -requires Microsoft.VisualStudio.Component.VC.Tools.x86.x64 -property installationPath
if ($vsInstall) { if ($vsInstall) {
Write-Host "✓ Visual Studio found at: $vsInstall" -ForegroundColor Green
# Check for MSBuild
$msbuildPath = Join-Path $vsInstall "MSBuild\Current\Bin\MSBuild.exe" $msbuildPath = Join-Path $vsInstall "MSBuild\Current\Bin\MSBuild.exe"
if (Test-Path $msbuildPath) { if (Test-Path $msbuildPath) {
Write-Host "✓ MSBuild found" -ForegroundColor Green return $true
} else {
Write-Warning "MSBuild not found. Please ensure C++ development workload is installed."
} }
} else {
Write-Warning "Visual Studio 2022 with C++ workload not found."
Write-Host "Please install Visual Studio 2022 with the following workloads:" -ForegroundColor Yellow
Write-Host " - Desktop development with C++" -ForegroundColor White
Write-Host " - Game development with C++" -ForegroundColor White
} }
}
return $false
}
# Main script
Write-Status "========================================" "Info"
Write-Status "YAZE Windows Development Setup" "Info"
Write-Status "========================================" "Info"
# Check if we're in the right directory
if (-not (Test-Path "YAZE.sln")) {
Write-Status "ERROR: YAZE.sln not found. Please run this script from the project root directory." "Error"
exit 1
}
Write-Status "✓ Found YAZE project files" "Success"
# Check Visual Studio
if (-not $SkipVS) {
Write-Status "Checking Visual Studio..." "Warning"
if (Test-VisualStudio) {
Write-Status "✓ Visual Studio 2022 with C++ workload found" "Success"
} else { } else {
Write-Warning "Visual Studio Installer not found. Please install Visual Studio 2022." Write-Status "Visual Studio 2022 with C++ workload not found" "Warning"
Write-Status "Please install Visual Studio 2022 with 'Desktop development with C++' workload" "Info"
} }
} else { } else {
Write-Host "Skipping Visual Studio check" -ForegroundColor Yellow Write-Status "Skipping Visual Studio check" "Warning"
} }
# Check for Git # Check Git
Write-Host "Checking for Git..." -ForegroundColor Yellow Write-Status "Checking Git..." "Warning"
$gitFound = $false if (Test-Command "git") {
try {
$null = Get-Command git -ErrorAction Stop
$gitVersion = & git --version $gitVersion = & git --version
Write-Host "✓ Git found: $gitVersion" -ForegroundColor Green Write-Status "✓ Git found: $gitVersion" "Success"
$gitFound = $true } else {
} catch { Write-Status "⚠ Git not found" "Warning"
Write-Warning "Git not found. Please install Git for Windows." Write-Status "Please install Git for Windows from: https://git-scm.com/download/win" "Info"
Write-Host "Download from: https://git-scm.com/download/win" -ForegroundColor Yellow
} }
# Check for Python # Check Python
Write-Host "Checking for Python..." -ForegroundColor Yellow Write-Status "Checking Python..." "Warning"
$pythonFound = $false if (Test-Command "python") {
try {
$null = Get-Command python -ErrorAction Stop
$pythonVersion = & python --version $pythonVersion = & python --version
Write-Host "✓ Python found: $pythonVersion" -ForegroundColor Green Write-Status "✓ Python found: $pythonVersion" "Success"
$pythonFound = $true } else {
} catch { Write-Status "⚠ Python not found" "Warning"
Write-Warning "Python not found. Please install Python 3.8 or later." Write-Status "Please install Python 3.8+ from: https://www.python.org/downloads/" "Info"
Write-Host "Download from: https://www.python.org/downloads/" -ForegroundColor Yellow
} }
# Set up vcpkg # Setup vcpkg
if (-not $SkipVcpkg) { if (-not $SkipVcpkg) {
Write-Host "Setting up vcpkg..." -ForegroundColor Yellow Write-Status "Setting up vcpkg..." "Warning"
# Clone vcpkg if needed
if (-not (Test-Path "vcpkg")) { if (-not (Test-Path "vcpkg")) {
Write-Host "Cloning vcpkg..." -ForegroundColor Yellow if (Test-Command "git") {
if ($gitFound) { Write-Status "Cloning vcpkg..." "Warning"
try { & git clone https://github.com/Microsoft/vcpkg.git vcpkg
& git clone https://github.com/Microsoft/vcpkg.git vcpkg if ($LASTEXITCODE -eq 0) {
if ($LASTEXITCODE -eq 0) { Write-Status "✓ vcpkg cloned successfully" "Success"
Write-Host "✓ vcpkg cloned successfully" -ForegroundColor Green } else {
} else { Write-Status "✗ Failed to clone vcpkg" "Error"
Write-Error "Failed to clone vcpkg"
exit 1
}
} catch {
Write-Error "Failed to clone vcpkg: $_"
exit 1 exit 1
} }
} else { } else {
Write-Error "Git is required to clone vcpkg. Please install Git first." Write-Status "Git is required to clone vcpkg" "Error"
exit 1 exit 1
} }
} else { } else {
Write-Host "✓ vcpkg directory already exists" -ForegroundColor Green Write-Status "✓ vcpkg directory already exists" "Success"
} }
# Bootstrap vcpkg # Bootstrap vcpkg
$vcpkgExe = "vcpkg\vcpkg.exe" $vcpkgExe = "vcpkg\vcpkg.exe"
if (-not (Test-Path $vcpkgExe)) { if (-not (Test-Path $vcpkgExe)) {
Write-Host "Bootstrapping vcpkg..." -ForegroundColor Yellow Write-Status "Bootstrapping vcpkg..." "Warning"
try { Push-Location vcpkg
Push-Location vcpkg & .\bootstrap-vcpkg.bat
& .\bootstrap-vcpkg.bat if ($LASTEXITCODE -eq 0) {
if ($LASTEXITCODE -eq 0) { Write-Status "✓ vcpkg bootstrapped successfully" "Success"
Write-Host "✓ vcpkg bootstrapped successfully" -ForegroundColor Green } else {
} else { Write-Status "✗ Failed to bootstrap vcpkg" "Error"
Write-Error "Failed to bootstrap vcpkg"
Pop-Location
exit 1
}
Pop-Location Pop-Location
} catch {
Pop-Location
Write-Error "Failed to bootstrap vcpkg: $_"
exit 1 exit 1
} }
Pop-Location
} else { } else {
Write-Host "✓ vcpkg already bootstrapped" -ForegroundColor Green Write-Status "✓ vcpkg already bootstrapped" "Success"
} }
# Install dependencies # Install dependencies
Write-Host "Installing dependencies with vcpkg..." -ForegroundColor Yellow Write-Status "Installing dependencies..." "Warning"
try { & $vcpkgExe install --triplet x64-windows
& $vcpkgExe install --triplet x64-windows if ($LASTEXITCODE -eq 0) {
if ($LASTEXITCODE -eq 0) { Write-Status "✓ Dependencies installed successfully" "Success"
Write-Host "✓ Dependencies installed successfully" -ForegroundColor Green } else {
} else { Write-Status "⚠ Some dependencies may not have installed correctly" "Warning"
Write-Warning "Some dependencies may not have installed correctly"
}
} catch {
Write-Warning "Failed to install dependencies: $_"
} }
} else { } else {
Write-Host "Skipping vcpkg setup" -ForegroundColor Yellow Write-Status "Skipping vcpkg setup" "Warning"
} }
# Generate Visual Studio project files # Generate project files
Write-Host "Generating Visual Studio project files..." -ForegroundColor Yellow Write-Status "Generating Visual Studio project files..." "Warning"
if ($pythonFound) { if (Test-Command "python") {
try { & python scripts/generate-vs-projects.py
& python scripts/generate-vs-projects.py if ($LASTEXITCODE -eq 0) {
if ($LASTEXITCODE -eq 0) { Write-Status "✓ Project files generated successfully" "Success"
Write-Host "✓ Visual Studio project files generated" -ForegroundColor Green } else {
} else { Write-Status "⚠ Failed to generate project files" "Warning"
Write-Warning "Failed to generate project files"
}
} catch {
Write-Warning "Failed to generate project files: $_"
Write-Host "You can manually run: python scripts/generate-vs-projects.py" -ForegroundColor Yellow
} }
} else { } else {
Write-Warning "Python is required to generate project files. Please install Python first." Write-Status "Python required to generate project files" "Warning"
Write-Host "You can manually run: python scripts/generate-vs-projects.py" -ForegroundColor Yellow
} }
# Test build # Test build
Write-Host "Testing build..." -ForegroundColor Yellow if (-not $SkipBuild) {
if (Test-Path "scripts\build-windows.ps1") { Write-Status "Testing build..." "Warning"
try { if (Test-Path "scripts\build-windows.ps1") {
& .\scripts\build-windows.ps1 -Configuration Release -Platform x64 & .\scripts\build-windows.ps1 -Configuration Release -Platform x64
if ($LASTEXITCODE -eq 0) { if ($LASTEXITCODE -eq 0) {
Write-Host "✓ Test build successful" -ForegroundColor Green Write-Status "✓ Test build successful" "Success"
} else { } else {
Write-Warning "Test build failed, but setup is complete" Write-Status "Test build failed, but setup is complete" "Warning"
} }
} catch { } else {
Write-Warning "Test build failed: $_" Write-Status "⚠ Build script not found" "Warning"
Write-Host "You can manually run: .\scripts\build-windows.ps1" -ForegroundColor Yellow
} }
} else { } else {
Write-Warning "Build script not found. You can manually build using Visual Studio." Write-Status "Skipping test build" "Warning"
} }
Write-Host "========================================" -ForegroundColor Cyan # Final instructions
Write-Host "✓ YAZE Windows development setup complete!" -ForegroundColor Green Write-Status "========================================" "Info"
Write-Host "========================================" -ForegroundColor Cyan Write-Status "✓ YAZE Windows development setup complete!" "Success"
Write-Host "" Write-Status "========================================" "Info"
Write-Host "Next steps:" -ForegroundColor Yellow Write-Status ""
Write-Host "1. Open YAZE.sln in Visual Studio 2022" -ForegroundColor White Write-Status "Next steps:" "Warning"
Write-Host "2. Select your desired configuration (Debug/Release) and platform (x64/x86/ARM64)" -ForegroundColor White Write-Status "1. Open YAZE.sln in Visual Studio 2022" "White"
Write-Host "3. Build the solution (Ctrl+Shift+B)" -ForegroundColor White Write-Status "2. Select configuration (Debug/Release) and platform (x64/x86/ARM64)" "White"
Write-Host "" Write-Status "3. Build the solution (Ctrl+Shift+B)" "White"
Write-Host "Or use the command line:" -ForegroundColor Yellow Write-Status ""
Write-Host " .\scripts\build-windows.ps1 -Configuration Release -Platform x64" -ForegroundColor White Write-Status "Or use command line:" "Warning"
Write-Host "" Write-Status " .\scripts\build-windows.ps1 -Configuration Release -Platform x64" "White"
Write-Host "For more information, see docs/02-build-instructions.md" -ForegroundColor Yellow Write-Status ""
Write-Status "For more information, see docs/windows-development-guide.md" "Info"

View File

@@ -1,89 +0,0 @@
# Test CMake configuration for YAZE
# This script tests if CMake can configure the project without errors
param(
[string]$Architecture = "x64",
[switch]$Clean = $false
)
Write-Host "Testing CMake configuration for YAZE..." -ForegroundColor Green
# Check if we're on Windows
if ($env:OS -ne "Windows_NT") {
Write-Host "This script is designed for Windows only." -ForegroundColor Red
exit 1
}
# Check if CMake is available
$cmakePath = Get-Command cmake -ErrorAction SilentlyContinue
if (-not $cmakePath) {
Write-Host "CMake not found. Please run setup-windows-dev.ps1 first." -ForegroundColor Red
exit 1
}
Write-Host "CMake found: $($cmakePath.Source)" -ForegroundColor Green
# Set up paths
$SourceDir = Split-Path -Parent $PSScriptRoot
$TestBuildDir = Join-Path $SourceDir "build-test"
Write-Host "Source directory: $SourceDir" -ForegroundColor Cyan
Write-Host "Test build directory: $TestBuildDir" -ForegroundColor Cyan
# Clean test build directory if requested
if ($Clean -and (Test-Path $TestBuildDir)) {
Write-Host "Cleaning test build directory..." -ForegroundColor Yellow
Remove-Item -Recurse -Force $TestBuildDir
}
# Create test build directory
if (-not (Test-Path $TestBuildDir)) {
New-Item -ItemType Directory -Path $TestBuildDir | Out-Null
}
# Test CMake configuration with minimal settings
Write-Host "Testing CMake configuration..." -ForegroundColor Yellow
$TestArgs = @(
"-B", $TestBuildDir,
"-G", "Visual Studio 17 2022",
"-A", $Architecture,
"-DCMAKE_BUILD_TYPE=Debug",
"-DCMAKE_POLICY_VERSION_MINIMUM=3.5",
"-DCMAKE_POLICY_VERSION_MAXIMUM=3.28",
"-DCMAKE_WARN_DEPRECATED=OFF",
"-DABSL_PROPAGATE_CXX_STD=ON",
"-DTHREADS_PREFER_PTHREAD_FLAG=OFF",
"-DYAZE_BUILD_TESTS=OFF",
"-DYAZE_BUILD_APP=ON",
"-DYAZE_BUILD_LIB=OFF",
"-DYAZE_BUILD_EMU=OFF",
"-DYAZE_BUILD_Z3ED=OFF",
"-DYAZE_ENABLE_ROM_TESTS=OFF",
"-DYAZE_ENABLE_EXPERIMENTAL_TESTS=OFF",
"-DYAZE_ENABLE_UI_TESTS=OFF",
"-DYAZE_INSTALL_LIB=OFF",
"-DYAZE_MINIMAL_BUILD=ON"
)
Write-Host "CMake command: cmake $($TestArgs -join ' ') $SourceDir" -ForegroundColor Gray
& cmake @TestArgs $SourceDir
if ($LASTEXITCODE -eq 0) {
Write-Host "✅ CMake configuration test PASSED!" -ForegroundColor Green
Write-Host "The project can be configured successfully." -ForegroundColor Green
# Clean up test build directory
if (Test-Path $TestBuildDir) {
Remove-Item -Recurse -Force $TestBuildDir
Write-Host "Test build directory cleaned up." -ForegroundColor Gray
}
Write-Host "`nYou can now run the full project generation script:" -ForegroundColor Cyan
Write-Host ".\scripts\generate-vs-projects.ps1" -ForegroundColor White
} else {
Write-Host "❌ CMake configuration test FAILED!" -ForegroundColor Red
Write-Host "Please check the error messages above." -ForegroundColor Red
exit 1
}

View File

@@ -1,146 +0,0 @@
# PowerShell script to validate Visual Studio project builds
# This script ensures that the .vcxproj files work correctly with vcpkg
param(
[Parameter(Mandatory=$false)]
[string]$Configuration = "Debug",
[Parameter(Mandatory=$false)]
[string]$Platform = "x64",
[Parameter(Mandatory=$false)]
[switch]$Clean = $false,
[Parameter(Mandatory=$false)]
[switch]$Verbose = $false
)
$ErrorActionPreference = "Stop"
Write-Host "========================================" -ForegroundColor Cyan
Write-Host "YAZE Visual Studio Build Validation" -ForegroundColor Cyan
Write-Host "========================================" -ForegroundColor Cyan
Write-Host "Configuration: $Configuration" -ForegroundColor Yellow
Write-Host "Platform: $Platform" -ForegroundColor Yellow
Write-Host "Clean Build: $Clean" -ForegroundColor Yellow
Write-Host ""
# Check if we're in the right directory
if (-not (Test-Path "yaze.sln")) {
Write-Error "yaze.sln not found. Please run this script from the project root directory."
exit 1
}
# Check if vcpkg is available
if (-not $env:VCPKG_ROOT) {
Write-Error "VCPKG_ROOT environment variable is not set. Please install vcpkg and set the environment variable."
exit 1
}
if (-not (Test-Path "$env:VCPKG_ROOT\vcpkg.exe")) {
Write-Error "vcpkg.exe not found at $env:VCPKG_ROOT\vcpkg.exe"
exit 1
}
Write-Host "✓ vcpkg found at: $env:VCPKG_ROOT" -ForegroundColor Green
# Check if required dependencies are installed
Write-Host "Checking vcpkg dependencies..." -ForegroundColor Yellow
$dependencies = @("zlib:$Platform-windows", "libpng:$Platform-windows", "sdl2[vulkan]:$Platform-windows", "abseil:$Platform-windows")
foreach ($dep in $dependencies) {
$result = & "$env:VCPKG_ROOT\vcpkg.exe" list $dep 2>$null
if ($LASTEXITCODE -ne 0 -or -not $result) {
Write-Host "Installing missing dependency: $dep" -ForegroundColor Yellow
& "$env:VCPKG_ROOT\vcpkg.exe" install $dep
if ($LASTEXITCODE -ne 0) {
Write-Error "Failed to install dependency: $dep"
exit 1
}
} else {
Write-Host "$dep is installed" -ForegroundColor Green
}
}
# Clean build if requested
if ($Clean) {
Write-Host "Cleaning previous build..." -ForegroundColor Yellow
if (Test-Path "build") {
Remove-Item -Recurse -Force "build"
}
}
# Ensure build directory exists
if (-not (Test-Path "build")) {
New-Item -ItemType Directory -Path "build" | Out-Null
}
# Build using MSBuild
Write-Host "Building with MSBuild..." -ForegroundColor Yellow
$msbuildArgs = @(
"yaze.sln"
"/p:Configuration=$Configuration"
"/p:Platform=$Platform"
"/p:VcpkgEnabled=true"
"/p:VcpkgManifestInstall=true"
"/m" # Multi-processor build
)
if ($Verbose) {
$msbuildArgs += "/verbosity:detailed"
}
Write-Host "MSBuild command: msbuild $($msbuildArgs -join ' ')" -ForegroundColor Gray
& msbuild @msbuildArgs
if ($LASTEXITCODE -ne 0) {
Write-Error "MSBuild failed with exit code $LASTEXITCODE"
exit 1
}
Write-Host "✓ Build completed successfully" -ForegroundColor Green
# Verify executable was created
$exePath = "build\bin\$Configuration\yaze.exe"
if (-not (Test-Path $exePath)) {
Write-Error "Executable not found at expected path: $exePath"
exit 1
}
Write-Host "✓ Executable created: $exePath" -ForegroundColor Green
# Verify assets were copied
$assetsPath = "build\bin\$Configuration\assets"
if (-not (Test-Path $assetsPath)) {
Write-Error "Assets directory not found at expected path: $assetsPath"
exit 1
}
Write-Host "✓ Assets copied to: $assetsPath" -ForegroundColor Green
# Test that the executable runs (basic test)
Write-Host "Testing executable startup..." -ForegroundColor Yellow
$testResult = & $exePath --help 2>&1
$exitCode = $LASTEXITCODE
# Check if it's the test main or app main
if ($testResult -match "Google Test" -or $testResult -match "gtest") {
Write-Error "Executable is running test main instead of app main!"
Write-Host "Output: $testResult" -ForegroundColor Red
exit 1
}
Write-Host "✓ Executable runs correctly (exit code: $exitCode)" -ForegroundColor Green
# Display file info
$exeInfo = Get-Item $exePath
Write-Host ""
Write-Host "Build Summary:" -ForegroundColor Cyan
Write-Host " Executable: $($exeInfo.FullName)" -ForegroundColor White
Write-Host " Size: $([math]::Round($exeInfo.Length / 1MB, 2)) MB" -ForegroundColor White
Write-Host " Created: $($exeInfo.CreationTime)" -ForegroundColor White
Write-Host ""
Write-Host "========================================" -ForegroundColor Cyan
Write-Host "✓ Visual Studio build validation PASSED" -ForegroundColor Green
Write-Host "========================================" -ForegroundColor Cyan

View File

@@ -0,0 +1,132 @@
# YAZE Windows Build Validation Script
# This script validates that the Windows build environment is properly set up
# Set error handling
$ErrorActionPreference = "Continue"
# Colors for output
$Colors = @{
Success = "Green"
Warning = "Yellow"
Error = "Red"
Info = "Cyan"
White = "White"
}
function Write-Status {
param([string]$Message, [string]$Color = "White")
Write-Host $Message -ForegroundColor $Colors[$Color]
}
function Test-Command {
param([string]$Command)
try {
$null = Get-Command $Command -ErrorAction Stop
return $true
} catch {
return $false
}
}
function Test-VisualStudio {
$vsWhere = "${env:ProgramFiles(x86)}\Microsoft Visual Studio\Installer\vswhere.exe"
if (Test-Path $vsWhere) {
$vsInstall = & $vsWhere -latest -products * -requires Microsoft.VisualStudio.Component.VC.Tools.x86.x64 -property installationPath
if ($vsInstall) {
$msbuildPath = Join-Path $vsInstall "MSBuild\Current\Bin\MSBuild.exe"
if (Test-Path $msbuildPath) {
return $true
}
}
}
return $false
}
# Main script
Write-Status "========================================" "Info"
Write-Status "YAZE Windows Build Validation" "Info"
Write-Status "========================================" "Info"
$allGood = $true
# Check if we're in the right directory
if (-not (Test-Path "YAZE.sln")) {
Write-Status "✗ YAZE.sln not found" "Error"
$allGood = $false
} else {
Write-Status "✓ YAZE.sln found" "Success"
}
# Check for vcpkg.json
if (-not (Test-Path "vcpkg.json")) {
Write-Status "✗ vcpkg.json not found" "Error"
$allGood = $false
} else {
Write-Status "✓ vcpkg.json found" "Success"
}
# Check for Visual Studio
if (Test-VisualStudio) {
Write-Status "✓ Visual Studio 2022 with C++ workload found" "Success"
} else {
Write-Status "✗ Visual Studio 2022 with C++ workload not found" "Error"
$allGood = $false
}
# Check for Git
if (Test-Command "git") {
$gitVersion = & git --version
Write-Status "✓ Git found: $gitVersion" "Success"
} else {
Write-Status "✗ Git not found" "Error"
$allGood = $false
}
# Check for Python
if (Test-Command "python") {
$pythonVersion = & python --version
Write-Status "✓ Python found: $pythonVersion" "Success"
} else {
Write-Status "✗ Python not found" "Error"
$allGood = $false
}
# Check for vcpkg
if (Test-Path "vcpkg\vcpkg.exe") {
Write-Status "✓ vcpkg found and bootstrapped" "Success"
} else {
Write-Status "✗ vcpkg not found or not bootstrapped" "Error"
$allGood = $false
}
# Check for generated project files
if (Test-Path "YAZE.vcxproj") {
Write-Status "✓ Visual Studio project file found" "Success"
} else {
Write-Status "✗ Visual Studio project file not found" "Error"
Write-Status " Run: python scripts/generate-vs-projects.py" "Info"
$allGood = $false
}
# Check for config file
if (Test-Path "yaze_config.h") {
Write-Status "✓ yaze_config.h found" "Success"
} else {
Write-Status "⚠ yaze_config.h not found (will be generated during build)" "Warning"
}
Write-Status "========================================" "Info"
if ($allGood) {
Write-Status "✓ All checks passed! Build environment is ready." "Success"
Write-Status ""
Write-Status "You can now build YAZE using:" "Warning"
Write-Status " .\scripts\build-windows.ps1" "White"
Write-Status " or" "White"
Write-Status " .\scripts\build-windows.bat" "White"
} else {
Write-Status "✗ Some checks failed. Please fix the issues above." "Error"
Write-Status ""
Write-Status "Run the setup script to fix issues:" "Warning"
Write-Status " .\scripts\setup-windows-dev.ps1" "White"
}
Write-Status "========================================" "Info"