CI: start building on Windows
The differences compared to a POSIX build are too big even in the build
script, mainly because CMake considers the Visual Studio build file
generator a multiconfig one, and that means that all invocations of
cmake/ctest have to have a specification of the current config. There's
no way around that in CMake (and boy did I try!), so let's give up and
do everything from scratch.
diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml
index c30d6c3..2df9f8e 100644
--- a/.github/workflows/ci.yml
+++ b/.github/workflows/ci.yml
@@ -10,7 +10,7 @@
- devel
jobs:
- build:
+ build-unix:
name: ${{ matrix.config.name }}
runs-on: ${{ matrix.config.os }}
strategy:
@@ -149,3 +149,56 @@
shell: bash
working-directory: ${{ github.workspace }}/build
run: ctest --output-on-failure
+
+ build-windows:
+ name: ${{ matrix.name }}
+ runs-on: ${{ matrix.os }}
+ strategy:
+ fail-fast: false
+ matrix:
+ include:
+ - name: "Windows 2022 MSVC 16"
+ os: windows-2022
+ triplet: x64-windows
+ build_type: Release
+ generators: "Visual Studio 17 2022"
+
+ steps:
+ - name: Unix line endings in git
+ run: |
+ git config --global core.autocrlf input
+ git config --global core.eol lf
+
+ - uses: actions/checkout@v2
+
+ - name: Get number of CPU cores
+ id: cpu-cores
+ uses: SimenB/github-actions-cpu-cores@5e7112c2e8c5b63b649a678bc2fb5920d0c8202e
+
+ - name: Install Windows dependencies
+ run: vcpkg install --triplet=${{ matrix.triplet }} pcre2 pthreads dirent dlfcn-win32 cmocka getopt
+
+ - name: Configure
+ shell: bash
+ run: |
+ cmake \
+ -S '${{ github.workspace }}/' \
+ -B '${{ github.workspace }}/'../build \
+ -G '${{ matrix.generators }}' \
+ -DCMAKE_BUILD_TYPE=${{ matrix.build_type }} \
+ -DVCPKG_TARGET_TRIPLET=${{ matrix.triplet }} \
+ -DCMAKE_TOOLCHAIN_FILE=${VCPKG_INSTALLATION_ROOT//\\//}/scripts/buildsystems/vcpkg.cmake \
+ -DENABLE_TESTS=ON \
+ '-DCMAKE_INSTALL_PREFIX:PATH=${{ github.workspace }}'/../target
+
+ - name: Build
+ working-directory: '${{ github.workspace }}/../build'
+ run: cmake --build . -j${{ steps.cpu-cores.outputs.count }} --config ${{ matrix.build_type }}
+
+ - name: Test
+ working-directory: '${{ github.workspace }}/../build'
+ run: ctest --output-on-failure -j${{ steps.cpu-cores.outputs.count }} --build-config ${{ matrix.build_type }}
+
+ - name: Install
+ working-directory: '${{ github.workspace }}/../build'
+ run: cmake --install . --strip