@@ -22,17 +22,20 @@ jobs:
22
22
compiler : clang
23
23
cc : clang
24
24
cxx : clang++
25
- # For now disable msvc test
26
- # - os: windows-latest
27
- # compiler: msvc
28
- # cc: cl
29
- # cxx: cl
25
+ - os : windows-latest
26
+ compiler : msvc
27
+ cc : cl
28
+ cxx : cl
29
+ - os : windows-latest
30
+ compiler : mingw64
31
+ cc : x86_64-w64-mingw32-gcc
32
+ cxx : x86_64-w64-mingw32-g++
30
33
31
34
steps :
32
35
- name : Checkout repository
33
36
uses : actions/checkout@v4
34
37
35
- - name : Install prerequisites & build SDL2 v2.0.20 (Linux)
38
+ - name : Install prerequisites (Linux)
36
39
if : matrix.os == 'ubuntu-latest'
37
40
run : |
38
41
sudo apt-get update
@@ -43,65 +46,16 @@ jobs:
43
46
libsdl2-dev libsdl2-ttf-dev libsdl2-mixer-dev \
44
47
libglew-dev libfreetype6-dev
45
48
46
- # sudo apt-get install -y \
47
- # build-essential cmake ccache git \
48
- # libgl1-mesa-dev libglu1-mesa-dev \
49
- # libx11-dev libxrandr-dev libxi-dev libxinerama-dev libxcursor-dev libxss-dev libxxf86vm-dev \
50
- # libglew-dev libfreetype6-dev libasound2-dev libpulse-dev libudev-dev libdbus-1-dev \
51
- # libmpg123-dev libvorbis-dev libflac-dev libxmp-dev \
52
- # libopusfile-dev libfluidsynth-dev libogg-dev libwavpack-dev
53
-
54
- # # SDL2 v2.0.20
55
- # git clone https://github.com/libsdl-org/SDL.git SDL2
56
- # cd SDL2
57
- # git fetch --tags # ← make sure tags are present locally
58
- # git checkout release-2.0.20 # ← the correct release tag
59
- # mkdir build && cd build
60
- # cmake .. -DCMAKE_BUILD_TYPE=Release \
61
- # -DSDL_INSTALL_INCLUDEDIR=include/SDL2
62
- # make -j$(nproc)
63
- # sudo make install
64
- # sudo ldconfig
65
- # cd ../..
66
-
67
- # # repeat the same pattern (fetch tags + checkout) for ttf & mixer
68
- # git clone https://github.com/libsdl-org/SDL_ttf.git SDL_ttf
69
- # cd SDL_ttf
70
- # git fetch --tags
71
- # git checkout release-2.0.15
72
- # mkdir build && cd build
73
- # cmake .. -DCMAKE_BUILD_TYPE=Release
74
- # make -j$(nproc)
75
- # sudo make install
76
- # sudo ldconfig
77
- # cd ../..
78
-
79
- # git clone https://github.com/libsdl-org/SDL_mixer.git SDL_mixer
80
- # cd SDL_mixer
81
- # git fetch --tags
82
- # git checkout release-2.0.4
83
- # mkdir build && cd build
84
- # cmake .. -DCMAKE_BUILD_TYPE=Release
85
- # make -j$(nproc)
86
- # sudo make install
87
- # sudo ldconfig
88
- # cd ../..
89
-
90
- - name : Cache ccache
91
- uses : actions/cache@v3
92
- with :
93
- path : ~/.ccache
94
- key : ${{ runner.os }}-ccache-${{ matrix.compiler }}-${{ hashFiles('**/CMakeLists.txt') }}
95
- restore-keys : |
96
- ${{ runner.os }}-ccache-${{ matrix.compiler }}-
49
+ - name : Install MinGW (Windows, MinGW only)
50
+ if : matrix.os == 'windows-latest' && matrix.compiler == 'mingw64'
51
+ shell : bash
52
+ run : |
53
+ choco install -y mingw
54
+ echo "C:/ProgramData/chocolatey/bin" >> $GITHUB_PATH
97
55
98
- - name : Cache CMake build
99
- uses : actions/cache@v3
100
- with :
101
- path : build
102
- key : ${{ runner.os }}-cmake-${{ matrix.compiler }}-${{ hashFiles('**/CMakeLists.txt') }}
103
- restore-keys : |
104
- ${{ runner.os }}-cmake-${{ matrix.compiler }}-
56
+ - name : Setup MSVC (Windows, MSVC only)
57
+ if : matrix.os == 'windows-latest' && matrix.compiler == 'msvc'
58
+ uses : ilammy/msvc-dev-cmd@v1
105
59
106
60
- name : Configure with CMake
107
61
run : |
@@ -114,15 +68,36 @@ jobs:
114
68
-DCMAKE_BUILD_TYPE=Release \
115
69
-DCMAKE_PREFIX_PATH="/usr/local" \
116
70
..
117
- else
71
+ elif [ "${{ matrix.compiler }}" = "mingw64" ]; then
118
72
cmake \
73
+ -G "MinGW Makefiles" \
119
74
-DCMAKE_C_COMPILER=${{ matrix.cc }} \
120
75
-DCMAKE_CXX_COMPILER=${{ matrix.cxx }} \
121
76
-DCMAKE_BUILD_TYPE=Release \
122
77
..
123
- fi
78
+ else
79
+ cmake \
80
+ -DCMAKE_BUILD_TYPE=Release \
81
+ ..
82
+ shell : bash
124
83
125
- - name : Verify SDL2 installation (Linux)
84
+ - name : Cache ccache
85
+ uses : actions/cache@v3
86
+ with :
87
+ path : ~/.ccache
88
+ key : ${{ runner.os }}-ccache-${{ matrix.compiler }}-${{ hashFiles('**/CMakeLists.txt') }}
89
+ restore-keys : |
90
+ ${{ runner.os }}-ccache-${{ matrix.compiler }}-
91
+
92
+ - name : Cache CMake build
93
+ uses : actions/cache@v3
94
+ with :
95
+ path : build
96
+ key : ${{ runner.os }}-cmake-${{ matrix.compiler }}-${{ hashFiles('**/CMakeLists.txt') }}
97
+ restore-keys : |
98
+ ${{ runner.os }}-cmake-${{ matrix.compiler }}-
99
+
100
+ - name : Verify SDL2 installation (Linux only)
126
101
if : matrix.os == 'ubuntu-latest'
127
102
run : |
128
103
echo "Includes:"
@@ -131,9 +106,16 @@ jobs:
131
106
sdl2-config --version
132
107
133
108
- name : Build tests only
134
- run : cmake --build build --config Release --target t1 -- -j$(nproc || echo 2)
109
+ run : |
110
+ cd build
111
+ if [ "${{ matrix.compiler }}" = "mingw64" ]; then
112
+ mingw32-make -j$(nproc || echo 2) t1
113
+ else
114
+ cmake --build . --config Release --target t1 -- -j$(nproc || echo 2)
115
+ shell : bash
135
116
136
117
- name : Run unit tests
137
118
run : |
138
119
cd build
139
120
ctest --output-on-failure --parallel $(nproc || echo 2)
121
+ shell : bash
0 commit comments