Skip to content

Commit 4b0fe2c

Browse files
committed
Build SDL 2 Windows.
1 parent 7ae95e5 commit 4b0fe2c

1 file changed

Lines changed: 41 additions & 16 deletions

File tree

.github/workflows/build-natives.yml

Lines changed: 41 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -18,27 +18,52 @@ permissions:
1818
jobs:
1919
windows:
2020
name: Windows (x86 + x64)
21-
runs-on: ubuntu-22.04
21+
runs-on: windows-2022
2222
steps:
2323
- name: Setup Dependencies
24+
shell: pwsh
2425
run: |
25-
mkdir -p artifacts/x86
26-
mkdir artifacts/x64
26+
New-Item -ItemType Directory -Force -Path artifacts/x86 | Out-Null
27+
New-Item -ItemType Directory -Force -Path artifacts/x64 | Out-Null
2728
28-
# Download an official precompiled release version of SDL because compiling for Windows on Linux is hard.
29-
# Download also a precompiled version of Chromium in order to extract libEGL.dll and libGLESv2.dll, which the Windows SDL DLL depends on.
30-
- name: Download Natives
29+
- name: Build SDL2 (x86 + x64)
30+
shell: pwsh
3131
run: |
32-
curl -s -L -O https://www.libsdl.org/release/SDL2-${SDL2_VERSION}-win32-x86.zip
33-
unzip SDL2-${SDL2_VERSION}-win32-x86.zip SDL2.dll -d artifacts/x86
34-
curl -s -L -O https://storage.googleapis.com/chromium-browser-snapshots/Win/${CHROMIUM_BUILD_x86}/chrome-win.zip
35-
unzip -j chrome-win.zip chrome-win/libEGL.dll -d artifacts/x86
36-
unzip -j chrome-win.zip chrome-win/libGLESv2.dll -d artifacts/x86
37-
curl -s -L -O https://www.libsdl.org/release/SDL2-${SDL2_VERSION}-win32-x64.zip
38-
unzip SDL2-${SDL2_VERSION}-win32-x64.zip SDL2.dll -d artifacts/x64
39-
curl -s -L -O https://storage.googleapis.com/chromium-browser-snapshots/Win_x64/${CHROMIUM_BUILD_x64}/chrome-win.zip
40-
unzip -j chrome-win.zip chrome-win/libEGL.dll -d artifacts/x64
41-
unzip -j chrome-win.zip chrome-win/libGLESv2.dll -d artifacts/x64
32+
$ErrorActionPreference = "Stop"
33+
34+
$sdlZip = "SDL2-${env:SDL2_VERSION}.zip"
35+
$sdlUrl = "https://github.com/libsdl-org/SDL/releases/download/release-${env:SDL2_VERSION}/$sdlZip"
36+
37+
Invoke-WebRequest -Uri $sdlUrl -OutFile $sdlZip
38+
Expand-Archive -Path $sdlZip -DestinationPath .
39+
$sdlRoot = "SDL2-${env:SDL2_VERSION}"
40+
41+
# Build x86
42+
cmake -S $sdlRoot -B build-x86 -A Win32 -DCMAKE_BUILD_TYPE=Release -DSDL_SHARED=ON -DSDL_STATIC=OFF
43+
cmake --build build-x86 --config Release
44+
Copy-Item "build-x86/Release/SDL2.dll" "artifacts/x86/SDL2.dll" -Force
45+
46+
# Build x64
47+
cmake -S $sdlRoot -B build-x64 -A x64 -DCMAKE_BUILD_TYPE=Release -DSDL_SHARED=ON -DSDL_STATIC=OFF
48+
cmake --build build-x64 --config Release
49+
Copy-Item "build-x64/Release/SDL2.dll" "artifacts/x64/SDL2.dll" -Force
50+
51+
- name: Download ANGLE
52+
shell: pwsh
53+
run: |
54+
$ErrorActionPreference = "Stop"
55+
56+
# x86 ANGLE
57+
Invoke-WebRequest -Uri "https://storage.googleapis.com/chromium-browser-snapshots/Win/${env:CHROMIUM_BUILD_x86}/chrome-win.zip" -OutFile "chrome-win-x86.zip"
58+
Expand-Archive -Path "chrome-win-x86.zip" -DestinationPath "chrome-win-x86"
59+
Copy-Item "chrome-win-x86/chrome-win/libEGL.dll" "artifacts/x86/libEGL.dll" -Force
60+
Copy-Item "chrome-win-x86/chrome-win/libGLESv2.dll" "artifacts/x86/libGLESv2.dll" -Force
61+
62+
# x64 ANGLE
63+
Invoke-WebRequest -Uri "https://storage.googleapis.com/chromium-browser-snapshots/Win_x64/${env:CHROMIUM_BUILD_x64}/chrome-win.zip" -OutFile "chrome-win-x64.zip"
64+
Expand-Archive -Path "chrome-win-x64.zip" -DestinationPath "chrome-win-x64"
65+
Copy-Item "chrome-win-x64/chrome-win/libEGL.dll" "artifacts/x64/libEGL.dll" -Force
66+
Copy-Item "chrome-win-x64/chrome-win/libGLESv2.dll" "artifacts/x64/libGLESv2.dll" -Force
4267
4368
- name: Upload Artifacts
4469
uses: actions/upload-artifact@v7

0 commit comments

Comments
 (0)