Skip to content

Commit 14bdd7d

Browse files
committed
Run CI on more configurations
1 parent bd9eff7 commit 14bdd7d

File tree

3 files changed

+68
-10
lines changed

3 files changed

+68
-10
lines changed

.github/workflows/cmake.yml

Lines changed: 51 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -12,26 +12,70 @@ env:
1212
jobs:
1313
build:
1414
strategy:
15+
fail-fast: false
1516
matrix:
16-
os: [ubuntu-latest, windows-latest, macos-latest]
17+
system: [ Linux-x64, Windows-MSVC-x64, Windows-MSYS-x64, MacOS-x64, MacOS-ARM ]
18+
webgpu-backend: [ DAWN, WGPU ]
19+
link-type: [ SHARED, STATIC ]
20+
build-type: [ Debug, Release ]
21+
1722
include:
18-
- os: ubuntu-latest
23+
- system: Linux-x64
24+
runner: ubuntu-latest
1925
install-deps: |
2026
sudo apt-get update -y
2127
sudo apt-get install -y xorg-dev
28+
29+
- system: Windows-MSVC-x64
30+
runner: windows-latest
31+
exe-extension: .exe
32+
is-multiconfig: true
33+
34+
- system: Windows-MSYS-x64
35+
runner: windows-latest
36+
msystem: ucrt64
37+
extra-cmake-args: -G "MSYS Makefiles"
38+
exe-extension: .exe
39+
40+
- system: MacOS-ARM
41+
runner: macos-latest
42+
43+
- system: MacOS-x64
44+
runner: macos-13
45+
46+
exclude:
47+
- webgpu-backend: DAWN
48+
link-type: STATIC
2249

2350

24-
runs-on: ${{ matrix.os }}
51+
runs-on: ${{ matrix.runner }}
2552

2653
steps:
2754
- uses: actions/checkout@v4
2855

29-
- if: ${{ matrix.install-deps }}
30-
name: Install dependencies
56+
- name: Install dependencies
57+
if: ${{ matrix.install-deps }}
3158
run: ${{ matrix.install-deps }}
3259

60+
- name: Setup MSYS
61+
if: ${{ matrix.msystem }}
62+
uses: msys2/setup-msys2@v2
63+
with:
64+
msystem: ${{ matrix.msystem }}
65+
pacboy: cmake:p
66+
3367
- name: Configure CMake
34-
run: cmake -S examples -B ${{github.workspace}}/build -DCMAKE_BUILD_TYPE=${{env.BUILD_TYPE}}
68+
run: >
69+
cmake
70+
-S examples
71+
-B build
72+
-DWEBGPU_BACKEND=${{ matrix.webgpu-backend }}
73+
-D${{ matrix.webgpu-backend }}_LINK_TYPE=${{ matrix.link-type }}
74+
-DCMAKE_BUILD_TYPE=${{ matrix.build-type }}
75+
${{ matrix.extra-cmake-args }}
3576
3677
- name: Build
37-
run: cmake --build ${{github.workspace}}/build --config ${{env.BUILD_TYPE}}
78+
run: >
79+
cmake
80+
--build build
81+
--config ${{ matrix.build-type }}

examples/CMakeLists.txt

Lines changed: 14 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,20 @@ add_subdirectory(.. sdl2webgpu)
2525

2626
# Example
2727
add_executable(hello-sdl2webgpu hello-sdl2webgpu.c)
28-
target_link_libraries(hello-sdl2webgpu PRIVATE SDL2::SDL2-static webgpu sdl2webgpu)
28+
target_link_libraries(hello-sdl2webgpu PRIVATE SDL2::SDL2 webgpu sdl2webgpu)
2929
set_target_properties(hello-sdl2webgpu PROPERTIES CXX_STANDARD 17)
3030
target_treat_all_warnings_as_errors(hello-sdl2webgpu)
31+
32+
# Copy wgpu-native or Dawn dll/so/dylib next to the executable
3133
target_copy_webgpu_binaries(hello-sdl2webgpu)
34+
35+
# Copy SDL2.dll/so/dylib next to the executable
36+
add_custom_command(
37+
TARGET hello-sdl2webgpu
38+
POST_BUILD
39+
COMMAND
40+
${CMAKE_COMMAND}
41+
-E copy_if_different
42+
$<TARGET_FILE:SDL2::SDL2>
43+
$<TARGET_FILE_DIR:hello-sdl2webgpu>
44+
)

examples/hello-sdl2webgpu.c

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -52,10 +52,11 @@ int main(int argc, char* argv[]) {
5252

5353
// Wait for close
5454
SDL_Event event;
55-
while (1)
55+
int running = 1;
56+
while (running)
5657
while (SDL_PollEvent(&event))
5758
if (event.type == SDL_QUIT)
58-
break;
59+
running = 0;
5960
// Terminate SDL
6061
SDL_DestroyWindow(window);
6162
SDL_Quit();

0 commit comments

Comments
 (0)