@@ -30,12 +30,15 @@ jobs:
3030 - os : windows-latest
3131 c_compiler : cl
3232 cpp_compiler : cl
33+ generator : " Visual Studio 17 2022"
3334 - os : ubuntu-latest
3435 c_compiler : clang
3536 cpp_compiler : clang++
37+ generator : " Unix Makefiles"
3638 - os : macos-latest
3739 c_compiler : clang
3840 cpp_compiler : clang++
41+ generator : " Ninja"
3942 exclude :
4043 - os : windows-latest
4144 c_compiler : clang
4750 steps :
4851 - uses : actions/checkout@v4
4952
53+ - name : Install Linux build dependencies
54+ if : matrix.os == 'ubuntu-latest'
55+ run : |
56+ sudo apt-get update
57+ sudo apt-get install -y build-essential cmake make pkg-config
58+ sudo apt-get install -y libgl1-mesa-dev libx11-dev
59+ sudo apt-get install -y autoconf automake libtool gettext
60+ sudo apt-get install -y libsdl3-dev libsdl3-image-dev
61+ sudo apt-get install -y libcrypt-dev
62+
5063 - name : Set reusable strings
5164 # Turn repeated input strings (such as the build output directory) into step outputs. These step outputs can be used throughout the workflow file.
5265 id : strings
@@ -58,53 +71,138 @@ jobs:
5871 - name : Setup vcpkg
5972 uses : lukka/run-vcpkg@v11
6073 with :
61- # Optional: specify the vcpkg commit id to use, defaults to the latest one of the vcpkg repository.
62- vcpkgCommitId : ' a0f95bc760ed5c8f6d553aaff7dde3a9c4f605a2'
6374 # Optional: specify the vcpkg arguments, e.g. to specify the triplet or use a custom vcpkg repository.
6475 vcpkgArguments : ' @vcpkg.json'
65-
76+ - name : Submodule update
77+ run : git submodule update --init --recursive
78+
6679 - name : Configure CMake
6780 # Configure CMake in a 'build' subdirectory. `CMAKE_BUILD_TYPE` is only required if you are using a single-configuration generator such as make.
6881 # See https://cmake.org/cmake/help/latest/variable/CMAKE_BUILD_TYPE.html?highlight=cmake_build_type
6982 run : >
7083 cmake -B ${{ steps.strings.outputs.build-output-dir }}
84+ -G "${{ matrix.generator }}"
7185 -DCMAKE_CXX_COMPILER=${{ matrix.cpp_compiler }}
7286 -DCMAKE_C_COMPILER=${{ matrix.c_compiler }}
7387 -DCMAKE_BUILD_TYPE=${{ matrix.build_type }}
7488 -DCMAKE_TOOLCHAIN_FILE=${{ github.workspace }}/vcpkg/scripts/buildsystems/vcpkg.cmake
89+ -DVCPKG_TARGET_TRIPLET=${{ matrix.os == 'windows-latest' && 'x64-windows' || matrix.os == 'macos-latest' && 'x64-osx' || 'x64-linux' }}
7590 -S ${{ github.workspace }}
76-
7791 - name : Build
7892 # Build your program with the given configuration. Note that --config is needed because the default Windows generator is a multi-config generator (Visual Studio generator).
7993 run : cmake --build ${{ steps.strings.outputs.build-output-dir }} --config ${{ matrix.build_type }}
8094
81- - name : Find built executables
82- id : find-binaries
95+ - name : Find Windows binaries
96+ if : matrix.os == 'windows-latest'
97+ id : find-windows
98+ shell : pwsh
99+ run : |
100+ $buildDir = "${{ steps.strings.outputs.build-output-dir }}"
101+ Write-Host "Looking for binaries in: $buildDir"
102+
103+ if (Test-Path $buildDir) {
104+ # Find executables
105+ $exes = Get-ChildItem -Path $buildDir -Recurse -Filter "*.exe" -File
106+ # Find DLLs
107+ $dlls = Get-ChildItem -Path $buildDir -Recurse -Filter "*.dll" -File
108+ # Find static libraries
109+ $libs = Get-ChildItem -Path $buildDir -Recurse -Filter "*.lib" -File
110+
111+ $allBinaries = $exes + $dlls + $libs
112+
113+ if ($allBinaries) {
114+ foreach ($binary in $allBinaries) {
115+ Write-Host "Found binary: $($binary.FullName)"
116+ }
117+ # Set output for upload - include all binary types
118+ echo "artifact-path=$buildDir/**/*.exe,$buildDir/**/*.dll,$buildDir/**/*.lib" | Out-File -FilePath $env:GITHUB_OUTPUT -Append
119+ echo "has-binaries=true" | Out-File -FilePath $env:GITHUB_OUTPUT -Append
120+ } else {
121+ Write-Host "No binaries found"
122+ echo "artifact-path=" | Out-File -FilePath $env:GITHUB_OUTPUT -Append
123+ echo "has-binaries=false" | Out-File -FilePath $env:GITHUB_OUTPUT -Append
124+ }
125+ } else {
126+ Write-Host "Build directory not found: $buildDir"
127+ echo "artifact-path=" | Out-File -FilePath $env:GITHUB_OUTPUT -Append
128+ echo "has-binaries=false" | Out-File -FilePath $env:GITHUB_OUTPUT -Append
129+ }
130+
131+ - name : Find Unix binaries
132+ if : matrix.os != 'windows-latest'
133+ id : find-unix
83134 shell : bash
84135 run : |
85- # Find all executable files in the build directory
86- if [[ "${{ matrix.os }}" == "windows-latest" ]]; then
87- # On Windows, look for .exe files
88- find ${{ steps.strings.outputs.build-output-dir }} -name "*.exe" -type f | while read file; do
89- echo "Found executable: $file"
90- done
91- # Prepare artifact path for Windows
92- echo "artifact-path=${{ steps.strings.outputs.build-output-dir }}/**/*.exe" >> "$GITHUB_OUTPUT"
93- else
94- # On Linux/macOS, look for executable files without extension
95- find ${{ steps.strings.outputs.build-output-dir }} -type f -executable | while read file; do
96- # Exclude directories and non-binary files
97- if [[ ! -d "$file" ]] && file "$file" | grep -q "ELF\|Mach-O"; then
136+ BUILD_DIR="${{ steps.strings.outputs.build-output-dir }}"
137+ echo "Looking for binaries in: $BUILD_DIR"
138+
139+ if [ -d "$BUILD_DIR" ]; then
140+ # Find executables
141+ echo "=== Executables ==="
142+ find "$BUILD_DIR" -type f -executable | while read file; do
143+ if [[ ! -d "$file" ]] && ( file "$file" 2>/dev/null | grep -q "ELF\|Mach-O" || [[ "$file" == *".so"* ]] ); then
98144 echo "Found executable: $file"
99145 fi
100146 done
101- # Prepare artifact path for Unix-like systems
102- echo "artifact-path=${{ steps.strings.outputs.build-output-dir }}/**/*" >> "$GITHUB_OUTPUT"
147+
148+ # Find shared libraries (.so, .dylib)
149+ echo "=== Shared Libraries ==="
150+ find "$BUILD_DIR" -type f \( -name "*.so" -o -name "*.so.*" -o -name "*.dylib" -o -name "*.dylib.*" \) | while read file; do
151+ if [[ ! -d "$file" ]]; then
152+ echo "Found shared library: $file"
153+ fi
154+ done
155+
156+ # Find static libraries (.a)
157+ echo "=== Static Libraries ==="
158+ find "$BUILD_DIR" -type f -name "*.a" | while read file; do
159+ if [[ ! -d "$file" ]]; then
160+ echo "Found static library: $file"
161+ fi
162+ done
163+
164+ # Set artifact path to include all binary types
165+ echo "artifact-path=$BUILD_DIR/**/*" >> "$GITHUB_OUTPUT"
166+ echo "has-binaries=true" >> "$GITHUB_OUTPUT"
167+ else
168+ echo "Build directory not found: $BUILD_DIR"
169+ echo "artifact-path=" >> "$GITHUB_OUTPUT"
170+ echo "has-binaries=false" >> "$GITHUB_OUTPUT"
103171 fi
104172
105173 - name : Upload build artifacts
174+ if : steps.find-windows.outputs.has-binaries == 'true' || steps.find-unix.outputs.has-binaries == 'true'
106175 uses : actions/upload-artifact@v4
107176 with :
108- name : ${{ steps.strings.outputs.artifact-name }}
109- path : ${{ steps.find-binaries .outputs.artifact-path }}
177+ name : ${{ steps.strings.outputs.artifact-name }}-binaries
178+ path : ${{ steps.find-windows.outputs.artifact-path || steps.find-unix .outputs.artifact-path }}
110179 retention-days : 7
180+
181+ - name : Upload complete build directory
182+ if : always()
183+ uses : actions/upload-artifact@v4
184+ with :
185+ name : ${{ steps.strings.outputs.artifact-name }}-build-dir
186+ path : ${{ steps.strings.outputs.build-output-dir }}
187+ retention-days : 3
188+
189+ - name : Debug build output
190+ if : failure()
191+ run : |
192+ echo "=== Debugging build output ==="
193+ echo "Workspace: ${{ github.workspace }}"
194+ echo "Build dir: ${{ steps.strings.outputs.build-output-dir }}"
195+ if [[ "${{ matrix.os }}" == "windows-latest" ]]; then
196+ BUILD_DIR=$(echo "${{ steps.strings.outputs.build-output-dir }}" | sed 's/\\/\//g')
197+ else
198+ BUILD_DIR="${{ steps.strings.outputs.build-output-dir }}"
199+ fi
200+ echo "Checking if build directory exists: $BUILD_DIR"
201+ if [ -d "$BUILD_DIR" ]; then
202+ echo "Build directory exists. Contents:"
203+ find "$BUILD_DIR" -type f -name "*.exe" -o -name "*.dll" -o -type f -executable | head -20
204+ else
205+ echo "Build directory does not exist"
206+ echo "Workspace contents:"
207+ ls -la "${{ github.workspace }}" || echo "ls failed"
208+ fi
0 commit comments