Skip to content

Update msbuild.yml

Update msbuild.yml #11

Workflow file for this run

name: CMake + vcpkg Build
on:
push:
branches: [ "main" ]
pull_request:
branches: [ "main" ]
env:
SOLUTION_FILE_PATH: .
BUILD_CONFIGURATION: Release
VCPKG_ROOT: ${{ github.workspace }}/vcpkg
permissions:
contents: read
jobs:
build:
runs-on: windows-latest
steps:
- uses: actions/checkout@v4
# Step 1: Set up vcpkg manually
- name: Install vcpkg
run: |
git clone https://github.com/microsoft/vcpkg.git ${VCPKG_ROOT}
${VCPKG_ROOT}\bootstrap-vcpkg.bat # 使用 .bat 文件初始化 vcpkg
# Step 2: Install dependencies with vcpkg
- name: Install dependencies with vcpkg
run: |
${VCPKG_ROOT}\vcpkg install webview2 fmt simpleini # 安装 WebView2, fmt 和 simpleini
${VCPKG_ROOT}\vcpkg integrate install
# Step 3: Set up MSBuild and Visual Studio 16.9
- name: Set up MSBuild
uses: microsoft/setup-msbuild@v2
with:
vs-version: '16.9' # 使用 Visual Studio 16.9 版本
# Step 4: Configure CMake
- name: Configure CMake
run: |
mkdir build
cd build
cmake -DCMAKE_TOOLCHAIN_FILE=${{ env.VCPKG_ROOT }}/scripts/buildsystems/vcpkg.cmake -G "Visual Studio 16 2019" ..
# Step 5: Build project with MSBuild
- name: Build project
run: |
cd build
msbuild /m /p:Configuration=${{ env.BUILD_CONFIGURATION }} ${env.SOLUTION_FILE_PATH}