Refactor Visual Studio solution and project files for improved organization and support

- Restructured the solution file to better categorize projects, including new entries for Documentation, Scripts, and CMake.
- Updated project configurations to support multiple architectures (x86, x64, ARM64) and added new build types (RelWithDebInfo, MinSizeRel).
- Introduced new scripts for generating Visual Studio project files, enhancing the build process for Windows users.
- Removed obsolete project entries and streamlined the solution structure for clarity and maintainability.
This commit is contained in:
scawful
2025-09-27 23:29:16 -04:00
parent 1d28872499
commit 385500120a
4 changed files with 716 additions and 925 deletions

View File

@@ -0,0 +1,133 @@
@echo off
REM Generate Visual Studio project files for YAZE
REM This script creates proper Visual Studio solution and project files
setlocal enabledelayedexpansion
REM Default values
set CONFIGURATION=Debug
set ARCHITECTURE=x64
set CLEAN=false
REM Parse command line arguments
:parse_args
if "%~1"=="" goto :args_done
if "%~1"=="--clean" set CLEAN=true
if "%~1"=="--release" set CONFIGURATION=Release
if "%~1"=="--x86" set ARCHITECTURE=Win32
if "%~1"=="--x64" set ARCHITECTURE=x64
if "%~1"=="--arm64" set ARCHITECTURE=ARM64
shift
goto :parse_args
:args_done
REM Validate architecture
if not "%ARCHITECTURE%"=="x64" if not "%ARCHITECTURE%"=="Win32" if not "%ARCHITECTURE%"=="ARM64" (
echo Invalid architecture: %ARCHITECTURE%
echo Valid architectures: x64, Win32, ARM64
exit /b 1
)
echo Generating Visual Studio project files for YAZE...
REM Check if we're on Windows
if not "%OS%"=="Windows_NT" (
echo This script is designed for Windows. Use CMake presets on other platforms.
echo Available presets:
echo - windows-debug
echo - windows-release
echo - windows-dev
exit /b 1
)
REM Set up paths
set SOURCE_DIR=%~dp0..
set BUILD_DIR=%SOURCE_DIR%\build-vs
echo Source directory: %SOURCE_DIR%
echo Build directory: %BUILD_DIR%
REM Clean build directory if requested
if "%CLEAN%"=="true" (
if exist "%BUILD_DIR%" (
echo Cleaning build directory...
rmdir /s /q "%BUILD_DIR%"
)
)
REM Create build directory
if not exist "%BUILD_DIR%" mkdir "%BUILD_DIR%"
REM Check if vcpkg is available
set VCPKG_PATH=%SOURCE_DIR%\vcpkg\scripts\buildsystems\vcpkg.cmake
if exist "%VCPKG_PATH%" (
echo Using vcpkg toolchain: %VCPKG_PATH%
set USE_VCPKG=true
) else (
echo vcpkg not found, using system libraries
set USE_VCPKG=false
)
REM Build CMake command
set CMAKE_ARGS=-B "%BUILD_DIR%" -G "Visual Studio 17 2022" -A %ARCHITECTURE% -DCMAKE_BUILD_TYPE=%CONFIGURATION% -DYAZE_BUILD_TESTS=ON -DYAZE_BUILD_APP=ON -DYAZE_BUILD_LIB=ON -DYAZE_BUILD_EMU=ON -DYAZE_BUILD_Z3ED=ON -DYAZE_ENABLE_ROM_TESTS=OFF -DYAZE_ENABLE_EXPERIMENTAL_TESTS=ON -DYAZE_ENABLE_UI_TESTS=ON -DYAZE_INSTALL_LIB=OFF
if "%USE_VCPKG%"=="true" (
set CMAKE_ARGS=%CMAKE_ARGS% -DCMAKE_TOOLCHAIN_FILE="%VCPKG_PATH%" -DVCPKG_TARGET_TRIPLET=%ARCHITECTURE%-windows -DVCPKG_MANIFEST_MODE=ON
)
REM Run CMake configuration
echo Configuring CMake...
echo Command: cmake %CMAKE_ARGS% "%SOURCE_DIR%"
cmake %CMAKE_ARGS% "%SOURCE_DIR%"
if errorlevel 1 (
echo CMake configuration failed!
exit /b 1
)
REM Check if solution file was created
set SOLUTION_FILE=%BUILD_DIR%\YAZE.sln
if exist "%SOLUTION_FILE%" (
echo ✅ Visual Studio solution created: %SOLUTION_FILE%
REM Copy solution file to root directory for convenience
set ROOT_SOLUTION_FILE=%SOURCE_DIR%\YAZE.sln
copy "%SOLUTION_FILE%" "%ROOT_SOLUTION_FILE%" >nul
echo ✅ Solution file copied to root directory
REM Try to open solution in Visual Studio
where devenv >nul 2>&1
if not errorlevel 1 (
echo Opening solution in Visual Studio...
start "" devenv "%ROOT_SOLUTION_FILE%"
) else (
echo Visual Studio solution ready: %ROOT_SOLUTION_FILE%
)
) else (
echo ❌ Solution file not created. Check CMake output for errors.
exit /b 1
)
echo.
echo 🎉 Visual Studio project generation complete!
echo.
echo Next steps:
echo 1. Open YAZE.sln in Visual Studio
echo 2. Select configuration: %CONFIGURATION%
echo 3. Select platform: %ARCHITECTURE%
echo 4. Build the solution (Ctrl+Shift+B)
echo.
echo Available configurations:
echo - Debug (with debugging symbols)
echo - Release (optimized)
echo - RelWithDebInfo (optimized with debug info)
echo - MinSizeRel (minimum size)
echo.
echo Available architectures:
echo - x64 (64-bit Intel/AMD)
echo - x86 (32-bit Intel/AMD)
echo - ARM64 (64-bit ARM)
pause

View File

@@ -0,0 +1,141 @@
# Generate Visual Studio project files for YAZE
# This script creates proper Visual Studio solution and project files
param(
[string]$Configuration = "Debug",
[string]$Architecture = "x64",
[switch]$Clean = $false
)
# Validate architecture parameter
$ValidArchitectures = @("x64", "x86", "ARM64")
if ($Architecture -notin $ValidArchitectures) {
Write-Host "Invalid architecture: $Architecture" -ForegroundColor Red
Write-Host "Valid architectures: $($ValidArchitectures -join ', ')" -ForegroundColor Yellow
exit 1
}
Write-Host "Generating Visual Studio project files for YAZE..." -ForegroundColor Green
# Check if we're on Windows
if ($env:OS -ne "Windows_NT") {
Write-Host "This script is designed for Windows. Use CMake presets on other platforms." -ForegroundColor Yellow
Write-Host "Available presets:" -ForegroundColor Cyan
Write-Host " - windows-debug" -ForegroundColor Gray
Write-Host " - windows-release" -ForegroundColor Gray
Write-Host " - windows-dev" -ForegroundColor Gray
exit 1
}
# Set up paths
$SourceDir = Split-Path -Parent $PSScriptRoot
$BuildDir = Join-Path $SourceDir "build-vs"
Write-Host "Source directory: $SourceDir" -ForegroundColor Cyan
Write-Host "Build directory: $BuildDir" -ForegroundColor Cyan
# Clean build directory if requested
if ($Clean -and (Test-Path $BuildDir)) {
Write-Host "Cleaning build directory..." -ForegroundColor Yellow
Remove-Item -Recurse -Force $BuildDir
}
# Create build directory
if (-not (Test-Path $BuildDir)) {
New-Item -ItemType Directory -Path $BuildDir | Out-Null
}
# Check if vcpkg is available
$VcpkgPath = Join-Path $SourceDir "vcpkg\scripts\buildsystems\vcpkg.cmake"
$UseVcpkg = Test-Path $VcpkgPath
if ($UseVcpkg) {
Write-Host "Using vcpkg toolchain: $VcpkgPath" -ForegroundColor Green
} else {
Write-Host "vcpkg not found, using system libraries" -ForegroundColor Yellow
}
# Determine generator and architecture
$Generator = "Visual Studio 17 2022"
$ArchFlag = if ($Architecture -eq "x64") { "-A x64" } else { "-A Win32" }
# Build CMake command
$CmakeArgs = @(
"-B", $BuildDir,
"-G", "`"$Generator`"",
$ArchFlag,
"-DCMAKE_BUILD_TYPE=$Configuration",
"-DYAZE_BUILD_TESTS=ON",
"-DYAZE_BUILD_APP=ON",
"-DYAZE_BUILD_LIB=ON",
"-DYAZE_BUILD_EMU=ON",
"-DYAZE_BUILD_Z3ED=ON",
"-DYAZE_ENABLE_ROM_TESTS=OFF",
"-DYAZE_ENABLE_EXPERIMENTAL_TESTS=ON",
"-DYAZE_ENABLE_UI_TESTS=ON",
"-DYAZE_INSTALL_LIB=OFF"
)
if ($UseVcpkg) {
$CmakeArgs += @(
"-DCMAKE_TOOLCHAIN_FILE=`"$VcpkgPath`"",
"-DVCPKG_TARGET_TRIPLET=$Architecture-windows",
"-DVCPKG_MANIFEST_MODE=ON"
)
}
# Run CMake configuration
Write-Host "Configuring CMake..." -ForegroundColor Yellow
Write-Host "Command: cmake $($CmakeArgs -join ' ')" -ForegroundColor Gray
& cmake @CmakeArgs $SourceDir
if ($LASTEXITCODE -ne 0) {
Write-Host "CMake configuration failed!" -ForegroundColor Red
exit 1
}
# Check if solution file was created
$SolutionFile = Join-Path $BuildDir "YAZE.sln"
if (Test-Path $SolutionFile) {
Write-Host "✅ Visual Studio solution created: $SolutionFile" -ForegroundColor Green
# Copy solution file to root directory for convenience
$RootSolutionFile = Join-Path $SourceDir "YAZE.sln"
Copy-Item $SolutionFile $RootSolutionFile -Force
Write-Host "✅ Solution file copied to root directory" -ForegroundColor Green
# Open solution in Visual Studio if available
if (Get-Command "devenv" -ErrorAction SilentlyContinue) {
Write-Host "Opening solution in Visual Studio..." -ForegroundColor Yellow
& devenv $RootSolutionFile
} elseif (Get-Command "code" -ErrorAction SilentlyContinue) {
Write-Host "Opening solution in VS Code..." -ForegroundColor Yellow
& code $RootSolutionFile
} else {
Write-Host "Visual Studio solution ready: $RootSolutionFile" -ForegroundColor Cyan
}
} else {
Write-Host "❌ Solution file not created. Check CMake output for errors." -ForegroundColor Red
exit 1
}
Write-Host ""
Write-Host "🎉 Visual Studio project generation complete!" -ForegroundColor Green
Write-Host ""
Write-Host "Next steps:" -ForegroundColor Cyan
Write-Host "1. Open YAZE.sln in Visual Studio" -ForegroundColor White
Write-Host "2. Select configuration: $Configuration" -ForegroundColor White
Write-Host "3. Select platform: $Architecture" -ForegroundColor White
Write-Host "4. Build the solution (Ctrl+Shift+B)" -ForegroundColor White
Write-Host ""
Write-Host "Available configurations:" -ForegroundColor Cyan
Write-Host " - Debug (with debugging symbols)" -ForegroundColor Gray
Write-Host " - Release (optimized)" -ForegroundColor Gray
Write-Host " - RelWithDebInfo (optimized with debug info)" -ForegroundColor Gray
Write-Host " - MinSizeRel (minimum size)" -ForegroundColor Gray
Write-Host ""
Write-Host "Available architectures:" -ForegroundColor Cyan
Write-Host " - x64 (64-bit Intel/AMD)" -ForegroundColor Gray
Write-Host " - x86 (32-bit Intel/AMD)" -ForegroundColor Gray
Write-Host " - ARM64 (64-bit ARM)" -ForegroundColor Gray