From d848a8d7d1f075d8e8134bf3740b162fac409f1f Mon Sep 17 00:00:00 2001 From: scawful Date: Sat, 27 Sep 2025 21:33:59 -0400 Subject: [PATCH] Add pre-build event to generate yaze_config.h from template - Introduced a pre-build event in yaze.vcxproj to automate the generation of yaze_config.h from yaze_config.h.in, replacing version placeholders with actual values. - Updated the CI/CD workflow to include a step for generating yaze_config.h during Windows builds, ensuring consistency across environments. --- .github/workflows/release.yml | 10 ++++++++++ yaze.vcxproj | 20 ++++++++++++++++++++ 2 files changed, 30 insertions(+) diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 94c79a2f..b9f08684 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -325,6 +325,16 @@ jobs: run: cmake --build build --config ${{ env.BUILD_TYPE }} --parallel # Validate Visual Studio project builds (Windows only) + # Generate yaze_config.h for Visual Studio builds + - name: Generate yaze_config.h + if: runner.os == 'Windows' + shell: cmd + run: | + copy src\yaze_config.h.in 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: + type yaze_config.h + - name: Validate Visual Studio Project Build if: runner.os == 'Windows' shell: pwsh diff --git a/yaze.vcxproj b/yaze.vcxproj index 9fd48db2..d226facf 100644 --- a/yaze.vcxproj +++ b/yaze.vcxproj @@ -148,6 +148,11 @@ $(VcpkgRoot)installed\x64-windows\debug\lib;%(AdditionalLibraryDirectories) src\lib\SDL\VisualC\SDL\$(PlatformName)\$(Configuration);src\lib\abseil-cpp\absl\base;src\lib\abseil-cpp\absl\strings;src\lib\abseil-cpp\absl\container;%(AdditionalLibraryDirectories) + + copy "$(ProjectDir)src\yaze_config.h.in" "$(ProjectDir)yaze_config.h" +powershell -Command "(Get-Content '$(ProjectDir)yaze_config.h') -replace '@yaze_VERSION_MAJOR@', '0' -replace '@yaze_VERSION_MINOR@', '3' -replace '@yaze_VERSION_PATCH@', '1' | Set-Content '$(ProjectDir)yaze_config.h'" + Generating yaze_config.h from template... + if not exist "$(OutDir)assets" mkdir "$(OutDir)assets" if not exist "$(OutDir)assets\themes" mkdir "$(OutDir)assets\themes" @@ -179,6 +184,11 @@ if exist "$(ProjectDir)zelda3.sfc" copy /Y "$(ProjectDir)zelda3.sfc" "$(OutDir)" $(VcpkgRoot)installed\x64-windows\lib;%(AdditionalLibraryDirectories) src\lib\SDL\VisualC\SDL\$(PlatformName)\$(Configuration);src\lib\abseil-cpp\absl\base;src\lib\abseil-cpp\absl\strings;src\lib\abseil-cpp\absl\container;%(AdditionalLibraryDirectories) + + copy "$(ProjectDir)src\yaze_config.h.in" "$(ProjectDir)yaze_config.h" +powershell -Command "(Get-Content '$(ProjectDir)yaze_config.h') -replace '@yaze_VERSION_MAJOR@', '0' -replace '@yaze_VERSION_MINOR@', '3' -replace '@yaze_VERSION_PATCH@', '1' | Set-Content '$(ProjectDir)yaze_config.h'" + Generating yaze_config.h from template... + if not exist "$(OutDir)assets" mkdir "$(OutDir)assets" if not exist "$(OutDir)assets\themes" mkdir "$(OutDir)assets\themes" @@ -205,6 +215,11 @@ if exist "$(ProjectDir)zelda3.sfc" copy /Y "$(ProjectDir)zelda3.sfc" "$(OutDir)" SDL2.lib;SDL2main.lib;ws2_32.lib;winmm.lib;imm32.lib;version.lib;oleaut32.lib;ole32.lib;setupapi.lib;advapi32.lib;%(AdditionalDependencies) $(VcpkgRoot)installed\x86-windows\debug\lib;%(AdditionalLibraryDirectories) + + copy "$(ProjectDir)src\yaze_config.h.in" "$(ProjectDir)yaze_config.h" +powershell -Command "(Get-Content '$(ProjectDir)yaze_config.h') -replace '@yaze_VERSION_MAJOR@', '0' -replace '@yaze_VERSION_MINOR@', '3' -replace '@yaze_VERSION_PATCH@', '1' | Set-Content '$(ProjectDir)yaze_config.h'" + Generating yaze_config.h from template... + if not exist "$(OutDir)assets" mkdir "$(OutDir)assets" if not exist "$(OutDir)assets\themes" mkdir "$(OutDir)assets\themes" @@ -235,6 +250,11 @@ if exist "$(ProjectDir)zelda3.sfc" copy /Y "$(ProjectDir)zelda3.sfc" "$(OutDir)" SDL2.lib;SDL2main.lib;ws2_32.lib;winmm.lib;imm32.lib;version.lib;oleaut32.lib;ole32.lib;setupapi.lib;advapi32.lib;%(AdditionalDependencies) $(VcpkgRoot)installed\x86-windows\lib;%(AdditionalLibraryDirectories) + + copy "$(ProjectDir)src\yaze_config.h.in" "$(ProjectDir)yaze_config.h" +powershell -Command "(Get-Content '$(ProjectDir)yaze_config.h') -replace '@yaze_VERSION_MAJOR@', '0' -replace '@yaze_VERSION_MINOR@', '3' -replace '@yaze_VERSION_PATCH@', '1' | Set-Content '$(ProjectDir)yaze_config.h'" + Generating yaze_config.h from template... + if not exist "$(OutDir)assets" mkdir "$(OutDir)assets" if not exist "$(OutDir)assets\themes" mkdir "$(OutDir)assets\themes"