@@ -32,28 +32,30 @@ jobs:
3232 -DBUILD_TESTS=OFF
3333 -DBINARYEN_CORES=1
3434 runtime : linux-x86
35- # Windows 64-bit (cross-compile)
36- - os : ubuntu -latest
35+ # Windows 64-bit
36+ - os : windows -latest
3737 arch : x64
3838 target : windows
3939 cmake-args : >
40- -DCMAKE_SYSTEM_NAME=Windows
41- -DCMAKE_C_COMPILER=x86_64-w64-mingw32-gcc
42- -DCMAKE_CXX_COMPILER=x86_64-w64-mingw32-g++
43- -DBUILD_SHARED_LIBS=ON
40+ -DCMAKE_C_COMPILER=gcc
41+ -DCMAKE_CXX_COMPILER=g++
42+ -DCMAKE_C_FLAGS="-static -static-libgcc -static-libstdc++"
43+ -DCMAKE_CXX_FLAGS="-static -static-libgcc -static-libstdc++"
44+ -DBUILD_SHARED_LIBS=OFF
4445 -DBUILD_TOOLS=OFF
4546 -DBUILD_TESTS=OFF
4647 -DBINARYEN_CORES=1
4748 runtime : win-x64
48- # Windows 32-bit (cross-compile )
49- - os : ubuntu -latest
49+ # Windows 32-bit (native g++, static )
50+ - os : windows -latest
5051 arch : x86
5152 target : windows
5253 cmake-args : >
53- -DCMAKE_SYSTEM_NAME=Windows
5454 -DCMAKE_C_COMPILER=i686-w64-mingw32-gcc
5555 -DCMAKE_CXX_COMPILER=i686-w64-mingw32-g++
56- -DBUILD_SHARED_LIBS=ON
56+ -DCMAKE_C_FLAGS="-static -static-libgcc -static-libstdc++"
57+ -DCMAKE_CXX_FLAGS="-static -static-libgcc -static-libstdc++"
58+ -DBUILD_SHARED_LIBS=OFF
5759 -DBUILD_TOOLS=OFF
5860 -DBUILD_TESTS=OFF
5961 -DBINARYEN_CORES=1
@@ -66,10 +68,19 @@ jobs:
6668 with :
6769 submodules : recursive
6870
69- - name : Install build dependencies
71+ - name : Install build dependencies (Linux)
72+ if : runner.os == 'Linux'
7073 run : |
7174 sudo apt-get update
72- sudo apt-get install -y g++-multilib gcc-multilib cmake make mingw-w64
75+ sudo apt-get install -y g++-multilib gcc-multilib cmake make
76+
77+ - name : Install MinGW (Windows)
78+ if : runner.os == 'Windows'
79+ shell : pwsh
80+ run : |
81+ choco install mingw -y
82+ refreshenv
83+ echo "Added g++ to PATH: $(where g++)"
7384
7485 - name : Configure
7586 run : cmake -S binaryen -B binaryen ${{ matrix.cmake-args }}
8091 - name : Copy to NuGet runtime folder
8192 run : |
8293 mkdir -p package/runtimes/${{ matrix.runtime }}/native
83- if [[ "${{ matrix.target }}" == "windows" ] ]; then
94+ if [ "${{ matrix.target }}" = "windows" ]; then
8495 cp -r binaryen/bin/* package/runtimes/${{ matrix.runtime }}/native/
8596 else
8697 cp -r binaryen/lib/* package/runtimes/${{ matrix.runtime }}/native/
0 commit comments