11# Summary
22# This reusable workflow handles building UE4SS with CMake, including setup of dependencies and uploading of artifacts.
3- # Any future workflows/tasks that require UE4SS to be built should call this reusable workflow to ensure consistency.
43name : " Build UE4SS with CMake"
54permissions :
65 contents : read
1918 description : ' Should build output be uploaded as an artifact?'
2019 type : boolean
2120 default : false
22- artifact-list :
23- description : ' List of targets to upload artifacts for'
24- type : string
25- default : ' ["UE4SS"]'
2621 artifact-retention-days :
2722 description : ' How many days to retain artifacts'
2823 type : number
@@ -41,18 +36,14 @@ jobs:
4136 token : ${{ secrets.UEPSEUDO_PAT }}
4237 ref : ${{inputs.commit-sha}}
4338
44- # Store the current week (00-53) to use as part of the cache key.
45- # This saves us from having to detect older caches and delete them.
4639 - name : Get current week as package key
4740 id : cache_key
4841 run : echo "key=$(date +'%W')" >> $GITHUB_OUTPUT
4942 shell : bash
5043
51- # Specifically use MSVC toolset v19.39.33523
5244 - name : Install VS2022 BuildTools 17.9.7
5345 run : choco install -y visualstudio2022buildtools --version=117.9.7.0 --params "--add Microsoft.VisualStudio.Component.VC.Tools.x86.x64 --installChannelUri https://aka.ms/vs/17/release/180911598_-255012421/channel"
5446
55- # Setup CMake and Ninja
5647 - name : Setup CMake
5748 uses : jwlawson/actions-setup-cmake@v2
5849 with :
@@ -61,16 +52,15 @@ jobs:
6152 - name : Setup Ninja
6253 uses : seanmiddleditch/gha-setup-ninja@v5
6354
64- # Create build directory name based on mode
6555 - name : Create build directory name
6656 id : build_dir
6757 run : |
6858 $mode = "${{inputs.build-mode}}"
6959 $buildDir = "build_cmake_$mode"
7060 echo "name=$buildDir" >> $env:GITHUB_OUTPUT
7161
72- # Configure CMake
73- - name : Configure CMake
62+ # FIXED: Combined Configure and Build, added proxy target
63+ - name : Configure and Build
7464 run : |
7565 Import-Module 'C:\Program Files (x86)\Microsoft Visual Studio\2022\BuildTools\Common7\Tools\Microsoft.VisualStudio.DevShell.dll'
7666 Enter-VsDevShell -VsInstallPath 'C:\Program Files (x86)\Microsoft Visual Studio\2022\BuildTools' -DevCmdArguments '-arch=x64 -host_arch=x64'
@@ -81,65 +71,38 @@ jobs:
8171 -DCMAKE_C_COMPILER=cl `
8272 -DCMAKE_CXX_COMPILER=cl `
8373 -DCMAKE_EXPORT_COMPILE_COMMANDS=ON
84-
85- # Build
86- - name : Build
87- id : build
88- run : |
89- cmake --build ${{ steps.build_dir.outputs.name }} --target UE4SS
9074
91- # Get the actual output path
92- $outputPath = " ${{ steps.build_dir.outputs.name }}/bin"
93- echo "output_path=$outputPath" >> $env:GITHUB_OUTPUT
75+ # Build both UE4SS and proxy targets
76+ cmake --build ${{ steps.build_dir.outputs.name }} --target UE4SS
77+ cmake --build ${{ steps.build_dir.outputs.name }} --target proxy
9478
95- # Collect files for artifact
79+ # FIXED: Collect all required artifacts including dwmapi.dll
9680 - name : Calculate Files For Artifact Inclusion
9781 id : calc-files-artifact
9882 if : ${{inputs.should-upload-artifact == true}}
9983 run : |
10084 $artifact_dir = New-Item -Path '${{runner.temp}}/ue4ss_artifacts/' -ItemType Directory -Force
85+ $buildDir = "${{ steps.build_dir.outputs.name }}"
10186
102- # Find all DLL and PDB files in the output directory
103- $outputPath = "${{ steps.build.outputs.output_path }}"
104-
105- # Copy UE4SS.dll and UE4SS.pdb if they exist
106- $dllPath = Join-Path $outputPath "UE4SS.dll"
107- $pdbPath = Join-Path $outputPath "UE4SS.pdb"
108-
109- if (Test-Path $dllPath) {
110- Write-Host "Found: $dllPath"
111- Copy-Item $dllPath -Destination $artifact_dir
112- }
113-
114- if (Test-Path $pdbPath) {
115- Write-Host "Found: $pdbPath"
116- Copy-Item $pdbPath -Destination $artifact_dir
117- }
118-
119- # Also check in the build directory root
120- $buildRoot = "${{ steps.build_dir.outputs.name }}"
121- $dllPathRoot = Join-Path $buildRoot "UE4SS.dll"
122- $pdbPathRoot = Join-Path $buildRoot "UE4SS.pdb"
123-
124- if ((Test-Path $dllPathRoot) -and !(Test-Path (Join-Path $artifact_dir "UE4SS.dll"))) {
125- Write-Host "Found in root: $dllPathRoot"
126- Copy-Item $dllPathRoot -Destination $artifact_dir
127- }
128-
129- if ((Test-Path $pdbPathRoot) -and !(Test-Path (Join-Path $artifact_dir "UE4SS.pdb"))) {
130- Write-Host "Found in root: $pdbPathRoot"
131- Copy-Item $pdbPathRoot -Destination $artifact_dir
87+ # Find and copy UE4SS files
88+ $files = @("UE4SS.dll", "UE4SS.pdb", "dwmapi.dll")
89+ foreach ($fileName in $files) {
90+ $filePath = Get-ChildItem -Path $buildDir -Recurse -Filter $fileName -ErrorAction SilentlyContinue | Select-Object -First 1
91+ if ($filePath) {
92+ Write-Host "Found: $($filePath.FullName)"
93+ Copy-Item $filePath.FullName -Destination $artifact_dir
94+ } else {
95+ Write-Host "Warning: $fileName not found"
96+ }
13297 }
13398
134- echo "artifact_dir=$artifact_dir" | Out-File -FilePath $env:GITHUB_OUTPUT -Encoding utf8 -Append
99+ echo "artifact_dir=$artifact_dir" >> $env:GITHUB_OUTPUT
135100
136101 - name : Upload a Build Artifact
137- id : upload-artifact
138- 139102 if : ${{inputs.should-upload-artifact == true}}
103+ uses : actions/upload-artifact@v4
140104 with :
141- name : MSVC-CMAKE-${{inputs.build-mode}}
142- path : |
143- ${{ steps.calc-files-artifact.outputs.artifact_dir }}
144- retention-days : ${{fromJSON(inputs.artifact-retention-days)}}
105+ name : CMAKE-${{inputs.build-mode}}
106+ path : ${{ steps.calc-files-artifact.outputs.artifact_dir }}
107+ retention-days : ${{inputs.artifact-retention-days}}
145108 overwrite : true
0 commit comments