]> git.ipfire.org Git - thirdparty/curl.git/commitdiff
GHA/windows: add Linux -> mingw-w64 cross-build (cmake, autotools)
authorViktor Szakats <commit@vsz.me>
Fri, 23 Aug 2024 10:58:51 +0000 (12:58 +0200)
committerViktor Szakats <commit@vsz.me>
Fri, 23 Aug 2024 16:42:56 +0000 (18:42 +0200)
Also:
- add a line to CMake log output showing the host and target OS and CPU
  when doing cross-builds.
- reduce excessive timeout for `curl -V` steps.

Closes #14661

.github/workflows/windows.yml
CMakeLists.txt

index f7d205ec29de711f88229ab445330feed696c27e..77e058d91871689f95954b15963a0ba7df85ac18 100644 (file)
@@ -118,7 +118,7 @@ jobs:
 
       - name: 'curl version'
         if: ${{ matrix.build == 'autotools' }}
-        timeout-minutes: 11
+        timeout-minutes: 1
         run: |
           find . -name '*.exe' -o -name '*.dll'
           bld/src/curl.exe --disable --version
@@ -341,6 +341,67 @@ jobs:
           PATH="$PWD/bld/lib:$PATH"
           cmake --build bld --config '${{ matrix.type }}' --target test-ci
 
+  linux-cross-mingw-w64:
+    name: "linux-mingw, ${{ matrix.build == 'cmake' && 'CM' || 'AM' }} ${{ matrix.compiler }}"
+    runs-on: ubuntu-latest
+    timeout-minutes: 15
+    strategy:
+      fail-fast: false
+      matrix:
+        build: [autotools, cmake]
+        compiler: [gcc]
+    env:
+      TRIPLET: 'x86_64-w64-mingw32'
+    steps:
+      - name: 'install packages'
+        run: sudo apt-get --quiet 2 --option Dpkg::Use-Pty=0 install mingw-w64
+
+      - uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 # v4
+
+      - name: 'autotools autoreconf'
+        if: ${{ matrix.build == 'autotools' }}
+        run: autoreconf -fi
+
+      - name: 'autotools configure'
+        if: ${{ matrix.build == 'autotools' }}
+        run: |
+          mkdir bld && cd bld && ../configure --enable-warnings --enable-werror \
+            --host=${TRIPLET} \
+            --with-schannel \
+            --without-libpsl \
+            --disable-dependency-tracking
+
+      - name: 'autotools configure log'
+        if: ${{ matrix.build == 'autotools' && !cancelled() }}
+        run: cat bld/config.log 2>/dev/null || true
+
+      - name: 'autotools build'
+        if: ${{ matrix.build == 'autotools' }}
+        run: |
+          make -C bld -j5
+          make -C bld -j5 examples
+
+      - name: 'cmake configure'
+        if: ${{ matrix.build == 'cmake' }}
+        run: |
+          cmake -B bld \
+            -DCMAKE_SYSTEM_NAME=Windows \
+            -DCMAKE_C_COMPILER_TARGET=${TRIPLET} \
+            -DCMAKE_C_COMPILER=${TRIPLET}-gcc \
+            -DCMAKE_UNITY_BUILD=ON \
+            -DCURL_WERROR=ON \
+            -DBUILD_EXAMPLES=ON \
+            -DCURL_USE_SCHANNEL=ON \
+            -DCURL_USE_LIBPSL=OFF
+
+      - name: 'cmake configure log'
+        if: ${{ matrix.build == 'cmake' && !cancelled() }}
+        run: cat bld/CMakeFiles/CMake*.yaml 2>/dev/null || true
+
+      - name: 'cmake build'
+        if: ${{ matrix.build == 'cmake' }}
+        run: cmake --build bld --parallel 5
+
   msvc:
     name: 'msvc, CM ${{ matrix.arch }}-${{ matrix.plat }} ${{ matrix.name }}'
     runs-on: windows-latest
@@ -465,7 +526,7 @@ jobs:
         run: cmake --build bld --config '${{ matrix.type }}' --parallel 5
 
       - name: 'curl version'
-        timeout-minutes: 5
+        timeout-minutes: 1
         run: |
           find . -name '*.exe' -o -name '*.dll' | grep -v '/examples/'
           if [ '${{ matrix.plat }}' != 'uwp' ]; then
index dfe2974d9a8292ad78618715a8186a331007a952..42944e42d7cbd63ec301e140d87a000ea52ffb10 100644 (file)
@@ -85,6 +85,10 @@ endif()
 message(STATUS "CMake platform flags:${_flags}")
 set(_flags)
 
+if(CMAKE_CROSSCOMPILING)
+  message(STATUS "Cross-compiling: ${CMAKE_HOST_SYSTEM_NAME}/${CMAKE_HOST_SYSTEM_PROCESSOR} -> ${CMAKE_SYSTEM_NAME}/${CMAKE_SYSTEM_PROCESSOR}")
+endif()
+
 function(curl_dumpvars)  # Dump all defined variables with their values
   message("::group::CMake Variable Dump")
   get_cmake_property(_vars VARIABLES)