From 7990bcbc88fca7cd60e1d83101227763b6d5b9fb Mon Sep 17 00:00:00 2001 From: Vin Xue Date: Mon, 11 Nov 2024 08:59:21 +0800 Subject: [PATCH] Add tools c build support --- .github/workflows/msbuild.yml | 15 +++++++++++++-- 1 file changed, 13 insertions(+), 2 deletions(-) diff --git a/.github/workflows/msbuild.yml b/.github/workflows/msbuild.yml index 4c0fc26..82f8959 100644 --- a/.github/workflows/msbuild.yml +++ b/.github/workflows/msbuild.yml @@ -23,6 +23,7 @@ env: SOLUTION_FILE_PATH_IMGCONVERTER: ImgConverter SOLUTION_FILE_PATH_STOPWATCH: StopWatch SOLUTION_FILE_PATH_IDCARD: IDCard + TOOLS_C_PATH: Tools/C # Configuration type to build. # You can convert this to a build matrix if you need coverage of multiple configuration types. @@ -39,8 +40,16 @@ jobs: steps: - uses: actions/checkout@v4 - - name: Add MSBuild to PATH - uses: microsoft/setup-msbuild@v2 + - name: Set up and Add Visual Studio to PATH + # Use vswhere to find the latest version of Visual Studio + # Add Visual Studio to PATH + run: | + set VSWHERE="%ProgramFiles(x86)%\Microsoft Visual Studio\Installer\vswhere.exe" + for /f "usebackq tokens=*" %%i in (`%VSWHERE% -latest -products * -requires Microsoft.VisualStudio.Component.VC.Tools.x86.x64 -property installationPath`) do (set InstallDir=%%i) + echo VS Installation Path: %InstallDir% + + call "%InstallDir%\VC\Auxiliary\Build\vcvarsall.bat" x64 + shell: cmd - name: Build working-directory: ${{env.GITHUB_WORKSPACE}} @@ -54,6 +63,7 @@ jobs: msbuild /m /p:Configuration=${{env.BUILD_CONFIGURATION}} ${{env.SOLUTION_FILE_PATH_IMGCONVERTER}} msbuild /m /p:Configuration=${{env.BUILD_CONFIGURATION}} ${{env.SOLUTION_FILE_PATH_STOPWATCH}} msbuild /m /p:Configuration=${{env.BUILD_CONFIGURATION}} ${{env.SOLUTION_FILE_PATH_IDCARD}} + cl /EHsc ${{env.TOOLS_C_PATH}}/Crc.c - name: Upload Artifact uses: actions/upload-artifact@v4 @@ -66,3 +76,4 @@ jobs: ${{env.SOLUTION_FILE_PATH_TIMER}}/Release/*.exe ${{env.SOLUTION_FILE_PATH_IMGCONVERTER}}/Release/*.exe ${{env.SOLUTION_FILE_PATH_STOPWATCH}}/Release/*.exe + ${{env.TOOLS_C_PATH}}/*.exe