Support Visual Studio 2017, 2019 and LLVM Clang full build CI

This commit is contained in:
Max Golovanov 2020-06-17 19:10:45 -07:00
Родитель 20ec84fb12
Коммит fc7ed65220
16 изменённых файлов: 297 добавлений и 89 удалений

11
.github/workflows/build-windows-clang.yaml поставляемый
Просмотреть файл

@ -11,18 +11,21 @@ on:
jobs:
build:
runs-on: windows-latest
name: Build for Windows (clang)
runs-on: windows-2016
name: Build
steps:
- name: Checkout
uses: actions/checkout@v2
- name: Setup Tools
shell: cmd
run: tools\install-vs-addons.cmd
run: tools\setup-buildtools.cmd
- name: Build
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
GIT_PULL_TOKEN: ${{ secrets.GIT_PULL_TOKEN }}
shell: cmd
run: build-all.bat
run: build-cmake-clang-vs2017.cmd

9
.github/workflows/build-windows-vs2017.yaml поставляемый
Просмотреть файл

@ -11,15 +11,18 @@ on:
jobs:
build:
runs-on: windows-latest
name: Build for Windows (vs2017)
runs-on: windows-2016
name: Build
steps:
- name: Checkout
uses: actions/checkout@v2
- name: Setup Tools
shell: cmd
run: tools\install-vs-addons.cmd
run: tools\setup-buildtools.cmd
- name: Build
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

31
.github/workflows/build-windows-vs2019.yaml поставляемый Normal file
Просмотреть файл

@ -0,0 +1,31 @@
name: C/C++ CI on Windows (vs2019)
on:
push:
branches:
- master
pull_request:
branches:
- master
jobs:
build:
runs-on: windows-2019
name: Build
steps:
- name: Checkout
uses: actions/checkout@v2
- name: Setup Tools
shell: cmd
run: tools\setup-buildtools.cmd
- name: Build
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
GIT_PULL_TOKEN: ${{ secrets.GIT_PULL_TOKEN }}
shell: cmd
run: build-all.bat

Просмотреть файл

@ -1,4 +1,5 @@
@echo off
cd %~dp0
call tools\gen-version.cmd
@setlocal ENABLEEXTENSIONS

Просмотреть файл

@ -1,5 +1,4 @@
@echo off
echo WARNING!!! ****************************************************************************************** !!!WARNING
echo WARNING!!! This part of the build process requires Visual Studio 2017 IDE to be installed on machine. !!!WARNING
echo WARNING!!! llvm.vsix extension (Clang LLVM support for Visual Studio) is INCOMPATIBLE with vs2019. !!!WARNING
@ -12,7 +11,19 @@ echo WARNING!!! The other alternative is to actually install Visual Studio 2017
echo WARNING!!! ****************************************************************************************** !!!WARNING
timeout 5
set VSTOOLS_VERSION=vs2017
cd %~dp0
echo Update all public submodules...
git -c submodule."lib/modules".update=none submodule update --init --recursive
if DEFINED GIT_PULL_TOKEN (
rd /s /q lib\modules
git clone https://%GIT_PULL_TOKEN%:x-oauth-basic@github.com/microsoft/cpp_client_telemetry_modules.git lib\modules
)
call tools\vcvars.cmd
setlocal enableextensions
setlocal enabledelayedexpansion
set ROOT=%~dp0

Просмотреть файл

@ -3,8 +3,8 @@
#define MAT_VERSION_HPP
// WARNING: DO NOT MODIFY THIS FILE!
// This file has been automatically generated, manual changes will be lost.
#define BUILD_VERSION_STR "3.3.157.1"
#define BUILD_VERSION 3,3,157,1
#define BUILD_VERSION_STR "3.3.169.1"
#define BUILD_VERSION 3,3,169,1
#ifndef RESOURCE_COMPILER_INVOKED
#include <stdint.h>
@ -30,7 +30,7 @@ namespace ARIASDK_NS_BEGIN {
uint64_t const Version =
((uint64_t)3 << 48) |
((uint64_t)3 << 32) |
((uint64_t)157 << 16) |
((uint64_t)169 << 16) |
((uint64_t)1);
} ARIASDK_NS_END

Просмотреть файл

@ -1,3 +1,3 @@
@REM This script allows to download a file to local machine. First argument is URL
set "PATH=C:\Windows;C:\Windows\System32;C:\WINDOWS\System32\WindowsPowerShell\v1.0\;C:\Program Files\Git\bin"
@powershell -File Download.ps1 %1
@powershell -File download.ps1 %1

24
tools/install-llvm.cmd Normal file
Просмотреть файл

@ -0,0 +1,24 @@
@echo off
set "PATH=C:\Windows;C:\Windows\System32;C:\WINDOWS\System32\WindowsPowerShell\v1.0\;C:\Program Files\Git\bin"
cd %~dp0
call powershell -File .\install-llvm.ps1
REM Download Visual Studio LLVM extension required for clang build
if NOT exist llvm.vsix (
call download.cmd https://llvmextensions.gallerycdn.vsassets.io/extensions/llvmextensions/llvm-toolchain/1.0.363769/1560930595399/llvm.vsix
)
if NOT exist "%VSINSTALLDIR%" (
REM Detect Visual Studio path
call vcvars.cmd
)
REM Install optional components
set "VSIXInstaller=%VSINSTALLDIR%\Common7\IDE\VSIXInstaller.exe"
if exist %VSIXInstaller% (
%VSIXInstaller% /q /a llvm.vsix
)
REM Ignore failures if components have been already installed
EXIT /b 0

28
tools/install-llvm.ps1 Normal file
Просмотреть файл

@ -0,0 +1,28 @@
$llvmVersion = "10.0.0"
$ProgramFiles= $env:ProgramFiles
$arch = "win64"
if ($args.count -eq 1)
{
$arch = $args[0]
$ProgramFiles = ${env:ProgramFiles(x86)}
}
$path = "$ProgramFiles\LLVM\bin\clang.exe"
Write-Host $path
if (!( Test-Path -PathType Leaf -Path $path ))
{
Write-Host "Installing LLVM $llvmVersion ..." -ForegroundColor Cyan
Write-Host "Downloading..."
$exePath = "$env:temp\LLVM-$llvmVersion-$arch.exe"
(New-Object Net.WebClient).DownloadFile("https://github.com/llvm/llvm-project/releases/download/llvmorg-$llvmVersion/LLVM-$llvmVersion-$arch.exe", $exePath)
Write-Host "Installing..."
cmd /c start /wait $exePath /S
Write-Host "LLVM Installed:" -ForegroundColor Green
} else
{
Write-Host "LLVM is already Installed:" -ForegroundColor Green
}
&"${ProgramFiles}\LLVM\bin\clang.exe" -v

Просмотреть файл

@ -1,36 +0,0 @@
set "PATH=C:\Windows;C:\Windows\System32;C:\WINDOWS\System32\WindowsPowerShell\v1.0\;C:\Program Files\Git\bin"
cd %~dp0
call powershell -File .\install_llvm-win64.ps1
REM Download Visual Studio LLVM extension required for clang build to succeed
call download.cmd https://llvmextensions.gallerycdn.vsassets.io/extensions/llvmextensions/llvm-toolchain/1.0.363769/1560930595399/llvm.vsix
REM Install optional components required for ARM build - vs2017-BuildTools
if exist "%ProgramFiles(x86)%\Microsoft Visual Studio\2017\BuildTools" (
"%ProgramFiles(x86)%\Microsoft Visual Studio\Installer\vs_installer.exe" modify --installPath "%ProgramFiles(x86)%\Microsoft Visual Studio\2017\BuildTools" -q ^
--add Microsoft.VisualStudio.Component.VC.ATL ^
--add Microsoft.VisualStudio.Component.VC.ATL.ARM ^
--add Microsoft.VisualStudio.Component.VC.ATL.ARM64 --passive --wait
"%ProgramFiles(x86)%\Microsoft Visual Studio\2017\BuildTools\Common7\IDE\VSIXInstaller.exe" /q /a llvm.vsix
)
REM Install optional components required for ARM build - vs2017-Enterprise
if exist "%ProgramFiles(x86)%\Microsoft Visual Studio\2017\Enterprise" (
"%ProgramFiles(x86)%\Microsoft Visual Studio\Installer\vs_installer.exe" modify --installPath "%ProgramFiles(x86)%\Microsoft Visual Studio\2017\Enterprise" -q ^
--add Microsoft.VisualStudio.Component.VC.ATL ^
--add Microsoft.VisualStudio.Component.VC.ATL.ARM ^
--add Microsoft.VisualStudio.Component.VC.ATL.ARM64 --passive --wait
"%ProgramFiles(x86)%\Microsoft Visual Studio\2017\Enterprise\Common7\IDE\VSIXInstaller.exe" /q /a llvm.vsix
)
REM Install optional components required for ARM build - vs2019-Enterprise
if exist "%ProgramFiles(x86)%\Microsoft Visual Studio\2019\Enterprise" (
"%ProgramFiles(x86)%\Microsoft Visual Studio\Installer\vs_installer.exe" modify --installPath "%ProgramFiles(x86)%\Microsoft Visual Studio\2019\Enterprise" -q ^
--add Microsoft.VisualStudio.Component.VC.ATL ^
--add Microsoft.VisualStudio.Component.VC.ATL.ARM ^
--add Microsoft.VisualStudio.Component.VC.ATL.ARM64 --passive --wait
"%ProgramFiles(x86)%\Microsoft Visual Studio\2019\Enterprise\Common7\IDE\VSIXInstaller.exe" /q /a llvm.vsix
)
REM Ignore failures if components have been already installed
EXIT /b 0

Просмотреть файл

@ -1,8 +0,0 @@
$llvmVersion = "10.0.0"
Write-Host "Installing LLVM $llvmVersion ..." -ForegroundColor Cyan
Write-Host "Downloading..."
$exePath = "$env:temp\LLVM-$llvmVersion-win32.exe"
(New-Object Net.WebClient).DownloadFile("https://github.com/llvm/llvm-project/releases/download/llvmorg-$llvmVersion/LLVM-$llvmVersion-win32.exe", $exePath)
Write-Host "Installing..."
cmd /c start /wait $exePath /S
Write-Host "Installed" -ForegroundColor Green

Просмотреть файл

@ -1,8 +0,0 @@
$llvmVersion = "10.0.0"
Write-Host "Installing LLVM $llvmVersion ..." -ForegroundColor Cyan
Write-Host "Downloading..."
$exePath = "$env:temp\LLVM-$llvmVersion-win64.exe"
(New-Object Net.WebClient).DownloadFile("https://github.com/llvm/llvm-project/releases/download/llvmorg-$llvmVersion/LLVM-$llvmVersion-win64.exe", $exePath)
Write-Host "Installing..."
cmd /c start /wait $exePath /S
Write-Host "Installed" -ForegroundColor Green

Просмотреть файл

@ -0,0 +1,5 @@
Source: benchmark
Version: 1.5
Homepage: https://github.com/google/benchmark
Description: A library to support the benchmarking of functions, similar to unit-tests.
Supports: !uwp

Просмотреть файл

@ -0,0 +1,40 @@
if(VCPKG_CMAKE_SYSTEM_NAME STREQUAL "WindowsStore")
message(FATAL_ERROR "${PORT} does not currently support UWP")
endif()
# Make sure vs2019 compiled binaries are compat with vs2017
set(VCPKG_CXX_FLAGS "/Zc:__cplusplus /d2FH4-")
set(VCPKG_C_FLAGS "/Zc:__cplusplus /d2FH4-")
include(vcpkg_common_functions)
vcpkg_check_linkage(ONLY_STATIC_LIBRARY)
vcpkg_from_github(
OUT_SOURCE_PATH SOURCE_PATH
REPO google/benchmark
REF v1.5.0
SHA512 a0df9aa3d03f676e302c76d83b436de36eea0a8517ab50a8f5a11c74ccc68a1f5128fa02474901002d8e6b5a4d290ef0272a798ff4670eab3e2d78dc86bb6cd3
HEAD_REF master
)
vcpkg_configure_cmake(
SOURCE_PATH ${SOURCE_PATH}
PREFER_NINJA
OPTIONS
-DBENCHMARK_ENABLE_TESTING=OFF
-DCMAKE_DEBUG_POSTFIX=d
)
vcpkg_install_cmake()
vcpkg_copy_pdbs()
vcpkg_fixup_cmake_targets(CONFIG_PATH lib/cmake/benchmark)
file(REMOVE_RECURSE ${CURRENT_PACKAGES_DIR}/debug/include)
file(REMOVE_RECURSE ${CURRENT_PACKAGES_DIR}/debug/share)
# Handle copyright
file(COPY ${SOURCE_PATH}/LICENSE DESTINATION ${CURRENT_PACKAGES_DIR}/share/benchmark)
file(RENAME ${CURRENT_PACKAGES_DIR}/share/benchmark/LICENSE ${CURRENT_PACKAGES_DIR}/share/benchmark/copyright)

Просмотреть файл

@ -1,14 +1,105 @@
@echo off
WHERE choco >nul 2>nul
IF %ERRORLEVEL% NEQ 0 (
REM @echo off
set "PATH=%PATH%;%~dp0;%~dp0\vcpkg"
pushd %~dp0
REM Fail if chocolatey is not installed
where /Q choco
if ERRORLEVEL 1 (
echo This script requires chocolatey. Installation instructions: https://chocolatey.org/docs/installation
exit -1
)
choco install -y cmake
choco install -y svn
choco install -y git
choco install -y llvm
choco install -y zip
REM choco install -y visualstudio2017buildtools
REM choco install -y visualstudio2017enterprise
REM Print current Visual Studio installations detected
where /Q vswhere
if ERRORLEVEL 0 (
echo Visual Studio installations detected:
vswhere -property installationPath
)
REM Install tools needed to build SDK with either Visual Studio or CMake
choco install -y cmake svn git llvm zip
REM Try to autodetect Visual Studio
call "%~dp0\vcvars.cmd"
if "%VSTOOLS_NOTFOUND%" == "1" (
REM Cannot detect MSBuild path
REM TODO: no command line tools..
REM TODO: use MSBuild from vswhere?
)
echo Visual Studio installation directory:
echo %VSINSTALLDIR%
set "VSINSTALLER=%ProgramFiles(x86)%\Microsoft Visual Studio\Installer\vs_installer.exe"
if NOT exist "%VSINSTALLER%" (
call download.cmd https://aka.ms/vs/16/release/vs_buildtools.exe
set VSINSTALLER=vs_buildtools.exe
)
echo Visual Studio installer:
echo "%VSINSTALLER%"
REM Install optional components required for ARM build - vs2017-BuildTools
if exist "%VSINSTALLDIR%" (
echo Running Visual Studio installer..
"%VSINSTALLER%" ^
modify --installPath "%VSINSTALLDIR%" -q ^
--add Microsoft.Component.MSBuild ^
--add Microsoft.VisualStudio.Component.Roslyn.Compiler ^
--add Microsoft.VisualStudio.Component.TextTemplating ^
--add Microsoft.VisualStudio.Component.VC.14.20.ARM ^
--add Microsoft.VisualStudio.Component.VC.14.20.ARM64 ^
--add Microsoft.VisualStudio.Component.VC.14.20.ATL ^
--add Microsoft.VisualStudio.Component.VC.14.20.ATL.ARM ^
--add Microsoft.VisualStudio.Component.VC.14.20.ATL.ARM64 ^
--add Microsoft.VisualStudio.Component.VC.14.20.CLI.Support ^
--add Microsoft.VisualStudio.Component.VC.ATL ^
--add Microsoft.VisualStudio.Component.VC.ATL.ARM ^
--add Microsoft.VisualStudio.Component.VC.ATL.ARM64 ^
--add Microsoft.VisualStudio.Component.VC.ATLMFC ^
--add Microsoft.VisualStudio.Component.VC.CLI.Support ^
--add Microsoft.VisualStudio.Component.VC.CoreBuildTools ^
--add Microsoft.VisualStudio.Component.VC.CoreIde ^
--add Microsoft.VisualStudio.Component.VC.Llvm.Clang ^
--add Microsoft.VisualStudio.Component.VC.Llvm.ClangToolset ^
--add Microsoft.VisualStudio.Component.VC.Modules.x86.x64 ^
--add Microsoft.VisualStudio.Component.VC.Redist.14.Latest ^
--add Microsoft.VisualStudio.Component.VC.Tools.14.11 ^
--add Microsoft.VisualStudio.Component.VC.Tools.ARM ^
--add Microsoft.VisualStudio.Component.VC.Tools.ARM64 ^
--add Microsoft.VisualStudio.Component.VC.Tools.x86.x64 ^
--add Microsoft.VisualStudio.Component.VC.Tools.x86.x64 ^
--add Microsoft.VisualStudio.Component.VC.v141.ARM ^
--add Microsoft.VisualStudio.Component.VC.v141.ARM64 ^
--add Microsoft.VisualStudio.Component.VC.v141.x86.x64 ^
--add Microsoft.VisualStudio.Component.Windows10SDK ^
--add Microsoft.VisualStudio.Component.Windows10SDK.16299 ^
--add Microsoft.VisualStudio.Component.Windows10SDK.17134 ^
--add Microsoft.VisualStudio.Component.Windows10SDK.17763 ^
--add Microsoft.VisualStudio.ComponentGroup.NativeDesktop.Core ^
--add Microsoft.VisualStudio.ComponentGroup.NativeDesktop.Llvm.Clang ^
--add Microsoft.VisualStudio.ComponentGroup.NativeDesktop.Win81 ^
--add Microsoft.VisualStudio.ComponentGroup.UWP.VC.BuildTools ^
--add Microsoft.VisualStudio.ComponentGroup.UWP.VC.v141.BuildTools ^
--add Microsoft.VisualStudio.Workload.VCTools ^
--add Microsoft.VisualStudio.Component.UWP.VC.ARM64 ^
--passive --quiet --norestart --noUpdateInstaller
)
where /Q vcpkg.exe
if ERRORLEVEL 1 (
REM Build our own vcpkg from source
pushd .\vcpkg
call bootstrap-vcpkg.bat
popd
)
REM Install it
vcpkg integrate install
vcpkg install gtest:x64-windows
vcpkg install --overlay-ports=%~dp0\ports benchmark:x64-windows
vcpkg install ms-gsl:x64-windows
REM Required for LLVM Clang build on Windows
call install-llvm.cmd
popd
exit /b 0

Просмотреть файл

@ -10,48 +10,71 @@ REM 4. Visual Studio 2019 Community
REM 5. Visual Studio 2019 BuildTools
REM
REM 1st parameter - Visual Studio version
if "%1" neq "" (
goto %1
)
if "%VSTOOLS_VERSION%" neq "" (
goto %VSTOOLS_VERSION%
)
REM vs2017 Enterprise
set TOOLS_VS2017_ENTERPRISE="%ProgramFiles(x86)%\Microsoft Visual Studio\2017\Enterprise\Common7\Tools\VsDevCmd.bat"
if exist %TOOLS_VS2017_ENTERPRISE% (
:vs2017
:vs2017_enterprise
set "VSDEVCMD=%ProgramFiles(x86)%\Microsoft Visual Studio\2017\Enterprise\Common7\Tools\VsDevCmd.bat"
if exist "%VSDEVCMD%" (
set "VSINSTALLDIR=%ProgramFiles(x86)%\Microsoft Visual Studio\2017\Enterprise"
echo Building with vs2017 Enterprise...
call %TOOLS_VS2017_ENTERPRISE%
call "%VSDEVCMD%"
goto tools_configured
)
REM vs2017 BuildTools
set TOOLS_VS2017="%ProgramFiles(x86)%\Microsoft Visual Studio\2017\BuildTools\Common7\Tools\VsDevCmd.bat"
if exist %TOOLS_VS2017% (
:vs2017_buildtools
set "VSDEVCMD=%ProgramFiles(x86)%\Microsoft Visual Studio\2017\BuildTools\Common7\Tools\VsDevCmd.bat"
if exist "%VSDEVCMD%" (
set "VSINSTALLDIR=%ProgramFiles(x86)%\Microsoft Visual Studio\2017\BuildTools"
echo Building with vs2017 BuildTools...
call %TOOLS_VS2017%
call "%VSDEVCMD%"
goto tools_configured
)
REM vs2019 Enterprise
set TOOLS_VS2019_ENTERPRISE="%ProgramFiles(x86)%\Microsoft Visual Studio\2019\Enterprise\Common7\Tools\VsDevCmd.bat"
if exist %TOOLS_VS2019_ENTERPRISE% (
:vs2019
:vs2019_enterprise
set "VSDEVCMD=%ProgramFiles(x86)%\Microsoft Visual Studio\2019\Enterprise\Common7\Tools\VsDevCmd.bat"
if exist "%VSDEVCMD%" (
set "VSINSTALLDIR=%ProgramFiles(x86)%\Microsoft Visual Studio\2019\Enterprise"
echo Building with vs2019 Enterprise...
call %TOOLS_VS2019_ENTERPRISE%
call "%VSDEVCMD%"
goto tools_configured
)
REM vs2019 Community
set TOOLS_VS2019_COMMUNITY="%ProgramFiles(x86)%\Microsoft Visual Studio\2019\Community\Common7\Tools\VsDevCmd.bat"
if exist %TOOLS_VS2019_COMMUNITY% (
:vs2019_community
set "VSDEVCMD=%ProgramFiles(x86)%\Microsoft Visual Studio\2019\Community\Common7\Tools\VsDevCmd.bat"
if exist "%VSDEVCMD%" (
set "VSINSTALLDIR=%ProgramFiles(x86)%\Microsoft Visual Studio\2019\Community"
echo Building with vs2019 Community...
call %TOOLS_VS2019_COMMUNITY%
call "%VSDEVCMD%"
goto tools_configured
)
REM vs2019 BuildTools
set TOOLS_VS2019="%ProgramFiles(x86)%\Microsoft Visual Studio\2019\BuildTools\Common7\Tools\VsDevCmd.bat"
if exist %TOOLS_VS2019% (
:vs2019_buildtools
set "VSDEVCMD=%ProgramFiles(x86)%\Microsoft Visual Studio\2019\BuildTools\Common7\Tools\VsDevCmd.bat"
if exist "%VSDEVCMD%" (
set "VSINSTALLDIR=%ProgramFiles(x86)%\Microsoft Visual Studio\2019\BuildTools"
echo Building with vs2019 BuildTools...
call %TOOLS_VS2017%
call "%VSDEVCMD%"
goto tools_configured
)
echo WARNING:*********************************************
echo WARNING: cannot auto-detect Visual Studio version !!!
echo WARNING:*********************************************
set VSTOOLS_NOTFOUND=1
exit /b 0
:tools_configured