Skip to content

feat: Build shared library on Windows #1072

feat: Build shared library on Windows

feat: Build shared library on Windows #1072

name: msvc
on:
push:
branches:
- 'main'
- 'ci/cache'
paths-ignore:
- 'docs/**'
- '**/*.md'
- 'LICENSE'
workflow_dispatch:
pull_request:
jobs:
build:
name: ci-windows-msvc-19-${{ matrix.type }}
runs-on: windows-latest
strategy:
matrix:
type: [static, shared]
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Configure Visual Studio Environment
uses: ilammy/[email protected]
- name: Install ccache
uses: hendrikmuhs/[email protected]
- name: Install Ninja
uses: seanmiddleditch/gha-setup-ninja@v4
- name: Cache Conan packages
id: cache-conan
uses: actions/[email protected]
env:
cache-name: cache-conan-packages
with:
path: ~/.conan2
key: ${{ runner.os }}-build-${{ env.cache-name }}-${{ hashFiles('conanfile.txt') }}
restore-keys: |
${{ runner.os }}-build-${{ env.cache-name }}-
${{ runner.os }}-build-
${{ runner.os }}-
- name: Configure python
uses: actions/setup-python@v5
with:
python-version: '3.10'
cache: 'pip'
- name: Install Python dependencies
run: python -m pip install -r .github/requirements.txt
- name: Configure Conan profile
run: conan profile detect --force --name msvc-19
- name: Install Conan dependencies
run: |
conan install conanfile.txt -r conancenter -pr:b msvc-19 -pr:h msvc-19 -s compiler.cppstd=20 -s build_type=Debug -c tools.cmake.cmaketoolchain:generator=Ninja --build=missing
- name: Configure CMake
run: |
cmake -S . --preset=windows-msvc-debug-${{ matrix.type }} -G Ninja -DCMAKE_TOOLCHAIN_FILE=${{ github.workspace }}\build\Debug\generators\conan_toolchain.cmake -DCMAKE_CXX_COMPILER_LAUNCHER=ccache -DCMAKE_CXX_COMPILER=cl.exe -DBUILD_TESTING:BOOL=ON -DUSE_STD_FORMAT:BOOL=ON -DUSE_SYSTEM_DEPENDENCIES:BOOL=ON
- name: Build
run: cmake --build --preset=windows-msvc-debug-${{ matrix.type }}
- name: Test
run: ctest --preset=windows-msvc-debug-${{ matrix.type }}
- name: Install
run: cmake --build --preset=windows-msvc-debug-${{ matrix.type }} --target install