Skip to content

Commit c57431e

Browse files
committed
GitHub Actions: Build with MinGW
1 parent 42dcfec commit c57431e

1 file changed

Lines changed: 32 additions & 3 deletions

File tree

.github/workflows/build.yml

Lines changed: 32 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -9,10 +9,14 @@ jobs:
99
build:
1010
strategy:
1111
matrix:
12-
os: [ubuntu-latest, macos-latest, windows-latest]
12+
os: [ubuntu-latest, macos-latest, windows-latest, windows-2025]
1313
include:
1414
- os: windows-latest
1515
cmake_extra_args: '-DCMAKE_TOOLCHAIN_FILE="$env:VCPKG_INSTALLATION_ROOT/scripts/buildsystems/vcpkg.cmake"'
16+
- os: windows-2025
17+
cmake_extra_args: '-G "MinGW Makefiles" -DCPPUNIT_INCLUDE_DIR="$env:GITHUB_WORKSPACE/pkg/usr/local/include" -DCPPUNIT_LIBRARIES="$($env:GITHUB_WORKSPACE -replace "\\", "/")/pkg/usr/local/lib/libcppunit.dll.a" -DCPPUNIT_INSTALLED_VERSION="1.15.1"'
18+
# The windows-2025 runner is used for MinGW.
19+
name: ${{ matrix.os == 'windows-2025' && 'mingw' || matrix.os }}
1620
runs-on: ${{ matrix.os }}
1721
steps:
1822
- name: Checkout
@@ -32,6 +36,24 @@ jobs:
3236
run: vcpkg install cppunit utfcpp zlib --triplet x64-windows
3337
if: matrix.os == 'windows-latest'
3438

39+
- name: Set up MinGW
40+
shell: bash
41+
run: |
42+
# Fetch utf8cpp, build cppunit
43+
git submodule update --init
44+
# Fails with fatal error: cppunit/config-auto.h: No such file or directory
45+
# vcpkg install cppunit utfcpp zlib --triplet x64-mingw-dynamic
46+
# Probably not working with CMake and MinGW, so we have to build it ourselves.
47+
curl -sL "https://dev-www.libreoffice.org/src/cppunit-1.15.1.tar.gz" | tar xz
48+
mkdir -p build_cppunit
49+
(cd build_cppunit && MAKE=mingw32-make ../cppunit-1.15.1/configure \
50+
--enable-shared=yes --enable-static=no \
51+
--disable-dependency-tracking --disable-doxygen)
52+
find build_cppunit -name Makefile -exec sed -i 's/\($[({]SHELL[)}]\)/"\1"/' {} \;
53+
sed -i 's/^\(SUBDIRS.*\) examples\(.*\)$/\1\2/' build_cppunit/Makefile
54+
(cd build_cppunit && mingw32-make -j$(nproc) install DESTDIR=$(cd .. && pwd)/pkg)
55+
if: matrix.os == 'windows-2025'
56+
3557
- name: Configure
3658
run: >
3759
cmake -B${{github.workspace}}/build
@@ -41,12 +63,12 @@ jobs:
4163
${{ matrix.cmake_extra_args }}
4264
4365
- name: Build
44-
run: cmake --build ${{github.workspace}}/build --config ${{env.BUILD_TYPE}}
66+
run: cmake --build ${{github.workspace}}/build --config ${{env.BUILD_TYPE}} --parallel
4567

4668
- name: Test
4769
working-directory: ${{github.workspace}}/build
4870
run: ctest -C ${{env.BUILD_TYPE}} -V --no-tests=error
49-
if: matrix.os != 'windows-latest'
71+
if: matrix.os != 'windows-latest' && matrix.os != 'windows-2025'
5072

5173
- name: Test Windows
5274
working-directory: ${{github.workspace}}/build
@@ -57,3 +79,10 @@ jobs:
5779
$env:Path += ";$env:VCPKG_INSTALLATION_ROOT\packages\zlib_x64-windows\bin"
5880
ctest -C ${{env.BUILD_TYPE}} -V --no-tests=error
5981
if: matrix.os == 'windows-latest'
82+
83+
- name: Test MinGW
84+
working-directory: ${{github.workspace}}/build
85+
run: |
86+
$env:Path += ";$PWD/taglib;$PWD/bindings/c;${{github.workspace}}/pkg/usr/local/bin"
87+
ctest -C ${{env.BUILD_TYPE}} -V --no-tests=error
88+
if: matrix.os == 'windows-2025'

0 commit comments

Comments
 (0)