mirror of
https://github.com/libuv/libuv
synced 2025-03-28 21:13:16 +00:00
build,win: add mingw-w64 CI configuration (#3885)
Co-authored-by: Nicolas Noble <pixel@nobis-crew.org>
This commit is contained in:
parent
a4ba1bd73e
commit
c70cc5832b
58
.github/workflows/CI-win.yml
vendored
58
.github/workflows/CI-win.yml
vendored
@ -62,3 +62,61 @@ jobs:
|
||||
shell: cmd
|
||||
run:
|
||||
build\\RelWithDebInfo\\uv_run_tests_a.exe
|
||||
|
||||
build-mingw:
|
||||
runs-on: ubuntu-latest
|
||||
name: build-mingw-${{ matrix.config.arch }}
|
||||
strategy:
|
||||
fail-fast: false
|
||||
matrix:
|
||||
config:
|
||||
- {arch: i686, server: 2022, libgcc: dw2 }
|
||||
- {arch: x86_64, server: 2022, libgcc: seh }
|
||||
steps:
|
||||
- uses: actions/checkout@v3
|
||||
- name: Install mingw32 environment
|
||||
run: |
|
||||
sudo apt update
|
||||
sudo apt install mingw-w64 ninja-build -y
|
||||
- name: Build
|
||||
run: |
|
||||
cmake -S . -B build -G Ninja -DHOST_ARCH=${{ matrix.config.arch }} -DBUILD_TESTING=ON -DCMAKE_TOOLCHAIN_FILE=cmake-toolchains/cross-mingw32.cmake
|
||||
cmake --build build
|
||||
cmake --install build --prefix "`pwd`/build/usr"
|
||||
mkdir -p build/usr/test build/usr/bin
|
||||
cp -av test/fixtures build/usr/test
|
||||
cp -av build/uv_run_tests_a.exe build/uv_run_tests.exe \
|
||||
`${{ matrix.config.arch }}-w64-mingw32-gcc -print-file-name=libgcc_s_${{ matrix.config.libgcc }}-1.dll` \
|
||||
`${{ matrix.config.arch }}-w64-mingw32-gcc -print-file-name=libwinpthread-1.dll` \
|
||||
`${{ matrix.config.arch }}-w64-mingw32-gcc -print-file-name=libatomic-1.dll` \
|
||||
build/usr/bin
|
||||
- name: Upload build artifacts
|
||||
uses: actions/upload-artifact@v3
|
||||
with:
|
||||
name: mingw-${{ matrix.config.arch }}
|
||||
path: build/usr/**/*
|
||||
retention-days: 2
|
||||
|
||||
test-mingw:
|
||||
runs-on: windows-${{ matrix.config.server }}
|
||||
name: test-mingw-${{ matrix.config.arch }}
|
||||
needs: build-mingw
|
||||
strategy:
|
||||
fail-fast: false
|
||||
matrix:
|
||||
config:
|
||||
- {arch: i686, server: 2022}
|
||||
- {arch: x86_64, server: 2022}
|
||||
steps:
|
||||
- name: Download build artifacts
|
||||
uses: actions/download-artifact@v2
|
||||
with:
|
||||
name: mingw-${{ matrix.config.arch }}
|
||||
- name: Test
|
||||
shell: cmd
|
||||
run: |
|
||||
bin\uv_run_tests_a.exe
|
||||
- name: Test
|
||||
shell: cmd
|
||||
run: |
|
||||
bin\uv_run_tests.exe
|
||||
|
17
cmake-toolchains/cross-mingw32.cmake
Normal file
17
cmake-toolchains/cross-mingw32.cmake
Normal file
@ -0,0 +1,17 @@
|
||||
if(NOT HOST_ARCH)
|
||||
message(SEND_ERROR "-DHOST_ARCH required to be specified")
|
||||
endif()
|
||||
|
||||
list(APPEND CMAKE_TRY_COMPILE_PLATFORM_VARIABLES
|
||||
HOST_ARCH
|
||||
)
|
||||
|
||||
SET(CMAKE_SYSTEM_NAME Windows)
|
||||
set(COMPILER_PREFIX "${HOST_ARCH}-w64-mingw32")
|
||||
find_program(CMAKE_RC_COMPILER NAMES ${COMPILER_PREFIX}-windres)
|
||||
find_program(CMAKE_C_COMPILER NAMES ${COMPILER_PREFIX}-gcc)
|
||||
find_program(CMAKE_CXX_COMPILER NAMES ${COMPILER_PREFIX}-g++)
|
||||
|
||||
set(CMAKE_FIND_ROOT_PATH_MODE_PROGRAM NEVER)
|
||||
set(CMAKE_FIND_ROOT_PATH_MODE_LIBRARY ONLY)
|
||||
set(CMAKE_FIND_ROOT_PATH_MODE_INCLUDE ONLY)
|
Loading…
x
Reference in New Issue
Block a user