Skip to content

Build windows libs as static #9

Build windows libs as static

Build windows libs as static #9

name: Build-Static-Windows
on:
push:
branches:
- master
pull_request:
jobs:
build:
runs-on: windows-2022
strategy:
fail-fast: false
steps:
- uses: actions/checkout@v3
with:
submodules: true
- name: Prepare build dir
run: |
New-Item -ItemType directory -Path "c:\" -Name "build"
New-Item -ItemType Junction -Path "out" -Target "c:\build"
Move-Item -Path vcpkg -Destination c:\build
New-Item -ItemType Junction -Path "vcpkg" -Target "c:\build\vcpkg"
- name: Cache external tools
uses: actions/cache@v2
with:
path: out/build/ninja_release_vcpkg/tools
key: ${{ runner.os }}-externalTools-v1-${{ hashFiles('cmake/system/win32.cmake') }}
- name: disable debug build for vcpkg
run: echo 'set(VCPKG_BUILD_TYPE "release")' >> vcpkg/triplets/x64-windows-static.cmake
- name: Setup ccache
uses: Chocobo1/setup-ccache-action@v1
with:
windows_compile_environment: msvc
- name: Run vcpkg
uses: lukka/run-vcpkg@v11.1
with:
vcpkgJsonGlob: vcpkg.json
- name: Add msbuild to PATH
uses: ilammy/msvc-dev-cmd@v1.12.1
- name: Build
run: |
cmake --preset "ninja_release_vcpkg_static" -DBUILD_SHARED_LIBS=TRUE -DCMAKE_CXX_COMPILER_LAUNCHER:FILEPATH="${{ env.ccache_symlinks_path }}" -DCMAKE_C_COMPILER_LAUNCHER:FILEPATH="${{ env.ccache_symlinks_path }}" -DVCPKG_TARGET_TRIPLET=x64-windows-static -DVCPKG_HOST_TRIPLET=x64-windows-static -DBUILD_SHARED_LIBS=FALSE -DCMAKE_MSVC_RUNTIME_LIBRARY=MultiThreaded
cmake --build --preset "ninja_static_release"
- name: Make package
run: cmake --build --target package --preset 'ninja_static_release'
- name: Upload artifact
uses: actions/upload-artifact@v3
with:
name: Installer
path: out/build/ninja_release_vcpkg/PhotoBroom-*-win64.exe
- name: Verify list of files in installer
run: |
7z l out/build/ninja_release_vcpkg/PhotoBroom-*-win64.exe | python .github/parse7z-l.py | python .github/compare.py .github/expected_file_list_static