feat: add support for win-mingw ucrt64 builds #509
Workflow file for this run
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| name: libdmdutil | |
| on: | |
| push: | |
| pull_request: | |
| permissions: | |
| contents: write | |
| defaults: | |
| run: | |
| shell: bash | |
| jobs: | |
| version: | |
| name: Detect version | |
| runs-on: ubuntu-24.04 | |
| outputs: | |
| tag: ${{ steps.version.outputs.tag }} | |
| steps: | |
| - uses: actions/checkout@v6 | |
| with: | |
| fetch-depth: 0 | |
| - id: version | |
| run: | | |
| VERSION_MAJOR=$(grep -Eo "DMDUTIL_VERSION_MAJOR\s+[0-9]+" include/DMDUtil/DMDUtil.h | grep -Eo "[0-9]+") | |
| VERSION_MINOR=$(grep -Eo "DMDUTIL_VERSION_MINOR\s+[0-9]+" include/DMDUtil/DMDUtil.h | grep -Eo "[0-9]+") | |
| VERSION_PATCH=$(grep -Eo "DMDUTIL_VERSION_PATCH\s+[0-9]+" include/DMDUtil/DMDUtil.h | grep -Eo "[0-9]+") | |
| TAG="${VERSION_MAJOR}.${VERSION_MINOR}.${VERSION_PATCH}" | |
| echo "${TAG}" | |
| echo "tag=${TAG}" >> $GITHUB_OUTPUT | |
| - name: Check git tag | |
| if: startsWith(github.ref, 'refs/tags/v') | |
| run: | | |
| GIT_TAG="${GITHUB_REF#refs/tags/}" | |
| EXPECTED_TAG="v${{ steps.version.outputs.tag }}" | |
| if [[ "${GIT_TAG}" != "${EXPECTED_TAG}" ]]; then | |
| echo "Error: Git tag (${GIT_TAG}) does not match version from DMDUtil.h (v${{ steps.version.outputs.tag }})" | |
| exit 1 | |
| fi | |
| build: | |
| name: Build libdmdutil-${{ matrix.platform }}-${{ matrix.arch }} | |
| runs-on: ${{ matrix.os }} | |
| needs: [ version ] | |
| strategy: | |
| fail-fast: false | |
| matrix: | |
| include: | |
| - { os: windows-2025, platform: win, arch: x64 } | |
| - { os: windows-2025, platform: win, arch: x86 } | |
| - { os: windows-2025, platform: win-mingw, arch: x64 } | |
| - { os: macos-15, platform: macos, arch: arm64 } | |
| - { os: macos-15, platform: macos, arch: x64 } | |
| - { os: ubuntu-24.04, platform: linux, arch: x64 } | |
| - { os: ubuntu-24.04-arm, platform: linux, arch: aarch64 } | |
| - { os: ubuntu-24.04, platform: android, arch: arm64-v8a } | |
| - { os: macos-15, platform: ios, arch: arm64 } | |
| - { os: macos-15, platform: ios-simulator, arch: arm64 } | |
| - { os: macos-15, platform: tvos, arch: arm64 } | |
| steps: | |
| - uses: actions/checkout@v6 | |
| # | |
| # install dependencies | |
| # | |
| - if: (matrix.platform == 'win') | |
| uses: microsoft/setup-msbuild@v2 | |
| - if: (matrix.platform == 'win') | |
| run: | | |
| if [[ "${{ matrix.arch }}" == "x64" ]]; then | |
| /c/msys64/usr/bin/bash.exe -l -c "pacman -S --noconfirm \ | |
| make diffutils \ | |
| mingw-w64-ucrt-x86_64-gcc \ | |
| mingw-w64-ucrt-x86_64-libwinpthread \ | |
| mingw-w64-ucrt-x86_64-cmake" | |
| else | |
| /c/msys64/usr/bin/bash.exe -l -c "pacman -S --noconfirm \ | |
| make diffutils \ | |
| mingw-w64-i686-gcc \ | |
| mingw-w64-i686-libwinpthread \ | |
| mingw-w64-i686-cmake" | |
| fi | |
| - if: (matrix.platform == 'win-mingw') | |
| run: | | |
| /c/msys64/usr/bin/bash.exe -l -c "pacman -S --noconfirm \ | |
| make diffutils autoconf automake libtool \ | |
| mingw-w64-ucrt-x86_64-gcc \ | |
| mingw-w64-ucrt-x86_64-libwinpthread \ | |
| mingw-w64-ucrt-x86_64-cmake" | |
| - if: (matrix.platform == 'macos' || matrix.platform == 'ios' || matrix.platform == 'ios-simulator' || matrix.platform == 'tvos') | |
| run: brew install autoconf automake libtool | |
| - if: (matrix.platform == 'linux') | |
| run: | | |
| sudo apt-get update | |
| sudo apt install libudev-dev autoconf automake libtool pkg-config | |
| - if: (matrix.platform == 'linux' && matrix.arch == 'aarch64') | |
| run: | | |
| sudo apt-get install -y libgpiod-dev | |
| # | |
| # build (win) | |
| # | |
| - if: (matrix.platform == 'win') | |
| name: Build (win) | |
| run: | | |
| ./platforms/${{ matrix.platform }}/${{ matrix.arch }}/external.sh | |
| if [[ "${{ matrix.arch }}" == "x64" ]]; then | |
| cmake \ | |
| -G "Visual Studio 17 2022" \ | |
| -DPLATFORM=${{ matrix.platform }} \ | |
| -DARCH=${{ matrix.arch }} \ | |
| -B build | |
| else | |
| cmake \ | |
| -G "Visual Studio 17 2022" \ | |
| -A Win32 \ | |
| -DPLATFORM=${{ matrix.platform }} \ | |
| -DARCH=${{ matrix.arch }} \ | |
| -B build | |
| fi | |
| cmake --build build --config Release | |
| # | |
| # build (win-mingw) | |
| # | |
| - if: (matrix.platform == 'win-mingw') | |
| name: Build (win-mingw) | |
| run: | | |
| CURRENT_DIR="$(pwd)" | |
| MSYSTEM=UCRT64 /c/msys64/usr/bin/bash.exe -l -c " | |
| cd \"${CURRENT_DIR}\" && | |
| ./platforms/${{ matrix.platform }}/${{ matrix.arch }}/external.sh && | |
| cmake \ | |
| -DCMAKE_BUILD_TYPE=Release \ | |
| -DPLATFORM=${{ matrix.platform }} \ | |
| -DARCH=${{ matrix.arch }} \ | |
| -B build && | |
| cmake --build build -- -j\$(nproc) | |
| " | |
| # | |
| # build (macos) | |
| # | |
| - if: (matrix.platform == 'macos') | |
| name: Build (macos) | |
| run: | | |
| ./platforms/${{ matrix.platform }}/${{ matrix.arch }}/external.sh | |
| cmake \ | |
| -DCMAKE_BUILD_TYPE=Release \ | |
| -DPLATFORM=${{ matrix.platform }} \ | |
| -DARCH=${{ matrix.arch }} \ | |
| -B build | |
| cmake --build build -- -j$(sysctl -n hw.ncpu) | |
| # | |
| # build (linux) | |
| # | |
| - if: (matrix.platform == 'linux') | |
| name: Build (linux) | |
| run: | | |
| ./platforms/${{ matrix.platform }}/${{ matrix.arch }}/external.sh | |
| cmake \ | |
| -DCMAKE_BUILD_TYPE=Release \ | |
| -DPLATFORM=${{ matrix.platform }} \ | |
| -DARCH=${{ matrix.arch }} \ | |
| -B build | |
| cmake --build build -- -j$(nproc) | |
| # | |
| # build (ios/tvos) | |
| # | |
| - if: (matrix.platform == 'ios' || matrix.platform == 'ios-simulator' || matrix.platform == 'tvos') | |
| name: Build (ios/tvos) | |
| run: | | |
| ./platforms/${{ matrix.platform }}/${{ matrix.arch }}/external.sh | |
| cmake \ | |
| -DCMAKE_BUILD_TYPE=Release \ | |
| -DPLATFORM=${{ matrix.platform }} \ | |
| -DARCH=${{ matrix.arch }} \ | |
| -B build | |
| cmake --build build -- -j$(sysctl -n hw.ncpu) | |
| # | |
| # build (android) | |
| # | |
| - if: (matrix.platform == 'android') | |
| name: Build (android) | |
| run: | | |
| ./platforms/${{ matrix.platform }}/${{ matrix.arch }}/external.sh | |
| cmake \ | |
| -DCMAKE_BUILD_TYPE=Release \ | |
| -DPLATFORM=${{ matrix.platform }} \ | |
| -DARCH=${{ matrix.arch }} \ | |
| -B build | |
| cmake --build build -- -j$(nproc) | |
| # | |
| # test | |
| # | |
| - if: (!(matrix.arch == 'arm64' || matrix.arch == 'arm64-v8a' || matrix.arch == 'aarch64' || matrix.platform == 'win' || matrix.platform == 'win-mingw')) | |
| name: dmdutil_test | |
| run: build/dmdutil_test | |
| # | |
| # prepare artifacts | |
| # | |
| - if: (matrix.platform == 'win') | |
| name: Prepare artifacts (win) | |
| run: | | |
| mkdir tmp | |
| if [[ "${{ matrix.arch }}" == "x64" ]]; then | |
| LIBS=(dmdutil64 cargs64 zedmd64 serum64 libusb64-1.0 libserialport64 sockpp64 pupdmd64 vni64) | |
| else | |
| LIBS=(dmdutil cargs zedmd serum libusb-1.0 libserialport sockpp pupdmd vni) | |
| fi | |
| for LIB in "${LIBS[@]}"; do | |
| cp "build/Release/${LIB}.lib" tmp | |
| cp "build/Release/${LIB}.dll" tmp | |
| done | |
| cp build/Release/dmdserver.exe tmp | |
| cp build/Release/dmdserver_test.exe tmp | |
| cp build/Release/dmdutil_static.lib tmp | |
| cp build/Release/dmdutil_test_s.exe tmp | |
| cp build/Release/dmdutil_test.exe tmp | |
| cp build/Release/dmdutil-generate-scenes.exe tmp | |
| cp build/Release/dmdutil-play-dump.exe tmp | |
| cp -r test tmp/ | |
| cd tmp && 7z a -r ../libdmdutil-${{ needs.version.outputs.tag }}-${{ matrix.platform }}-${{ matrix.arch }}.zip * | |
| - if: (matrix.platform == 'win-mingw') | |
| name: Prepare artifacts (win-mingw) | |
| run: | | |
| mkdir tmp | |
| cp build/*.dll tmp/ | |
| cp build/*.dll.a tmp/ | |
| cp build/dmdutil_static.a tmp/ | |
| cp build/*.exe tmp/ | |
| cp -r test tmp/ | |
| cd tmp && 7z a -r ../libdmdutil-${{ needs.version.outputs.tag }}-${{ matrix.platform }}-${{ matrix.arch }}.zip * | |
| - if: (matrix.platform == 'macos') | |
| name: Prepare artifacts (macos) | |
| run: | | |
| mkdir tmp | |
| cp build/libdmdutil.a tmp | |
| cp -a build/*.dylib tmp | |
| cp build/dmdserver tmp | |
| cp build/dmdserver_test tmp | |
| cp build/dmdutil_test_s tmp | |
| cp build/dmdutil_test tmp | |
| cp build/dmdutil-generate-scenes tmp | |
| cp build/dmdutil-play-dump tmp | |
| cp -r test tmp/ | |
| cd tmp && tar -czvf ../libdmdutil-${{ needs.version.outputs.tag }}-${{ matrix.platform }}-${{ matrix.arch }}.tar.gz * | |
| - if: (matrix.platform == 'linux') | |
| name: Prepare artifacts (linux) | |
| run: | | |
| mkdir tmp | |
| cp build/libdmdutil.a tmp | |
| cp -a build/*.so tmp | |
| cp -a build/*.so.* tmp | |
| cp build/dmdserver tmp | |
| cp build/dmdserver_test tmp | |
| cp build/dmdutil_test_s tmp | |
| cp build/dmdutil_test tmp | |
| cp build/dmdutil-generate-scenes tmp | |
| cp build/dmdutil-play-dump tmp | |
| cp -r test tmp/ | |
| cd tmp && tar -czvf ../libdmdutil-${{ needs.version.outputs.tag }}-${{ matrix.platform }}-${{ matrix.arch }}.tar.gz * | |
| - if: (matrix.platform == 'ios' || matrix.platform == 'ios-simulator' || matrix.platform == 'tvos') | |
| name: Prepare artifacts (ios/tvos) | |
| run: | | |
| mkdir tmp | |
| cp build/libdmdutil.a tmp | |
| cp -a build/*.dylib tmp | |
| cd tmp && tar -czvf ../libdmdutil-${{ needs.version.outputs.tag }}-${{ matrix.platform }}-${{ matrix.arch }}.tar.gz * | |
| - if: (matrix.platform == 'android') | |
| name: Prepare artifacts (android) | |
| run: | | |
| mkdir tmp | |
| cp build/libdmdutil.a tmp | |
| cp build/libdmdutil.so tmp | |
| cd tmp && tar -czvf ../libdmdutil-${{ needs.version.outputs.tag }}-${{ matrix.platform }}-${{ matrix.arch }}.tar.gz * | |
| # | |
| # upload artifacts | |
| # | |
| - if: (matrix.platform == 'win' || matrix.platform == 'win-mingw') | |
| uses: actions/upload-artifact@v7 | |
| with: | |
| name: libdmdutil-${{ needs.version.outputs.tag }}-${{ matrix.platform }}-${{ matrix.arch }}.zip | |
| path: libdmdutil-${{ needs.version.outputs.tag }}-${{ matrix.platform }}-${{ matrix.arch }}.zip | |
| archive: false | |
| - if: (matrix.platform != 'win' && matrix.platform != 'win-mingw') | |
| uses: actions/upload-artifact@v7 | |
| with: | |
| name: libdmdutil-${{ needs.version.outputs.tag }}-${{ matrix.platform }}-${{ matrix.arch }}.tar.gz | |
| path: libdmdutil-${{ needs.version.outputs.tag }}-${{ matrix.platform }}-${{ matrix.arch }}.tar.gz | |
| archive: false | |
| post-build: | |
| runs-on: macos-15 | |
| needs: [ version, build ] | |
| name: Build libdmdutil-macos | |
| steps: | |
| - uses: actions/download-artifact@v8 | |
| with: | |
| name: libdmdutil-${{ needs.version.outputs.tag }}-macos-x64.tar.gz | |
| skip-decompress: true | |
| - uses: actions/download-artifact@v8 | |
| with: | |
| name: libdmdutil-${{ needs.version.outputs.tag }}-macos-arm64.tar.gz | |
| skip-decompress: true | |
| - name: Combine macos architectures | |
| run: | | |
| mkdir macos-x64 macos-arm64 | |
| tar -xzvf libdmdutil-${{ needs.version.outputs.tag }}-macos-x64.tar.gz -C macos-x64 | |
| tar -xzvf libdmdutil-${{ needs.version.outputs.tag }}-macos-arm64.tar.gz -C macos-arm64 | |
| mkdir tmp | |
| find macos-arm64 -name "*.dylib" | while read -r file; do | |
| if [ -L "$file" ]; then | |
| cp -a "$file" "tmp/" | |
| elif [ -f "$file" ]; then | |
| filename=$(basename "$file") | |
| lipo -create -output "tmp/$filename" \ | |
| "macos-arm64/$filename" \ | |
| "macos-x64/$filename" | |
| fi | |
| done | |
| for filename in dmdserver dmdserver_test dmdutil_test_s dmdutil_test dmdutil-generate-scenes dmdutil-play-dump; do | |
| lipo -create -output "tmp/$filename" \ | |
| "macos-arm64/$filename" \ | |
| "macos-x64/$filename" | |
| done | |
| cp -r macos-arm64/test tmp | |
| cd tmp && tar -czvf ../libdmdutil-${{ needs.version.outputs.tag }}-macos.tar.gz * && cd .. | |
| - name: Upload artifacts | |
| uses: actions/upload-artifact@v7 | |
| with: | |
| name: libdmdutil-${{ needs.version.outputs.tag }}-macos.tar.gz | |
| path: libdmdutil-${{ needs.version.outputs.tag }}-macos.tar.gz | |
| archive: false | |
| - if: startsWith(github.ref, 'refs/tags/') | |
| uses: actions/download-artifact@v8 | |
| with: | |
| path: release | |
| skip-decompress: true | |
| - name: Release | |
| uses: softprops/action-gh-release@v2 | |
| if: startsWith(github.ref, 'refs/tags/') | |
| with: | |
| draft: true | |
| files: release/**/* |