11
11
required : true
12
12
type : string
13
13
description : " Game to build (Generals, GeneralsMD)"
14
- preset :
14
+ configurePreset :
15
15
required : true
16
16
type : string
17
- description : " CMake preset"
17
+ description : " CMake configure preset"
18
+ buildPreset :
19
+ required : true
20
+ type : string
21
+ description : " CMake build preset"
18
22
tools :
19
23
required : false
20
24
default : true
25
29
default : false
26
30
type : boolean
27
31
description : " Build extras"
28
-
29
32
jobs :
30
33
build :
31
- name : ${{ inputs.preset }}${{ inputs.tools && '+t' || '' }}${{ inputs.extras && '+e' || '' }}
34
+ name : ${{ inputs.game }} ${{ inputs.configurePreset }} ${{ inputs.buildPreset }}${{ inputs.tools && '+t' || '' }}${{ inputs.extras && '+e' || '' }}
32
35
runs-on : windows-2022
33
36
timeout-minutes : 20
34
37
steps :
35
38
- name : Checkout Code
36
39
uses : actions/checkout@v4
37
40
38
41
- name : Cache VC6 Installation
39
- if : startsWith(inputs.preset , 'vc6')
42
+ if : startsWith(inputs.buildPreset , 'vc6')
40
43
id : cache-vc6
41
44
uses : actions/cache@v4
42
45
with :
@@ -47,11 +50,11 @@ jobs:
47
50
id : cache-cmake-deps
48
51
uses : actions/cache@v4
49
52
with :
50
- path : build\${{ inputs.preset }}\_deps
51
- key : cmake-deps-${{ inputs.preset }}-${{ hashFiles('CMakePresets.json','cmake/**/*.cmake','**/CMakeLists.txt') }}
53
+ path : build\${{ inputs.buildPreset }}\_deps
54
+ key : cmake-deps-${{ inputs.buildPreset }}-${{ hashFiles('CMakePresets.json','cmake/**/*.cmake','**/CMakeLists.txt') }}
52
55
53
56
- name : Download VC6 Portable from Cloudflare R2
54
- if : ${{ startsWith(inputs.preset , 'vc6') && steps.cache-vc6.outputs.cache-hit != 'true' }}
57
+ if : ${{ startsWith(inputs.buildPreset , 'vc6') && steps.cache-vc6.outputs.cache-hit != 'true' }}
55
58
env :
56
59
AWS_ACCESS_KEY_ID : ${{ secrets.R2_ACCESS_KEY_ID }}
57
60
AWS_SECRET_ACCESS_KEY : ${{ secrets.R2_SECRET_ACCESS_KEY }}
@@ -76,39 +79,27 @@ jobs:
76
79
Remove-Item VS6_VisualStudio6.7z -Verbose
77
80
78
81
- name : Set Up VC6 Environment
79
- if : startsWith(inputs.preset , 'vc6')
82
+ if : startsWith(inputs.buildPreset , 'vc6')
80
83
shell : pwsh
81
84
run : |
82
- # Define the base directories as local variables first
83
- $VSCommonDir = "C:\VC6\VC6SP6\Common"
84
- $MSDevDir = "C:\VC6\VC6SP6\Common\msdev98"
85
- $MSVCDir = "C:\VC6\VC6SP6\VC98"
86
- $VcOsDir = "WINNT"
87
-
88
- # Set the variables in GitHub environment
89
- "VSCommonDir=$VSCommonDir" >> $env:GITHUB_ENV
90
- "MSDevDir=$MSDevDir" >> $env:GITHUB_ENV
91
- "MSVCDir=$MSVCDir" >> $env:GITHUB_ENV
92
- "VcOsDir=$VcOsDir" >> $env:GITHUB_ENV
93
- "PATH=$MSDevDir\BIN;$MSVCDir\BIN;$VSCommonDir\TOOLS\$VcOsDir;$VSCommonDir\TOOLS;$env:PATH" >> $env:GITHUB_ENV
94
- "INCLUDE=$MSVCDir\ATL\INCLUDE;$MSVCDir\INCLUDE;$MSVCDir\MFC\INCLUDE;$env:INCLUDE" >> $env:GITHUB_ENV
95
- "LIB=$MSVCDir\LIB;$MSVCDir\MFC\LIB;$env:LIB" >> $env:GITHUB_ENV
85
+ $VS6_DIR = "C:\VC6\VC6SP6"
86
+ "VS6_DIR=$VS6_DIR" >> $env:GITHUB_ENV
96
87
97
88
- name : Set Up VC2022 Environment
98
- if : startsWith(inputs.preset , 'win32')
89
+ if : ${{ ! startsWith(inputs.buildPreset , 'vc6') }}
99
90
uses : ilammy/msvc-dev-cmd@v1
100
91
with :
101
92
arch : x86
102
93
103
94
- name : Setup vcpkg
104
95
uses : lukka/run-vcpkg@v11
105
96
106
- - name : Configure ${{ inputs.game }} with CMake Using ${{ inputs.preset }}${{ inputs.tools && '+t' || '' }}${{ inputs.extras && '+e' || '' }} Preset
97
+ - name : Configure ${{ inputs.game }} with CMake Using ${{ inputs.configurePreset }}${{ inputs.tools && '+t' || '' }}${{ inputs.extras && '+e' || '' }} Preset
107
98
shell : pwsh
108
99
run : |
109
100
$buildFlags = @(
110
- "-DRTS_BUILD_ZEROHOUR=${{ inputs.game == 'GeneralsMD' && 'ON' || 'OFF' }}",
111
- "-DRTS_BUILD_GENERALS=${{ inputs.game == 'Generals' && 'ON' || 'OFF' }}"
101
+ "-DRTS_BUILD_ZEROHOUR=${{ inputs.game == 'GeneralsMD' && 'ON' || 'OFF' }}",
102
+ "-DRTS_BUILD_GENERALS=${{ inputs.game == 'Generals' && 'ON' || 'OFF' }}"
112
103
)
113
104
114
105
$gamePrefix = "${{ inputs.game == 'Generals' && 'GENERALS' || 'ZEROHOUR' }}"
@@ -118,33 +109,26 @@ jobs:
118
109
$buildFlags += "-DRTS_BUILD_${gamePrefix}_EXTRAS=${{ inputs.extras && 'ON' || 'OFF' }}"
119
110
120
111
Write-Host "Build flags: $($buildFlags -join ' | ')"
112
+ cmake --preset ${{ inputs.configurePreset }} $($buildFlags -join ' ')
121
113
122
- cmake --preset ${{ inputs.preset }} $buildFlags
123
-
124
- - name : Build ${{ inputs.game }} with CMake Using ${{ inputs.preset }}${{ inputs.tools && '+t' || '' }}${{ inputs.extras && '+e' || '' }} Preset
114
+ - name : Build ${{ inputs.game }} with CMake Using ${{ inputs.buildPreset }}${{ inputs.tools && '+t' || '' }}${{ inputs.extras && '+e' || '' }} Preset
125
115
shell : pwsh
126
116
run : |
127
- cmake --build --preset ${{ inputs.preset }}
117
+ cmake --build --preset ${{ inputs.buildPreset }}
128
118
129
- - name : Collect ${{ inputs.game }} ${{ inputs.preset }}${{ inputs.tools && '+t' || '' }}${{ inputs.extras && '+e' || '' }} Artifact
119
+ - name : Collect ${{ inputs.game }} ${{ inputs.buildPreset }}${{ inputs.tools && '+t' || '' }}${{ inputs.extras && '+e' || '' }} Artifact
130
120
shell : pwsh
131
121
run : |
132
- $buildDir = "build\${{ inputs.preset }}"
122
+ $buildDir = "build\${{ inputs.configurePreset }}"
133
123
$artifactsDir = New-Item -ItemType Directory -Force -Path "$buildDir\${{ inputs.game }}\artifacts" -Verbose
134
-
135
- if ("${{ inputs.preset }}" -like "win32*") {
136
- # For win32 preset, look in config-specific subdirectories
137
- $configToUse = if ("${{ inputs.preset }}" -match "debug") { "Debug" } else { "Release" }
138
- $files = Get-ChildItem -Path "$buildDir\Core\$configToUse","$buildDir\${{ inputs.game }}\$configToUse" -File | Where-Object { $_.Extension -in @(".exe", ".dll", ".pdb") } -Verbose
139
- } else {
140
- $files = Get-ChildItem -Path "$buildDir\Core","$buildDir\${{ inputs.game }}" -File | Where-Object { $_.Extension -in @(".exe", ".dll", ".pdb") } -Verbose
141
- }
124
+ $configToUse = if ("${{ inputs.buildPreset }}" -match "relwithdebinfo") { "RelWithDebInfo" } elseif ("${{ inputs.buildPreset }}" -match "debug") { "Debug" } else { "Release" }
125
+ $files = Get-ChildItem -Path "$buildDir\Core\$configToUse","$buildDir\${{ inputs.game }}\$configToUse" -File | Where-Object { $_.Extension -in @(".exe", ".dll", ".pdb") } -Verbose
142
126
$files | Move-Item -Destination $artifactsDir -Verbose -Force
143
127
144
- - name : Upload ${{ inputs.game }} ${{ inputs.preset }}${{ inputs.tools && '+t' || '' }}${{ inputs.extras && '+e' || '' }} Artifact
128
+ - name : Upload ${{ inputs.game }} ${{ inputs.configurePreset }} ${{ inputs.buildPreset }}${{ inputs.tools && '+t' || '' }}${{ inputs.extras && '+e' || '' }} Artifact
145
129
uses : actions/upload-artifact@v4
146
130
with :
147
- name : ${{ inputs.game }}-${{ inputs.preset }}${{ inputs.tools && '+t' || '' }}${{ inputs.extras && '+e' || '' }}
148
- path : build\${{ inputs.preset }}\${{ inputs.game }}\artifacts
131
+ name : ${{ inputs.game }}-${{ inputs.configurePreset }}-${{ inputs.buildPreset }}${{ inputs.tools && '+t' || '' }}${{ inputs.extras && '+e' || '' }}
132
+ path : build\${{ inputs.configurePreset }}\${{ inputs.game }}\artifacts
149
133
retention-days : 30
150
134
if-no-files-found : error
0 commit comments