88
99 build-windows :
1010
11- runs-on : windows-2019
11+ runs-on : windows-2025
1212
1313 steps :
1414
@@ -17,36 +17,47 @@ jobs:
1717 with :
1818 submodules : recursive
1919
20- - name : Prepare MSVC
21- uses : bus1/cabuild/action/msdevshell @v1
20+ - name : Setup MSVC
21+ uses : ilammy/msvc-dev-cmd @v1
2222 with :
23- architecture : x86
23+ arch : x86
2424
25- - name : Upgrade project files to latest Visual Studio, ignoring upgrade errors, and build
25+ - name : Copy project files from scripts
2626 run : |
27- devenv abcspace.dsw /upgrade
28- # Fix the upgraded vcxproj files to use C++17
29- if (Test-Path abclib.vcxproj) {
30- $content = Get-Content abclib.vcxproj -Raw
31- if ($content -match '<LanguageStandard>') {
32- $content = $content -replace '<LanguageStandard>Default</LanguageStandard>', '<LanguageStandard>stdcpp17</LanguageStandard>'
33- } else {
34- # Add LanguageStandard if it doesn't exist
35- $content = $content -replace '(<ClCompile>)', '$1<LanguageStandard>stdcpp17</LanguageStandard>'
36- }
37- Set-Content abclib.vcxproj -NoNewline $content
38- }
39- if (Test-Path abcexe.vcxproj) {
40- $content = Get-Content abcexe.vcxproj -Raw
41- if ($content -match '<LanguageStandard>') {
42- $content = $content -replace '<LanguageStandard>Default</LanguageStandard>', '<LanguageStandard>stdcpp17</LanguageStandard>'
43- } else {
44- # Add LanguageStandard if it doesn't exist
45- $content = $content -replace '(<ClCompile>)', '$1<LanguageStandard>stdcpp17</LanguageStandard>'
27+ copy .github\scripts\abcspace.sln .
28+ copy .github\scripts\abcexe.vcxproj .
29+
30+ - name : Generate abclib.vcxproj from dsp
31+ shell : powershell
32+ run : |
33+ # Parse source files from abclib.dsp
34+ $dspContent = Get-Content "abclib.dsp" -Raw
35+ $sourceFiles = [regex]::Matches($dspContent, 'SOURCE=\.\\([^\r\n]+)') | ForEach-Object { $_.Groups[1].Value } | Sort-Object -Unique
36+
37+ Write-Host "Found $($sourceFiles.Count) source files"
38+
39+ # Build source file items
40+ $sourceItems = ""
41+ foreach ($src in $sourceFiles) {
42+ if ($src -match '\.c$') {
43+ $sourceItems += " <ClCompile Include=`"$src`" />`r`n"
44+ } elseif ($src -match '\.(cpp|cc)$') {
45+ $sourceItems += " <ClCompile Include=`"$src`" />`r`n"
46+ } elseif ($src -match '\.h$') {
47+ $sourceItems += " <ClInclude Include=`"$src`" />`r`n"
4648 }
47- Set-Content abcexe.vcxproj -NoNewline $content
4849 }
49- msbuild abcspace.sln /m /nologo /v:m /p:Configuration=Release /p:UseMultiToolTask=true /p:PlatformToolset=v142 /p:PreprocessorDefinitions="_WINSOCKAPI_"
50+
51+ # Read template and replace placeholder
52+ $template = Get-Content ".github\scripts\abclib.vcxproj.template" -Raw
53+ $vcxproj = $template -replace '\{\{SOURCE_FILES\}\}', $sourceItems
54+ Set-Content "abclib.vcxproj" $vcxproj -NoNewline
55+
56+ Write-Host "abclib.vcxproj generated successfully"
57+
58+ - name : Build
59+ run : |
60+ msbuild abcspace.sln /m /nologo /v:m /p:Configuration=Release /p:Platform=Win32 /p:UseMultiToolTask=true
5061 if ($LASTEXITCODE -ne 0) { throw "Build failed with exit code $LASTEXITCODE" }
5162
5263 - name : Test Executable
6475 uses : actions/upload-artifact@v4
6576 with :
6677 name : package-windows
67- path : staging/
78+ path : staging/
0 commit comments