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.
This commit is contained in:
10
.github/workflows/release.yml
vendored
10
.github/workflows/release.yml
vendored
@@ -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
|
||||
|
||||
20
yaze.vcxproj
20
yaze.vcxproj
@@ -148,6 +148,11 @@
|
||||
<AdditionalLibraryDirectories Condition="'$(VcpkgEnabled)' == 'true'">$(VcpkgRoot)installed\x64-windows\debug\lib;%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories>
|
||||
<AdditionalLibraryDirectories Condition="'$(VcpkgEnabled)' != 'true'">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)</AdditionalLibraryDirectories>
|
||||
</Link>
|
||||
<PreBuildEvent>
|
||||
<Command>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'"</Command>
|
||||
<Message>Generating yaze_config.h from template...</Message>
|
||||
</PreBuildEvent>
|
||||
<PostBuildEvent>
|
||||
<Command>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)"
|
||||
<AdditionalLibraryDirectories Condition="'$(VcpkgEnabled)' == 'true'">$(VcpkgRoot)installed\x64-windows\lib;%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories>
|
||||
<AdditionalLibraryDirectories Condition="'$(VcpkgEnabled)' != 'true'">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)</AdditionalLibraryDirectories>
|
||||
</Link>
|
||||
<PreBuildEvent>
|
||||
<Command>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'"</Command>
|
||||
<Message>Generating yaze_config.h from template...</Message>
|
||||
</PreBuildEvent>
|
||||
<PostBuildEvent>
|
||||
<Command>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)"
|
||||
<AdditionalDependencies Condition="'$(VcpkgEnabled)' != 'true'">SDL2.lib;SDL2main.lib;ws2_32.lib;winmm.lib;imm32.lib;version.lib;oleaut32.lib;ole32.lib;setupapi.lib;advapi32.lib;%(AdditionalDependencies)</AdditionalDependencies>
|
||||
<AdditionalLibraryDirectories Condition="'$(VcpkgEnabled)' == 'true'">$(VcpkgRoot)installed\x86-windows\debug\lib;%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories>
|
||||
</Link>
|
||||
<PreBuildEvent>
|
||||
<Command>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'"</Command>
|
||||
<Message>Generating yaze_config.h from template...</Message>
|
||||
</PreBuildEvent>
|
||||
<PostBuildEvent>
|
||||
<Command>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)"
|
||||
<AdditionalDependencies Condition="'$(VcpkgEnabled)' != 'true'">SDL2.lib;SDL2main.lib;ws2_32.lib;winmm.lib;imm32.lib;version.lib;oleaut32.lib;ole32.lib;setupapi.lib;advapi32.lib;%(AdditionalDependencies)</AdditionalDependencies>
|
||||
<AdditionalLibraryDirectories Condition="'$(VcpkgEnabled)' == 'true'">$(VcpkgRoot)installed\x86-windows\lib;%(AdditionalLibraryDirectories)</AdditionalLibraryDirectories>
|
||||
</Link>
|
||||
<PreBuildEvent>
|
||||
<Command>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'"</Command>
|
||||
<Message>Generating yaze_config.h from template...</Message>
|
||||
</PreBuildEvent>
|
||||
<PostBuildEvent>
|
||||
<Command>if not exist "$(OutDir)assets" mkdir "$(OutDir)assets"
|
||||
if not exist "$(OutDir)assets\themes" mkdir "$(OutDir)assets\themes"
|
||||
|
||||
Reference in New Issue
Block a user