From ad287bbe59b0b01cc56b90076b02a8cd9baa712e Mon Sep 17 00:00:00 2001 From: crupest Date: Tue, 10 Aug 2021 01:16:37 +0800 Subject: .. --- .github/workflows/ci.yml | 12 +++++++----- tools/Use-VC.ps1 | 26 ++++++++++++++++++++++++++ 2 files changed, 33 insertions(+), 5 deletions(-) create mode 100644 tools/Use-VC.ps1 diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 33ca8010..0ceea278 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -21,10 +21,6 @@ jobs: build: name: Build runs-on: windows-latest - strategy: - matrix: - buildConfiguration: [Debug, Release] - architecture: [x86, x64] steps: - uses: actions/checkout@v2 @@ -36,4 +32,10 @@ jobs: key: vcpkg-${{ runner.os }} - name: Run build script - run: python tools\win_build.py -a ${{ matrix.architecture }} -c ${{ matrix.buildConfiguration }} + shell: powershell + run: | + & ./tools/Use-VC.ps1 + Use-VC + mkdir build && cd build + cmake .. -G Ninja -DCMAKE_BUILD_TYPE:STRING=Debug + ninja all diff --git a/tools/Use-VC.ps1 b/tools/Use-VC.ps1 new file mode 100644 index 00000000..f1274b6f --- /dev/null +++ b/tools/Use-VC.ps1 @@ -0,0 +1,26 @@ +function Use-VC { + param( + [Parameter()] + [ValidateSet('x64', 'x86')] + $Arch = 'x64' + ) + + if ($Arch -eq 'x86') { + $p = 'x86'; + } + else { + $p = 'amd64' + } + + $vs=$(vswhere.exe -format value -property installationPath) + + cmd /c "$vs\VC\Auxiliary\Build\vcvars64.bat $p & set" | + ForEach-Object { + if ($_ -match '=') { + $v = $_ -split '=' + Set-Item -Force -Path "ENV:\$($v[0])" -Value "$($v[1])" + } + } + Pop-Location + Write-Host "Visual Studio 2019 Command Prompt variables set." -ForegroundColor Yellow +} -- cgit v1.2.3