From ddf63165eb0cca4f14fdccd8785fb280833e76cc Mon Sep 17 00:00:00 2001 From: scawful Date: Sun, 28 Sep 2025 14:50:04 -0400 Subject: [PATCH] Remove legacy Visual Studio project generation scripts - Deleted `generate-vs-projects-simple.py`, `generate-vs-projects.bat`, and `generate-vs-projects.ps1` scripts to streamline project setup. - Updated `README.md` to reflect the removal of these scripts and simplify project generation instructions. - Removed `test_asar_integration.py` and `test-vs-generation.ps1` scripts as part of the cleanup process. --- scripts/README.md | 5 +- scripts/generate-vs-projects-simple.py | 328 -------------------- scripts/generate-vs-projects.bat | 200 ------------ scripts/generate-vs-projects.ps1 | 409 ------------------------- scripts/test-vs-generation.ps1 | 55 ---- scripts/test_asar_integration.py | 150 --------- 6 files changed, 1 insertion(+), 1146 deletions(-) delete mode 100644 scripts/generate-vs-projects-simple.py delete mode 100644 scripts/generate-vs-projects.bat delete mode 100644 scripts/generate-vs-projects.ps1 delete mode 100644 scripts/test-vs-generation.ps1 delete mode 100755 scripts/test_asar_integration.py diff --git a/scripts/README.md b/scripts/README.md index 438df383..b154fde9 100644 --- a/scripts/README.md +++ b/scripts/README.md @@ -18,8 +18,6 @@ This directory contains build and setup scripts for YAZE development on differen ### 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) ## Windows Compiler Recommendations @@ -200,5 +198,4 @@ REM Clean build with Clang - **`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) +- **`create-macos-bundle.sh`** - Create macOS application bundle for releases diff --git a/scripts/generate-vs-projects-simple.py b/scripts/generate-vs-projects-simple.py deleted file mode 100644 index 1eb44366..00000000 --- a/scripts/generate-vs-projects-simple.py +++ /dev/null @@ -1,328 +0,0 @@ -#!/usr/bin/env python3 -""" -Simple Visual Studio project generator for YAZE -This script creates Visual Studio project files without complex CMake dependencies -""" - -import os -import sys -from pathlib import Path - -def generate_vcxproj(): - """Generate the YAZE.vcxproj file with all source files""" - - # Source file lists (from CMake files) - app_core_src = [ - "app/core/controller.cc", - "app/emu/emulator.cc", - "app/core/project.cc", - "app/core/window.cc", - "app/core/asar_wrapper.cc", - "app/core/platform/font_loader.cc", - "app/core/platform/clipboard.cc", - "app/core/platform/file_dialog.cc" - ] - - app_emu_src = [ - "app/emu/audio/apu.cc", - "app/emu/audio/spc700.cc", - "app/emu/audio/dsp.cc", - "app/emu/audio/internal/addressing.cc", - "app/emu/audio/internal/instructions.cc", - "app/emu/cpu/internal/addressing.cc", - "app/emu/cpu/internal/instructions.cc", - "app/emu/cpu/cpu.cc", - "app/emu/video/ppu.cc", - "app/emu/memory/dma.cc", - "app/emu/memory/memory.cc", - "app/emu/snes.cc" - ] - - app_editor_src = [ - "app/editor/editor_manager.cc", - "app/editor/dungeon/dungeon_editor.cc", - "app/editor/dungeon/dungeon_room_selector.cc", - "app/editor/dungeon/dungeon_canvas_viewer.cc", - "app/editor/dungeon/dungeon_object_selector.cc", - "app/editor/dungeon/dungeon_toolset.cc", - "app/editor/dungeon/dungeon_object_interaction.cc", - "app/editor/dungeon/dungeon_renderer.cc", - "app/editor/dungeon/dungeon_room_loader.cc", - "app/editor/dungeon/dungeon_usage_tracker.cc", - "app/editor/overworld/overworld_editor.cc", - "app/editor/overworld/overworld_editor_manager.cc", - "app/editor/sprite/sprite_editor.cc", - "app/editor/music/music_editor.cc", - "app/editor/message/message_editor.cc", - "app/editor/message/message_data.cc", - "app/editor/message/message_preview.cc", - "app/editor/code/assembly_editor.cc", - "app/editor/graphics/screen_editor.cc", - "app/editor/graphics/graphics_editor.cc", - "app/editor/graphics/palette_editor.cc", - "app/editor/overworld/tile16_editor.cc", - "app/editor/overworld/map_properties.cc", - "app/editor/graphics/gfx_group_editor.cc", - "app/editor/overworld/entity.cc", - "app/editor/system/settings_editor.cc", - "app/editor/system/command_manager.cc", - "app/editor/system/extension_manager.cc", - "app/editor/system/shortcut_manager.cc", - "app/editor/system/popup_manager.cc", - "app/test/test_manager.cc" - ] - - app_gfx_src = [ - "app/gfx/arena.cc", - "app/gfx/background_buffer.cc", - "app/gfx/bitmap.cc", - "app/gfx/compression.cc", - "app/gfx/scad_format.cc", - "app/gfx/snes_palette.cc", - "app/gfx/snes_tile.cc", - "app/gfx/snes_color.cc", - "app/gfx/tilemap.cc" - ] - - app_zelda3_src = [ - "app/zelda3/hyrule_magic.cc", - "app/zelda3/overworld/overworld_map.cc", - "app/zelda3/overworld/overworld.cc", - "app/zelda3/screen/inventory.cc", - "app/zelda3/screen/title_screen.cc", - "app/zelda3/screen/dungeon_map.cc", - "app/zelda3/sprite/sprite.cc", - "app/zelda3/sprite/sprite_builder.cc", - "app/zelda3/music/tracker.cc", - "app/zelda3/dungeon/room.cc", - "app/zelda3/dungeon/room_object.cc", - "app/zelda3/dungeon/object_parser.cc", - "app/zelda3/dungeon/object_renderer.cc", - "app/zelda3/dungeon/room_layout.cc", - "app/zelda3/dungeon/dungeon_editor_system.cc", - "app/zelda3/dungeon/dungeon_object_editor.cc" - ] - - gui_src = [ - "app/gui/modules/asset_browser.cc", - "app/gui/modules/text_editor.cc", - "app/gui/canvas.cc", - "app/gui/canvas_utils.cc", - "app/gui/enhanced_palette_editor.cc", - "app/gui/input.cc", - "app/gui/style.cc", - "app/gui/color.cc", - "app/gui/zeml.cc", - "app/gui/theme_manager.cc", - "app/gui/background_renderer.cc" - ] - - util_src = [ - "util/bps.cc", - "util/flag.cc", - "util/hex.cc" - ] - - # Combine all source files - all_source_files = ( - ["yaze.cc", "app/main.cc", "app/rom.cc"] + - app_core_src + app_emu_src + app_editor_src + - app_gfx_src + app_zelda3_src + gui_src + util_src - ) - - # Header files - header_files = [ - "incl/yaze.h", - "incl/zelda.h", - "src/yaze_config.h.in" - ] - - # Generate the .vcxproj file content - vcxproj_content = ''' - - - - Debug - x64 - - - Release - x64 - - - - 17.0 - {B2C3D4E5-F6G7-8901-BCDE-F23456789012} - Win32Proj - YAZE - 10.0 - YAZE - - - - Application - true - v143 - Unicode - - - Application - false - v143 - true - Unicode - - - - - - - - - - - - - - - true - $(SolutionDir)build\\bin\\$(Configuration)\\ - $(SolutionDir)build\\obj\\$(Configuration)\\ - - - false - $(SolutionDir)build\\bin\\$(Configuration)\\ - $(SolutionDir)build\\obj\\$(Configuration)\\ - - - - Level3 - true - _DEBUG;_CONSOLE;%(PreprocessorDefinitions) - true - $(ProjectDir)src;$(ProjectDir)incl;$(ProjectDir)src\\lib;$(ProjectDir)vcpkg\\installed\\x64-windows\\include;%(AdditionalIncludeDirectories) - stdcpp23 - true - true - MultiThreadedDebugDLL - - - Console - true - $(ProjectDir)vcpkg\\installed\\x64-windows\\lib;%(AdditionalLibraryDirectories) - SDL2.lib;SDL2main.lib;absl_base.lib;absl_strings.lib;%(AdditionalDependencies) - - - - - Level3 - true - true - true - NDEBUG;_CONSOLE;%(PreprocessorDefinitions) - true - $(ProjectDir)src;$(ProjectDir)incl;$(ProjectDir)src\\lib;$(ProjectDir)vcpkg\\installed\\x64-windows\\include;%(AdditionalIncludeDirectories) - stdcpp23 - true - true - MultiThreadedDLL - - - Console - true - true - true - $(ProjectDir)vcpkg\\installed\\x64-windows\\lib;%(AdditionalLibraryDirectories) - SDL2.lib;SDL2main.lib;absl_base.lib;absl_strings.lib;%(AdditionalDependencies) - - - -''' - - for header in header_files: - vcxproj_content += f' \n' - - vcxproj_content += ''' - -''' - - for source in all_source_files: - vcxproj_content += f' \n' - - vcxproj_content += ''' - - - - - - - - - -''' - - return vcxproj_content - -def generate_solution(): - """Generate the YAZE.sln file""" - return '''Microsoft Visual Studio Solution File, Format Version 12.00 -# Visual Studio Version 17 -VisualStudioVersion = 17.0.31903.59 -MinimumVisualStudioVersion = 10.0.40219.1 -Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "YAZE", "YAZE.vcxproj", "{B2C3D4E5-F6G7-8901-BCDE-F23456789012}" -EndProject -Global - GlobalSection(SolutionConfigurationPlatforms) = preSolution - Debug|x64 = Debug|x64 - Release|x64 = Release|x64 - EndGlobalSection - GlobalSection(ProjectConfigurationPlatforms) = postSolution - {B2C3D4E5-F6G7-8901-BCDE-F23456789012}.Debug|x64.ActiveCfg = Debug|x64 - {B2C3D4E5-F6G7-8901-BCDE-F23456789012}.Debug|x64.Build.0 = Debug|x64 - {B2C3D4E5-F6G7-8901-BCDE-F23456789012}.Release|x64.ActiveCfg = Release|x64 - {B2C3D4E5-F6G7-8901-BCDE-F23456789012}.Release|x64.Build.0 = Release|x64 - EndGlobalSection - GlobalSection(SolutionProperties) = preSolution - HideSolutionNode = FALSE - EndGlobalSection - GlobalSection(ExtensibilityGlobals) = postSolution - SolutionGuid = {A1B2C3D4-E5F6-7890-ABCD-EF1234567890} - EndGlobalSection -EndGlobal''' - -def main(): - """Main function to generate Visual Studio project files""" - print("Generating simple Visual Studio project files for YAZE...") - - # Get the project root directory - script_dir = Path(__file__).parent - project_root = script_dir.parent - - # Generate .vcxproj file - vcxproj_content = generate_vcxproj() - vcxproj_path = project_root / "YAZE.vcxproj" - - with open(vcxproj_path, 'w', encoding='utf-8') as f: - f.write(vcxproj_content) - - print(f"Generated: {vcxproj_path}") - - # Generate .sln file - solution_content = generate_solution() - solution_path = project_root / "YAZE.sln" - - with open(solution_path, 'w', encoding='utf-8') as f: - f.write(solution_content) - - print(f"Generated: {solution_path}") - - print("Visual Studio project files generated successfully!") - print("") - print("IMPORTANT: Before building in Visual Studio:") - print("1. Make sure vcpkg is set up: .\\scripts\\setup-vcpkg-windows.ps1") - print("2. Install dependencies: .\\vcpkg\\vcpkg.exe install --triplet x64-windows") - print("3. Open YAZE.sln in Visual Studio 2022") - print("4. Build the solution (Ctrl+Shift+B)") - -if __name__ == "__main__": - main() diff --git a/scripts/generate-vs-projects.bat b/scripts/generate-vs-projects.bat deleted file mode 100644 index 6c81bfb5..00000000 --- a/scripts/generate-vs-projects.bat +++ /dev/null @@ -1,200 +0,0 @@ -@echo off -REM Configure Visual Studio project files for YAZE -REM This script configures CMake build system to work with existing Visual Studio 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 Check if CMake is available -where cmake >nul 2>&1 -if errorlevel 1 ( - REM Try common CMake installation paths - if exist "C:\Program Files\CMake\bin\cmake.exe" ( - echo Found CMake at: C:\Program Files\CMake\bin\cmake.exe - set "PATH=%PATH%;C:\Program Files\CMake\bin" - goto :cmake_found - ) - if exist "C:\Program Files (x86)\CMake\bin\cmake.exe" ( - echo Found CMake at: C:\Program Files (x86)\CMake\bin\cmake.exe - set "PATH=%PATH%;C:\Program Files (x86)\CMake\bin" - goto :cmake_found - ) - if exist "C:\cmake\bin\cmake.exe" ( - echo Found CMake at: C:\cmake\bin\cmake.exe - set "PATH=%PATH%;C:\cmake\bin" - goto :cmake_found - ) - - REM If we get here, CMake is not found - echo CMake not found in PATH. Attempting to install... - - REM Try to install CMake via Chocolatey - where choco >nul 2>&1 - if not errorlevel 1 ( - echo Installing CMake via Chocolatey... - choco install -y cmake - if errorlevel 1 ( - echo Failed to install CMake via Chocolatey - ) else ( - echo CMake installed successfully - REM Refresh PATH - call refreshenv - ) - ) else ( - echo Chocolatey not found. Please install CMake manually: - echo 1. Download from: https://cmake.org/download/ - echo 2. Or install Chocolatey first: https://chocolatey.org/install - echo 3. Then run: choco install cmake - exit /b 1 - ) - - REM Check again after installation - where cmake >nul 2>&1 - if errorlevel 1 ( - echo CMake still not found after installation. Please restart your terminal or add CMake to PATH manually. - exit /b 1 - ) -) - -:cmake_found -echo CMake found and ready to use - -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% -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=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 the existing solution file is present and valid -set EXISTING_SOLUTION_FILE=%SOURCE_DIR%\YAZE.sln -if exist "%EXISTING_SOLUTION_FILE%" ( - echo ✅ Using existing Visual Studio solution: %EXISTING_SOLUTION_FILE% - - REM Verify the solution file references the project file - findstr /C:"YAZE.vcxproj" "%EXISTING_SOLUTION_FILE%" >nul - if not errorlevel 1 ( - echo ✅ Solution file references YAZE.vcxproj correctly - - REM Check if project configurations are set up - findstr /C:"ProjectConfigurationPlatforms" "%EXISTING_SOLUTION_FILE%" >nul - if not errorlevel 1 ( - echo ✅ Project configurations are properly set up - ) else ( - echo ⚠️ Warning: Project configurations may not be set up - ) - ) else ( - echo ❌ Solution file does not reference YAZE.vcxproj - echo Please ensure the solution file includes the YAZE project - ) - - 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 "%EXISTING_SOLUTION_FILE%" - ) else ( - echo Visual Studio solution ready: %EXISTING_SOLUTION_FILE% - ) -) else ( - echo ❌ Existing solution file not found: %EXISTING_SOLUTION_FILE% - echo Please ensure YAZE.sln exists in the project root - exit /b 1 -) - -echo. -echo 🎉 Visual Studio project configuration 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 diff --git a/scripts/generate-vs-projects.ps1 b/scripts/generate-vs-projects.ps1 deleted file mode 100644 index 14e0f7f0..00000000 --- a/scripts/generate-vs-projects.ps1 +++ /dev/null @@ -1,409 +0,0 @@ -# Configure Visual Studio project files for YAZE -# This script configures CMake build system to work with existing Visual Studio project files - -param( - [string]$Configuration = "Debug", - [string]$Architecture = "x64", - [switch]$Clean = $false, - [switch]$UseVcpkg = $false, - [switch]$Help = $false -) - -# Show help if requested -if ($Help) { - Write-Host "Usage: .\generate-vs-projects.ps1 [options]" - Write-Host "" - Write-Host "Options:" - Write-Host " -Configuration Build configuration (Debug, Release, RelWithDebInfo, MinSizeRel)" - Write-Host " -Architecture Target architecture (x64, x86, ARM64)" - Write-Host " -Clean Clean build directory before configuring" - Write-Host " -UseVcpkg Use vcpkg for dependency management" - Write-Host " -Help Show this help message" - Write-Host "" - Write-Host "Examples:" - Write-Host " .\generate-vs-projects.ps1 # Default: Debug x64" - Write-Host " .\generate-vs-projects.ps1 -Configuration Release -Architecture x86" - Write-Host " .\generate-vs-projects.ps1 -Clean -UseVcpkg" - Write-Host "" - Write-Host "Note: This script configures CMake to work with existing YAZE.sln and YAZE.vcxproj files" - exit 0 -} - -# 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 -} - -# Check if CMake is available -$cmakePath = Get-Command cmake -ErrorAction SilentlyContinue -if (-not $cmakePath) { - # Try common CMake installation paths - $commonPaths = @( - "C:\Program Files\CMake\bin\cmake.exe", - "C:\Program Files (x86)\CMake\bin\cmake.exe", - "C:\cmake\bin\cmake.exe" - ) - - foreach ($path in $commonPaths) { - if (Test-Path $path) { - Write-Host "Found CMake at: $path" -ForegroundColor Green - $env:Path += ";$(Split-Path $path)" - $cmakePath = Get-Command cmake -ErrorAction SilentlyContinue - if ($cmakePath) { - break - } - } - } -} - -if (-not $cmakePath) { - Write-Host "CMake not found in PATH. Attempting to install..." -ForegroundColor Yellow - - # Try to install CMake via Chocolatey - if (Get-Command choco -ErrorAction SilentlyContinue) { - Write-Host "Installing CMake via Chocolatey..." -ForegroundColor Yellow - choco install -y cmake - if ($LASTEXITCODE -eq 0) { - Write-Host "CMake installed successfully" -ForegroundColor Green - # Refresh PATH - $env:Path = [System.Environment]::GetEnvironmentVariable("Path", "Machine") + ";" + [System.Environment]::GetEnvironmentVariable("Path", "User") - } else { - Write-Host "Failed to install CMake via Chocolatey" -ForegroundColor Red - } - } else { - Write-Host "Chocolatey not found. Please install CMake manually:" -ForegroundColor Red - Write-Host "1. Download from: https://cmake.org/download/" -ForegroundColor Yellow - Write-Host "2. Or install Chocolatey first: https://chocolatey.org/install" -ForegroundColor Yellow - Write-Host "3. Then run: choco install cmake" -ForegroundColor Yellow - exit 1 - } - - # Check again after installation - $cmakePath = Get-Command cmake -ErrorAction SilentlyContinue - if (-not $cmakePath) { - Write-Host "CMake still not found after installation. Please restart your terminal or add CMake to PATH manually." -ForegroundColor Red - exit 1 - } -} - -Write-Host "CMake found: $($cmakePath.Source)" -ForegroundColor Green - -# Check if Visual Studio is available -$vsWhere = Get-Command "C:\Program Files (x86)\Microsoft Visual Studio\Installer\vswhere.exe" -ErrorAction SilentlyContinue -if (-not $vsWhere) { - $vsWhere = Get-Command vswhere -ErrorAction SilentlyContinue -} - -if ($vsWhere) { - $vsInstallPath = & $vsWhere.Source -latest -products * -requires Microsoft.VisualStudio.Component.VC.Tools.x86.x64 -property installationPath - if ($vsInstallPath) { - Write-Host "Visual Studio found at: $vsInstallPath" -ForegroundColor Green - } else { - Write-Host "Visual Studio 2022 not found. Please install Visual Studio 2022 with C++ workload." -ForegroundColor Yellow - } -} else { - Write-Host "vswhere not found. Assuming Visual Studio is available." -ForegroundColor Yellow -} - -# 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 and properly configured -$VcpkgPath = Join-Path $SourceDir "vcpkg\scripts\buildsystems\vcpkg.cmake" -$VcpkgInstalled = Join-Path $SourceDir "vcpkg\installed" - -# Check for vcpkg in common locations (including global installations) -$VcpkgPaths = @( - (Join-Path $SourceDir "vcpkg\scripts\buildsystems\vcpkg.cmake"), - "$env:VCPKG_ROOT\scripts\buildsystems\vcpkg.cmake", - "$env:ProgramFiles\vcpkg\scripts\buildsystems\vcpkg.cmake", - "$env:ProgramFiles(x86)\vcpkg\scripts\buildsystems\vcpkg.cmake", - "$env:LOCALAPPDATA\vcpkg\scripts\buildsystems\vcpkg.cmake" -) - -# Also check if vcpkg is available in PATH (for global installations) -$VcpkgExe = Get-Command vcpkg -ErrorAction SilentlyContinue - -$UseVcpkg = $false -foreach ($path in $VcpkgPaths) { - if (Test-Path $path) { - $VcpkgPath = $path - $UseVcpkg = $true - break - } -} - -# If no local vcpkg found but vcpkg.exe is in PATH, check for manifest mode -if (-not $UseVcpkg -and $VcpkgExe) { - # Check if we have a vcpkg.json manifest file (indicates manifest mode) - $VcpkgManifest = Join-Path $SourceDir "vcpkg.json" - if (Test-Path $VcpkgManifest) { - Write-Host "Found vcpkg.json manifest file, using vcpkg in manifest mode" -ForegroundColor Green - $UseVcpkg = $true - # For manifest mode, we don't need to specify the toolchain file explicitly - # CMake will automatically detect and use vcpkg - } -} - -if ($UseVcpkg) { - # Check if we're using manifest mode - $VcpkgManifest = Join-Path $SourceDir "vcpkg.json" - if (Test-Path $VcpkgManifest) { - Write-Host "Using vcpkg in manifest mode" -ForegroundColor Green - Write-Host "vcpkg will automatically install dependencies from vcpkg.json" -ForegroundColor Green - - # Check if vcpkg is available in PATH - if ($VcpkgExe) { - Write-Host "vcpkg executable found: $($VcpkgExe.Source)" -ForegroundColor Green - } else { - Write-Host "vcpkg not found in PATH. Please ensure vcpkg is installed and available." -ForegroundColor Yellow - Write-Host "You can install vcpkg from: https://github.com/Microsoft/vcpkg" -ForegroundColor Yellow - } - } else { - Write-Host "Using vcpkg toolchain: $VcpkgPath" -ForegroundColor Green - - # Check if vcpkg is properly installed with required packages - if (Test-Path $VcpkgInstalled) { - Write-Host "vcpkg packages directory found: $VcpkgInstalled" -ForegroundColor Green - } else { - Write-Host "vcpkg packages not installed. Installing dependencies..." -ForegroundColor Yellow - - # Try to install vcpkg dependencies - $VcpkgExe = Join-Path (Split-Path $VcpkgPath -Parent -Parent) "vcpkg.exe" - if (Test-Path $VcpkgExe) { - Write-Host "Installing vcpkg dependencies..." -ForegroundColor Yellow - & $VcpkgExe install --triplet $Architecture-windows - if ($LASTEXITCODE -ne 0) { - Write-Host "Failed to install vcpkg dependencies" -ForegroundColor Red - Write-Host "Please run: vcpkg install --triplet $Architecture-windows" -ForegroundColor Yellow - } - } else { - Write-Host "vcpkg.exe not found. Please install dependencies manually." -ForegroundColor Yellow - } - } - } -} else { - Write-Host "vcpkg not found, using system libraries" -ForegroundColor Yellow - Write-Host "Note: This may cause missing dependency issues. Consider installing vcpkg." -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", - "-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=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", - "-DCMAKE_EXPORT_COMPILE_COMMANDS=ON", - "-DCMAKE_VERBOSE_MAKEFILE=ON" -) - -if ($UseVcpkg) { - # Check if we're using manifest mode (vcpkg.json present) - $VcpkgManifest = Join-Path $SourceDir "vcpkg.json" - if (Test-Path $VcpkgManifest) { - # Manifest mode - CMake will automatically detect vcpkg - Write-Host "Using vcpkg in manifest mode" -ForegroundColor Green - $CmakeArgs += @( - "-DVCPKG_TARGET_TRIPLET=$Architecture-windows", - "-DVCPKG_MANIFEST_MODE=ON" - ) - } else { - # Classic mode - specify toolchain file - Write-Host "Using vcpkg in classic mode with toolchain: $VcpkgPath" -ForegroundColor Green - $CmakeArgs += @( - "-DCMAKE_TOOLCHAIN_FILE=`"$VcpkgPath`"", - "-DVCPKG_TARGET_TRIPLET=$Architecture-windows" - ) - } -} - -# Configure CMake to generate Visual Studio project files -Write-Host "Configuring CMake to generate Visual Studio project files..." -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 CMake generated the solution file in the build directory -$GeneratedSolutionFile = Join-Path $BuildDir "YAZE.sln" -if (Test-Path $GeneratedSolutionFile) { - Write-Host "✅ CMake generated Visual Studio solution: $GeneratedSolutionFile" -ForegroundColor Green - - # Copy the generated solution to the source directory for convenience - $SourceSolutionFile = Join-Path $SourceDir "YAZE.sln" - Copy-Item $GeneratedSolutionFile $SourceSolutionFile -Force - Write-Host "✅ Copied solution file to project root: $SourceSolutionFile" -ForegroundColor Green - - # Verify the solution file is properly structured - $SolutionContent = Get-Content $GeneratedSolutionFile -Raw - if ($SolutionContent -match "YAZE\.vcxproj") { - Write-Host "✅ Solution file references YAZE.vcxproj correctly" -ForegroundColor Green - - # Check if project configurations are set up - if ($SolutionContent -match "ProjectConfigurationPlatforms") { - Write-Host "✅ Project configurations are properly set up" -ForegroundColor Green - } else { - Write-Host "⚠️ Warning: Project configurations may not be set up" -ForegroundColor Yellow - } - } else { - Write-Host "❌ Solution file does not reference YAZE.vcxproj" -ForegroundColor Red - Write-Host "Please check CMake configuration" -ForegroundColor Yellow - } - - # Check if the project file exists and has proper include paths - $ProjectFile = Join-Path $BuildDir "YAZE.vcxproj" - if (Test-Path $ProjectFile) { - Write-Host "✅ Project file generated: $ProjectFile" -ForegroundColor Green - - # Check for common include paths in the project file - $ProjectContent = Get-Content $ProjectFile -Raw - $IncludePaths = @( - "src/lib/", - "src/app/", - "src/lib/asar/src", - "src/lib/imgui", - "incl/" - ) - - $MissingIncludes = @() - foreach ($include in $IncludePaths) { - if ($ProjectContent -notmatch [regex]::Escape($include)) { - $MissingIncludes += $include - } - } - - if ($MissingIncludes.Count -eq 0) { - Write-Host "✅ All required include paths found in project file" -ForegroundColor Green - } else { - Write-Host "⚠️ Warning: Missing include paths in project file:" -ForegroundColor Yellow - foreach ($missing in $MissingIncludes) { - Write-Host " - $missing" -ForegroundColor Yellow - } - } - - # Check for SDL2 include paths - if ($ProjectContent -match "SDL2" -or $ProjectContent -match "sdl2") { - Write-Host "✅ SDL2 include paths found in project file" -ForegroundColor Green - } else { - Write-Host "⚠️ Warning: SDL2 include paths not found in project file" -ForegroundColor Yellow - } - } else { - Write-Host "❌ Project file not found: $ProjectFile" -ForegroundColor Red - } - - # Open solution in Visual Studio if available - if (Get-Command "devenv" -ErrorAction SilentlyContinue) { - Write-Host "Opening solution in Visual Studio..." -ForegroundColor Yellow - & devenv $SourceSolutionFile - } elseif (Get-Command "code" -ErrorAction SilentlyContinue) { - Write-Host "Opening solution in VS Code..." -ForegroundColor Yellow - & code $SourceSolutionFile - } else { - Write-Host "Visual Studio solution ready: $SourceSolutionFile" -ForegroundColor Cyan - } -} else { - Write-Host "❌ CMake failed to generate solution file: $GeneratedSolutionFile" -ForegroundColor Red - Write-Host "Please check CMake configuration and dependencies" -ForegroundColor Yellow - exit 1 -} - -# Test build to verify the project can compile -Write-Host "" -Write-Host "Testing build to verify project configuration..." -ForegroundColor Yellow - -$TestBuildArgs = @( - "--build", $BuildDir, - "--config", $Configuration, - "--target", "yaze" -) - -Write-Host "Running test build: cmake $($TestBuildArgs -join ' ')" -ForegroundColor Gray -& cmake @TestBuildArgs - -if ($LASTEXITCODE -eq 0) { - Write-Host "✅ Test build successful! Project is properly configured." -ForegroundColor Green -} else { - Write-Host "❌ Test build failed. There may be configuration issues." -ForegroundColor Red - Write-Host "Please check the build output above for specific errors." -ForegroundColor Yellow - Write-Host "Common issues:" -ForegroundColor Yellow - Write-Host " - Missing vcpkg dependencies" -ForegroundColor Gray - Write-Host " - Incorrect include paths" -ForegroundColor Gray - Write-Host " - Missing library dependencies" -ForegroundColor Gray -} - -Write-Host "" -Write-Host "🎉 Visual Studio project configuration 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 -Write-Host "" -Write-Host "Troubleshooting:" -ForegroundColor Cyan -Write-Host " - If you get missing include errors, ensure vcpkg is properly installed" -ForegroundColor Gray -Write-Host " - Run: vcpkg install --triplet $Architecture-windows" -ForegroundColor Gray -Write-Host " - Check that all dependencies are available in your environment" -ForegroundColor Gray diff --git a/scripts/test-vs-generation.ps1 b/scripts/test-vs-generation.ps1 deleted file mode 100644 index 038a6014..00000000 --- a/scripts/test-vs-generation.ps1 +++ /dev/null @@ -1,55 +0,0 @@ -# Test script to verify Visual Studio project generation -# This script tests the generate-vs-projects.ps1 script with different configurations - -param( - [switch]$Clean = $false, - [switch]$Verbose = $false -) - -Write-Host "Testing Visual Studio project generation for YAZE..." -ForegroundColor Green - -# Test configurations -$TestConfigs = @( - @{ Config = "Debug"; Arch = "x64" }, - @{ Config = "Release"; Arch = "x64" } -) - -$ScriptPath = Join-Path $PSScriptRoot "generate-vs-projects.ps1" - -foreach ($testConfig in $TestConfigs) { - Write-Host "" - Write-Host "Testing configuration: $($testConfig.Config) $($testConfig.Arch)" -ForegroundColor Cyan - - $TestArgs = @( - "-Configuration", $testConfig.Config, - "-Architecture", $testConfig.Arch - ) - - if ($Clean) { - $TestArgs += "-Clean" - } - - if ($Verbose) { - $TestArgs += "-Verbose" - } - - Write-Host "Running: .\generate-vs-projects.ps1 $($TestArgs -join ' ')" -ForegroundColor Gray - - try { - & $ScriptPath @TestArgs - - if ($LASTEXITCODE -eq 0) { - Write-Host "✅ Configuration $($testConfig.Config) $($testConfig.Arch) passed" -ForegroundColor Green - } else { - Write-Host "❌ Configuration $($testConfig.Config) $($testConfig.Arch) failed" -ForegroundColor Red - } - } catch { - Write-Host "❌ Configuration $($testConfig.Config) $($testConfig.Arch) failed with exception: $($_.Exception.Message)" -ForegroundColor Red - } -} - -Write-Host "" -Write-Host "Test complete!" -ForegroundColor Green -Write-Host "" -Write-Host "If all tests passed, the Visual Studio project generation is working correctly." -ForegroundColor Cyan -Write-Host "You can now open YAZE.sln in Visual Studio and build the project." -ForegroundColor Cyan diff --git a/scripts/test_asar_integration.py b/scripts/test_asar_integration.py deleted file mode 100755 index 41459125..00000000 --- a/scripts/test_asar_integration.py +++ /dev/null @@ -1,150 +0,0 @@ -#!/usr/bin/env python3 -""" -Asar Integration Test Script for Yaze -Tests the Asar 65816 assembler integration with real ROM files -""" - -import os -import sys -import subprocess -import shutil -import tempfile -from pathlib import Path - -def find_project_root(): - """Find the yaze project root directory""" - current = Path(__file__).parent - while current != current.parent: - if (current / "CMakeLists.txt").exists(): - return current - current = current.parent - raise FileNotFoundError("Could not find yaze project root") - -def main(): - print("🧪 Yaze Asar Integration Test") - print("=" * 50) - - project_root = find_project_root() - build_dir = project_root / "build_test" - rom_path = build_dir / "bin" / "zelda3.sfc" - test_patch = project_root / "test" / "assets" / "test_patch.asm" - - # Check if ROM file exists - if not rom_path.exists(): - print(f"❌ ROM file not found: {rom_path}") - print(" Please ensure you have a test ROM at the expected location") - return 1 - - print(f"✅ Found ROM file: {rom_path}") - print(f" Size: {rom_path.stat().st_size:,} bytes") - - # Check if test patch exists - if not test_patch.exists(): - print(f"❌ Test patch not found: {test_patch}") - return 1 - - print(f"✅ Found test patch: {test_patch}") - - # Check if z3ed tool exists - z3ed_path = build_dir / "bin" / "z3ed" - if not z3ed_path.exists(): - print(f"❌ z3ed CLI tool not found: {z3ed_path}") - print(" Run: cmake --build build_test --target z3ed") - return 1 - - print(f"✅ Found z3ed CLI tool: {z3ed_path}") - - # Create temporary directory for testing - with tempfile.TemporaryDirectory() as temp_dir: - temp_path = Path(temp_dir) - test_rom_path = temp_path / "test_rom.sfc" - patched_rom_path = temp_path / "patched_rom.sfc" - - # Copy ROM to temporary location - shutil.copy2(rom_path, test_rom_path) - print(f"📋 Copied ROM to: {test_rom_path}") - - # Test 1: Apply patch using z3ed CLI - print("\n🔧 Test 1: Applying patch with z3ed CLI") - try: - cmd = [str(z3ed_path), "asar", str(test_patch), str(test_rom_path)] - result = subprocess.run(cmd, capture_output=True, text=True, timeout=30) - - if result.returncode == 0: - print("✅ Patch applied successfully!") - if result.stdout: - print(f" Output: {result.stdout.strip()}") - else: - print(f"❌ Patch failed with return code: {result.returncode}") - if result.stderr: - print(f" Error: {result.stderr.strip()}") - return 1 - - except subprocess.TimeoutExpired: - print("❌ Patch operation timed out") - return 1 - except Exception as e: - print(f"❌ Error running patch: {e}") - return 1 - - # Test 2: Verify ROM was modified - print("\n🔍 Test 2: Verifying ROM modification") - original_size = rom_path.stat().st_size - modified_size = test_rom_path.stat().st_size - - print(f" Original ROM size: {original_size:,} bytes") - print(f" Modified ROM size: {modified_size:,} bytes") - - # Read first few bytes to check for changes - with open(rom_path, 'rb') as orig_file, open(test_rom_path, 'rb') as mod_file: - orig_bytes = orig_file.read(1024) - mod_bytes = mod_file.read(1024) - - if orig_bytes != mod_bytes: - print("✅ ROM was successfully modified!") - # Count different bytes - diff_count = sum(1 for a, b in zip(orig_bytes, mod_bytes) if a != b) - print(f" {diff_count} bytes differ in first 1KB") - else: - print("⚠️ No differences detected in first 1KB") - print(" (Patch may have been applied to a different region)") - - # Test 3: Run unit tests if available - yaze_test_path = build_dir / "bin" / "yaze_test" - if yaze_test_path.exists(): - print("\n🧪 Test 3: Running Asar unit tests") - try: - # Run only the Asar-related tests - cmd = [str(yaze_test_path), "--gtest_filter=*Asar*", "--gtest_brief=1"] - result = subprocess.run(cmd, capture_output=True, text=True, timeout=60) - - print(f" Exit code: {result.returncode}") - if result.stdout: - # Extract test results - lines = result.stdout.split('\n') - for line in lines: - if 'PASSED' in line or 'FAILED' in line or 'RUN' in line: - print(f" {line}") - - if result.returncode == 0: - print("✅ Unit tests passed!") - else: - print("⚠️ Some unit tests failed (this may be expected)") - - except subprocess.TimeoutExpired: - print("❌ Unit tests timed out") - except Exception as e: - print(f"⚠️ Error running unit tests: {e}") - else: - print("\n⚠️ Test 3: yaze_test executable not found") - - print("\n🎉 Asar integration test completed!") - print("\nNext steps:") - print("- Run full test suite with: ctest --test-dir build_test") - print("- Test Asar functionality in the main yaze application") - print("- Create custom assembly patches for your ROM hacking projects") - - return 0 - -if __name__ == "__main__": - sys.exit(main())