Browse Source

Speed up CI build by avoiding vcvarsalls.bat (#1484)

pull/1485/head
josetr 5 years ago committed by GitHub
parent
commit
db249e05f0
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
  1. 6
      .github/workflows/main.yml
  2. 34
      build/scripts/LLVM.lua

6
.github/workflows/main.yml

@ -51,18 +51,18 @@ jobs: @@ -51,18 +51,18 @@ jobs:
PLATFORM: ${{ matrix.config.platform }}
steps:
- name: Environment
run: |
echo "C:\\Program Files (x86)\\Microsoft Visual Studio\\${{matrix.config.vs}}\\Enterprise\\MSBuild\\Current\\Bin" | Out-File -FilePath $env:GITHUB_PATH -Encoding utf8 -Append
- uses: actions/checkout@v2
- name: Setup
shell: cmd
run: |
call "C:\Program Files (x86)\Microsoft Visual Studio\%VS_VERSION%\Enterprise\VC\Auxiliary\Build\vcvarsall.bat" %PLATFORM%
build\premake5.exe --file=build\scripts\LLVM.lua download_llvm --arch=%PLATFORM%
- name: Build
shell: cmd
run: |
call "C:\Program Files (x86)\Microsoft Visual Studio\%VS_VERSION%\Enterprise\VC\Auxiliary\Build\vcvarsall.bat" %PLATFORM%
build\premake5.exe --file=build\premake5.lua vs%VS_VERSION% --arch=%PLATFORM%
msbuild build\vs%VS_VERSION%\CppSharp.sln /p:Configuration=Release /verbosity:minimal

34
build/scripts/LLVM.lua

@ -56,16 +56,34 @@ function get_vs_version() @@ -56,16 +56,34 @@ function get_vs_version()
local function map_msvc_to_vs_version(major, minor)
if major == "19" and minor >= "20" then return "vs2019"
elseif major == "19" and minor >= "10" then return "vs2017"
elseif major == "19" then return "vs2015"
elseif major == "18" then return "vs2013"
elseif major == "17" then return "vs2012"
else error("Unknown MSVC compiler version, run in VS command prompt.") end
end
end
local function map_msbuild_to_vs_version(major, minor)
if major == "16" then return "vs2019"
elseif major == "15" then return "vs2017"
end
end
local out = outputof("cl")
local major, minor = string.match(out, '(%d+).(%d+).%d+.?%d*%s+')
local version = map_msvc_to_vs_version(major, minor)
if version ~= nil then
return version
end
out = outputof("msbuild -version -nologo")
major, minor = string.match(out, '(%d+).(%d+).')
version = map_msbuild_to_vs_version(major, minor)
if version ~= nil then
return version
end
local out = outputof("cl")
local major, minor = string.match(out, '(%d+).(%d+).%d+.?%d*%s+')
return map_msvc_to_vs_version(major, minor)
if major ~= nil then
error("Unsupported MSVC compiler version.")
else
error("Unknown MSVC compiler version, run in VS command prompt.")
end
end
function get_toolset_configuration_name(arch)

Loading…
Cancel
Save