Merge pull request #420 from microsoft/maxgolov/build_all_vs2017

vs2017/vs2019/llvm-clang-10 full build on GitHub Actions
This commit is contained in:
Max Golovanov 2020-06-24 18:55:34 -07:00 коммит произвёл GitHub
Родитель 848cdd1118 2604d2d7ca
Коммит bab2d0c832
24 изменённых файлов: 582 добавлений и 51 удалений

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

@ -0,0 +1,34 @@
name: C/C++ CI on Windows (clang)
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
env:
VSTOOLS_VERSION: vs2019
shell: cmd
run: tools\setup-buildtools.cmd
- name: Build
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
GIT_PULL_TOKEN: ${{ secrets.GIT_PULL_TOKEN }}
VSTOOLS_VERSION: vs2019
shell: cmd
run: build-cmake-clang-vs2019.cmd

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

@ -0,0 +1,33 @@
name: C/C++ CI on Windows (vs2017)
on:
push:
branches:
- master
pull_request:
branches:
- master
jobs:
build:
runs-on: windows-2016
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 }}
SKIP_ARM_BUILD: 1
SKIP_ARM64_BUILD: 1
shell: cmd
run: build-all.bat

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

@ -0,0 +1,34 @@
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 }}
SKIP_ARM_BUILD: 1
SKIP_ARM64_BUILD: 1
PlatformToolset: v142
shell: cmd
run: build-all.bat

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

@ -40,7 +40,8 @@ To build the SDK, please refer to [How to build the SDK](CONTRIBUTING.md#How_to_
| Ubuntu 14.04.1 LTS | GCC 5.x.x |
| Ubuntu 16.04 LTS | GCC 5.x.x (armv7l) |
| Windows 10 | Android Studio/Gradle |
| Windows Server 2016 | Visual Studio 2017 |
| Windows Server 2016 | Visual Studio 2017 (vc141) |
| Windows Server 2019 | Visual Studio 2019 (vc142) |
</details>
<details>
@ -48,7 +49,7 @@ To build the SDK, please refer to [How to build the SDK](CONTRIBUTING.md#How_to_
| Target Platform | Supported | Covered by CI |
| ------------------------------ | ------------------ | ------------------ |
| Android | partial&dagger; | |
| Android | partial&dagger; | :white_check_mark: |
| iOS 10+ (simulator) | :white_check_mark: | :white_check_mark: |
| iOS 10+ (arm64, arm64e) | :white_check_mark: | |
| Linux (x86, x64, arm, aarch64) | :white_check_mark: | |
@ -57,10 +58,11 @@ To build the SDK, please refer to [How to build the SDK](CONTRIBUTING.md#How_to_
| Ubuntu 14.04.x LTS | :white_check_mark: | :white_check_mark: |
| Ubuntu (latest) | :white_check_mark: | :white_check_mark: |
| Windows 7.1 | :white_check_mark: | |
| Windows 8.1 | :white_check_mark: | :white_check_mark: |
| Windows 8.1 | :white_check_mark: | |
| Windows 10.x | :white_check_mark: | |
| Windows Server 2012 | :white_check_mark: | |
| Windows Server 2016 | :white_check_mark: | :white_check_mark: |
| Windows Server 2019 | :white_check_mark: | |
* **Supported** - these platforms are known to work well with the SDK in
production.

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

@ -3,7 +3,9 @@
<CustomIncludePath>$(SolutionDir)\..\third_party\krabsetw\krabs;$(CustomIncludePath)</CustomIncludePath>
</PropertyGroup>
<PropertyGroup Label="Globals">
<PlatformToolset>v141</PlatformToolset>
<!-- Use Visual Studio 2017 v141 toolset as default -->
<PlatformToolset Condition="'$(PlatformToolset)' == ''">v141</PlatformToolset>
<PlatformToolset Condition="'$(PlatformToolset)' != ''">$(PlatformToolset)</PlatformToolset>
<!-- Customers may override WindowsTargetPlatformVersion before auto-detection of latest Win 10 SDK -->
<LatestTargetPlatformVersion>$([Microsoft.Build.Utilities.ToolLocationHelper]::GetLatestSDKTargetPlatformVersion('Windows', '10.0'))</LatestTargetPlatformVersion>
<WindowsTargetPlatformVersion Condition="'$(WindowsTargetPlatformVersion)' == ''">$(LatestTargetPlatformVersion)</WindowsTargetPlatformVersion>

55
build-all-v142.bat Normal file
Просмотреть файл

@ -0,0 +1,55 @@
@echo off
set VSTOOLS_VERSION=vs2019
set PlatformToolset=v142
cd %~dp0
call tools\gen-version.cmd
@setlocal ENABLEEXTENSIONS
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
set MAXCPUCOUNT=%NUMBER_OF_PROCESSORS%
set platform=
set SOLUTION=Solutions\MSTelemetrySDK.sln
set CUSTOM_PROPS=
if ("%1"=="") goto skip
set CUSTOM_PROPS="/p:ForceImportBeforeCppTargets=%1"
echo Using custom properties file for the build:
echo %CUSTOM_PROPS%
:skip
REM DLL and static /MD build
msbuild %SOLUTION% /target:sqlite,zlib,sqlite-uwp,win32-dll,win32-lib,net40,win10-cs,win10-dll,Tests\gmock,Tests\gtest,Tests\UnitTests,Tests\FuncTests /p:BuildProjectReferences=true /maxcpucount:%MAXCPUCOUNT% /p:Configuration=Debug /p:Platform=Win32 %CUSTOM_PROPS%
msbuild %SOLUTION% /target:sqlite,zlib,sqlite-uwp,win32-dll,win32-lib,net40,win10-cs,win10-dll,Tests\gmock,Tests\gtest,Tests\UnitTests,Tests\FuncTests /p:BuildProjectReferences=true /maxcpucount:%MAXCPUCOUNT% /p:Configuration=Release /p:Platform=Win32 %CUSTOM_PROPS%
msbuild %SOLUTION% /target:sqlite,zlib,sqlite-uwp,win32-dll,win32-lib,net40,win10-cs,win10-dll,Tests\gmock,Tests\gtest,Tests\UnitTests,Tests\FuncTests /p:BuildProjectReferences=true /maxcpucount:%MAXCPUCOUNT% /p:Configuration=Debug /p:Platform=x64 %CUSTOM_PROPS%
msbuild %SOLUTION% /target:sqlite,zlib,sqlite-uwp,win32-dll,win32-lib,net40,win10-cs,win10-dll,Tests\gmock,Tests\gtest,Tests\UnitTests,Tests\FuncTests /p:BuildProjectReferences=true /maxcpucount:%MAXCPUCOUNT% /p:Configuration=Release /p:Platform=x64 %CUSTOM_PROPS%
REM Static /MT build
msbuild %SOLUTION% /target:sqlite,zlib,win32-lib /p:BuildProjectReferences=true /maxcpucount:%MAXCPUCOUNT% /p:Configuration=Debug.vs2015.MT-sqlite /p:Platform=Win32 %CUSTOM_PROPS%
msbuild %SOLUTION% /target:sqlite,zlib,win32-lib /p:BuildProjectReferences=true /maxcpucount:%MAXCPUCOUNT% /p:Configuration=Release.vs2015.MT-sqlite /p:Platform=Win32 %CUSTOM_PROPS%
msbuild %SOLUTION% /target:sqlite,zlib,win32-lib /p:BuildProjectReferences=true /maxcpucount:%MAXCPUCOUNT% /p:Configuration=Debug.vs2015.MT-sqlite /p:Platform=x64 %CUSTOM_PROPS%
msbuild %SOLUTION% /target:sqlite,zlib,win32-lib /p:BuildProjectReferences=true /maxcpucount:%MAXCPUCOUNT% /p:Configuration=Release.vs2015.MT-sqlite /p:Platform=x64 %CUSTOM_PROPS%
if NOT DEFINED SKIP_ARM_BUILD (
REM ARM DLL build
call tools\vcvars-ext.cmd arm
msbuild %SOLUTION% /target:zlib,sqlite-uwp,win10-cs,win10-dll /p:BuildProjectReferences=true /maxcpucount:%MAXCPUCOUNT% /p:Configuration=Debug /p:Platform=ARM %CUSTOM_PROPS%
msbuild %SOLUTION% /target:zlib,sqlite-uwp,win10-cs,win10-dll /p:BuildProjectReferences=true /maxcpucount:%MAXCPUCOUNT% /p:Configuration=Release /p:Platform=ARM %CUSTOM_PROPS%
)
if NOT DEFINED SKIP_ARM64_BUILD (
REM ARM64 DLL build
call tools\vcvars-ext.cmd arm64
msbuild %SOLUTION% /target:sqlite,zlib,sqlite-uwp,win32-dll,win32-lib,win10-cs,win10-dll /p:BuildProjectReferences=true /maxcpucount:%MAXCPUCOUNT% /p:Configuration=Debug /p:Platform=ARM64 %CUSTOM_PROPS%
msbuild %SOLUTION% /target:sqlite,zlib,sqlite-uwp,win32-dll,win32-lib,win10-cs,win10-dll /p:BuildProjectReferences=true /maxcpucount:%MAXCPUCOUNT% /p:Configuration=Release /p:Platform=ARM64 %CUSTOM_PROPS%
)

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

@ -1,4 +1,5 @@
@echo off
cd %~dp0
call tools\gen-version.cmd
@setlocal ENABLEEXTENSIONS
@ -36,12 +37,16 @@ msbuild %SOLUTION% /target:sqlite,zlib,win32-lib /p:BuildProjectReferences=true
msbuild %SOLUTION% /target:sqlite,zlib,win32-lib /p:BuildProjectReferences=true /maxcpucount:%MAXCPUCOUNT% /p:Configuration=Debug.vs2015.MT-sqlite /p:Platform=x64 %CUSTOM_PROPS%
msbuild %SOLUTION% /target:sqlite,zlib,win32-lib /p:BuildProjectReferences=true /maxcpucount:%MAXCPUCOUNT% /p:Configuration=Release.vs2015.MT-sqlite /p:Platform=x64 %CUSTOM_PROPS%
if NOT DEFINED SKIP_ARM_BUILD (
REM ARM DLL build
call tools\vcvars-ext.cmd arm
msbuild %SOLUTION% /target:zlib,sqlite-uwp,win10-cs,win10-dll /p:BuildProjectReferences=true /maxcpucount:%MAXCPUCOUNT% /p:Configuration=Debug /p:Platform=ARM %CUSTOM_PROPS%
msbuild %SOLUTION% /target:zlib,sqlite-uwp,win10-cs,win10-dll /p:BuildProjectReferences=true /maxcpucount:%MAXCPUCOUNT% /p:Configuration=Release /p:Platform=ARM %CUSTOM_PROPS%
)
if NOT DEFINED SKIP_ARM64_BUILD (
REM ARM64 DLL build
call tools\vcvars-ext.cmd arm64
msbuild %SOLUTION% /target:sqlite,zlib,sqlite-uwp,win32-dll,win32-lib,win10-cs,win10-dll /p:BuildProjectReferences=true /maxcpucount:%MAXCPUCOUNT% /p:Configuration=Debug /p:Platform=ARM64 %CUSTOM_PROPS%
msbuild %SOLUTION% /target:sqlite,zlib,sqlite-uwp,win32-dll,win32-lib,win10-cs,win10-dll /p:BuildProjectReferences=true /maxcpucount:%MAXCPUCOUNT% /p:Configuration=Release /p:Platform=ARM64 %CUSTOM_PROPS%
)

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

@ -0,0 +1,88 @@
@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
echo WARNING!!! vs2019 build fails with an error: The build tools for LLVM (Platform Toolset = 'LLVM') !!!WARNING
echo WARNING!!! cannot be found. If you intend to use vs2019, build with build-cmake-clang-vs2019.cmd !!!WARNING
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
REM ********************************************************************
REM Use cmake
REM ********************************************************************
set "PATH=C:\Program Files\CMake\bin\;%PATH%"
REM ********************************************************************
REM Use clang compiler
REM ********************************************************************
set CLANG_PATH="C:\Program Files\LLVM\bin"
set CC=%CLANG_PATH%\clang.exe
set CXX=%CLANG_PATH%\clang++.exe
set LLVM_VER=LLVM
REM ********************************************************************
REM Set output directory, clean and/or create as-needed
REM ********************************************************************
set OUTDIR=%ROOT%\Solutions\out
if "%1" == "clean" (
@rmdir /s /q %OUTDIR%
)
if not exist "%OUTDIR%" mkdir %OUTDIR%
REM ********************************************************************
REM Build all deps using MSVC - Visual Studio 2017 (15)
REM ********************************************************************
if "%1" == "nodeps" goto NODEPS
call tools\build-deps.cmd
:NODEPS
cd %OUTDIR%
REM ********************************************************************
REM Invoke the build script
REM ********************************************************************
set CMAKE_PACKAGE_TYPE=tgz
for %%a in ( m32 m64 ) do (
for %%c in ( Release ) do (
if "%%a"=="m32" (
set ARCH=Win32
set ARCH_GEN=
)
if "%%a"=="m64" (
set ARCH=x64
set ARCH_GEN= Win64
)
@mkdir %OUTDIR%\%%c\!ARCH!
cd %OUTDIR%\%%c\!ARCH!
set "CFLAGS=-%%a"
set "CXXFLAGS=-%%a -Wc++11-compat-pedantic -Wno-c++98-compat -Wno-everything"
cmake -G"Visual Studio 15 2017!ARCH_GEN!" ^
-T"%LLVM_VER%" ^
-DTARGET_ARCH=!ARCH! ^
-DBUILD_SHARED_LIBS=OFF ^
-DCMAKE_BUILD_TYPE=%%c ^
-DCMAKE_PACKAGE_TYPE=%CMAKE_PACKAGE_TYPE% ^
-DDEFAULT_PAL_IMPLEMENTATION=WIN32 ^
%ROOT%
cmake --build . --config %%c -- /p:Configuration=%%c
)
)
cd %ROOT%

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

@ -1,5 +1,18 @@
@echo off
set VSTOOLS_VERSION=vs2019
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
@ -15,7 +28,7 @@ REM ********************************************************************
set CLANG_PATH="C:\Program Files\LLVM\bin"
set CC=%CLANG_PATH%\clang.exe
set CXX=%CLANG_PATH%\clang++.exe
set LLVM_VER=LLVM
set LLVM_VER=ClangCL
REM ********************************************************************
REM Set output directory, clean and/or create as-needed
@ -43,17 +56,17 @@ for %%a in ( m32 m64 ) do (
for %%c in ( Release ) do (
if "%%a"=="m32" (
set ARCH=Win32
set ARCH_GEN=
set ARCH_GEN= Win32
)
if "%%a"=="m64" (
set ARCH=x64
set ARCH_GEN= Win64
set ARCH_GEN= x64
)
@mkdir %OUTDIR%\%%c\!ARCH!
cd %OUTDIR%\%%c\!ARCH!
set "CFLAGS=-%%a"
set "CXXFLAGS=-%%a -Wc++11-compat-pedantic -Wno-c++98-compat -Wno-everything"
cmake -G"Visual Studio 15 2017!ARCH_GEN!" ^
cmake -G"Visual Studio 16 2019" -A !ARCH_GEN! ^
-T"%LLVM_VER%" ^
-DTARGET_ARCH=!ARCH! ^
-DBUILD_SHARED_LIBS=OFF ^

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

@ -11,13 +11,12 @@ to clone the repo. If your project requires UTC to send telemetry, you need to a
2. You will be asked for your credentials to clone the repo. Generate a PAT token using GitHub UI, use your username and PAT token to clone the repo. See [Generating PAT token for command line clone](https://help.github.com/en/github/authenticating-to-github/creating-a-personal-access-token-for-the-command-line)
## **Windows prerequisites and dependencies for building from source using Visual Studio 2017**
## **Windows prerequisites and dependencies for building from source**
* Visual Studio 2017.
* C++ Dev Tools for Visual Studio 2017.
* Visual Studio 2019 _should work_ if you use vc141 toolset; newer toolsets _might work_, but not tested.
* Visual Studio 2017 or 2019
* C++ Dev Tools
## **Build the SDK from source using Visual Studio 2017**
## **Build the SDK from source using Visual Studio**
* Open the *cpp_client_telemetry/Solutions/MSTelemetrySDK.sln* solution in Visual Studio.
* Alternatively you can use *build-all.bat* located in workspace root folder to build from command line
@ -27,7 +26,9 @@ If your build fails, then you most likely missing the following optional Visual
- ARM64 support
- Spectre mitigation libraries
Make sure you install all of these above optional Visual Studio components, as these are required for the SDK to build all SDK SKUs successfully. If you are using GitHub Actions infrastructure to build your project, then all of these optional components are available by default as part of stock GitHub Actions deployment.
Please review the script [here](../tools/setup-buildtools.cmd) that installs all the necessary dependencies.
Make sure you install all of these above optional Visual Studio components, as these are required for the SDK to build all SDK SKUs successfully for all platform types. If you are using GitHub Actions infrastructure to build your project, then all of these optional components are available by default as part of stock GitHub Actions deployment.
Specific version of Windows 10 SDK is referenced by the project(s). You will need to install that exact version of Windows 10 SDK, but you may also manually upgrade all projects to current latest version of Windows 10 SDK for your local build. SDK may periodically update its Windows 10 SDK dependency from time to time. Your responsibility is to decide what Windows 10 SDK you need to use for shipping 1DS C++ SDK build from source.
@ -35,20 +36,27 @@ See:
- [How to add optional components in Visual Studio 2017](https://docs.microsoft.com/en-us/visualstudio/install/modify-visual-studio?view=vs-2017)
- [Download Windows 10 SDK](https://developer.microsoft.com/en-us/windows/downloads/windows-10-sdk)
## **Windows prerequisites and dependencies for building from source using LLVM compiler**
* Visual Studio
* [LLVM compiler](https://releases.llvm.org/download.html)
* [CMake build system](https://cmake.org/download/)
* [LLVM compiler toolchain for Visual Studio](https://marketplace.visualstudio.com/items?itemName=LLVMExtensions.llvm-toolchain)
- Install CMake for Windows into C:\Program Files\CMake\bin\ (default path)
- Install **[LLVM/clang for Windows](http://releases.llvm.org/7.0.0/LLVM-7.0.0-win64.exe)** - version 7 or newer into C:\Program Files\LLVM\bin (default path)
- Start elevated cmd.exe shell (Run As Administrator)
- Launch **tools\setup-buildtools.cmd** to install all dependencies
Make sure you can build a simple "Hello World" using CMake before proceeding to the next step.
Make sure you can build a simple "Hello World" using cmake before proceeding to the next step.
To build SDK using cmake with clang on Windows, run:
```build-cmake-clang.cmd```
```build-cmake-clang-vs2017.cmd```
or
```build-cmake-clang-vs2019.cmd```
depending on what Visual Studio version you are using.
## **Instrument your code to send a telemetry event**
@ -66,7 +74,7 @@ To build SDK using cmake with clang on Windows, run:
3. Create the default LogManager instance for your project using the following macro in your main file:
```
```
LOGMANAGER_INSTANCE
```

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

@ -148,6 +148,7 @@ remove_definitions(-D_MBCS)
pal/desktop/WindowsDesktopSystemInformationImpl.cpp
pal/desktop/WindowsEnvironmentInfo.hpp
pal/desktop/NetworkDetector.cpp
utils/StringConversion.cpp
)
# UTC module

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

@ -161,7 +161,7 @@ namespace ARIASDK_NS_BEGIN
/// http - optional IHttpClient override instance
/// taskDispatcher - optional ITaskDispatcher override instance
/// </summary>
typedef struct
typedef struct capi_client_struct
{
ILogManager* logmanager = nullptr;
ILogConfiguration config;

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

@ -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.140.1"
#define BUILD_VERSION 3,3,140,1
#define BUILD_VERSION_STR "3.3.175.1"
#define BUILD_VERSION 3,3,175,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)140 << 16) |
((uint64_t)175 << 16) |
((uint64_t)1);
} ARIASDK_NS_END

35
tools/.vsconfig.vs2017 Normal file
Просмотреть файл

@ -0,0 +1,35 @@
{
"version": "1.0",
"components": [
"Microsoft.Component.MSBuild",
"Microsoft.VisualStudio.Component.Windows10SDK",
"Microsoft.VisualStudio.Component.VC.CoreBuildTools",
"Microsoft.VisualStudio.Component.VC.Tools.x86.x64",
"Microsoft.VisualStudio.Component.VC.Redist.14.Latest",
"Microsoft.VisualStudio.Component.Windows10SDK.17763",
"Microsoft.VisualStudio.Component.VC.CMake.Project",
"Microsoft.VisualStudio.Component.VC.ATL",
"Microsoft.VisualStudio.Component.VC.ATLMFC",
"Microsoft.VisualStudio.Component.VC.CLI.Support",
"Microsoft.VisualStudio.Component.VC.Modules.x86.x64",
"Microsoft.VisualStudio.Component.Windows10SDK.16299.UWP",
"Microsoft.VisualStudio.Component.Windows10SDK.16299.UWP.Native",
"Microsoft.VisualStudio.Component.Windows10SDK.16299.Desktop",
"Microsoft.VisualStudio.Component.Windows10SDK.16299.Desktop.arm",
"Microsoft.VisualStudio.Component.VC.Tools.ARM",
"Microsoft.VisualStudio.Component.VC.Tools.ARM64",
"Microsoft.VisualStudio.Workload.VCTools",
"Microsoft.VisualStudio.ComponentGroup.UWP.BuildTools",
"Microsoft.VisualStudio.Workload.UniversalBuildTools",
"Microsoft.VisualStudio.Component.VC.ATL.ARM",
"Microsoft.VisualStudio.Component.VC.ATL.ARM64",
"Microsoft.VisualStudio.Component.VC.Tools.14.11",
"Microsoft.VisualStudio.Component.VC.ClangC2",
"Microsoft.VisualStudio.Component.VC.ATLMFC.Spectre",
"Microsoft.Visualstudio.Component.VC.Runtimes.x86.x64.Spectre",
"Microsoft.VisualStudio.Component.VC.Runtimes.ARM64.Spectre",
"Microsoft.VisualStudio.Component.VC.ATL.ARM64.Spectre",
"Microsoft.VisualStudio.Component.VC.MFC.ARM64",
"Microsoft.VisualStudio.Component.VC.MFC.ARM64.Spectre"
]
}

42
tools/.vsconfig.vs2019 Normal file
Просмотреть файл

@ -0,0 +1,42 @@
{
"version": "1.0",
"components": [
"Microsoft.VisualStudio.Component.Windows10SDK",
"Microsoft.VisualStudio.Component.VC.Tools.x86.x64",
"Microsoft.VisualStudio.Component.Windows10SDK.18362",
"Microsoft.VisualStudio.Workload.ManagedDesktop",
"Microsoft.VisualStudio.Component.VC.Redist.14.Latest",
"Microsoft.VisualStudio.Component.VC.CMake.Project",
"Microsoft.VisualStudio.Component.VC.ATL",
"Microsoft.VisualStudio.Component.VC.ATLMFC",
"Microsoft.VisualStudio.Component.VC.CLI.Support",
"Microsoft.VisualStudio.Component.VC.Llvm.ClangToolset",
"Microsoft.VisualStudio.Component.VC.Llvm.Clang",
"Microsoft.VisualStudio.Component.VC.v141.x86.x64",
"Microsoft.Component.VC.Runtime.UCRTSDK",
"Microsoft.VisualStudio.Workload.NativeDesktop",
"Microsoft.VisualStudio.Component.VC.Tools.ARM64",
"Microsoft.VisualStudio.Component.UWP.VC.ARM64",
"Microsoft.VisualStudio.Component.VC.Tools.ARM",
"Microsoft.VisualStudio.ComponentGroup.UWP.VC",
"Microsoft.VisualStudio.Component.VC.v141.ARM64",
"Microsoft.VisualStudio.Workload.Universal",
"Microsoft.VisualStudio.Component.VC.ATL.ARM",
"Microsoft.VisualStudio.Component.VC.ATL.ARM64",
"Microsoft.VisualStudio.Component.VC.MFC.ARM",
"Microsoft.VisualStudio.Component.VC.MFC.ARM64",
"Microsoft.VisualStudio.Component.VC.Redist.MSM",
"Microsoft.VisualStudio.Component.VC.v141.ARM.Spectre",
"Microsoft.VisualStudio.Component.VC.v141.ARM64.Spectre",
"Microsoft.VisualStudio.Component.VC.v141.ATL.ARM",
"Microsoft.VisualStudio.Component.VC.v141.ATL.ARM64",
"Microsoft.VisualStudio.Component.VC.v141.ATL",
"Microsoft.VisualStudio.Component.VC.v141.ATL.ARM.Spectre",
"Microsoft.VisualStudio.Component.VC.v141.ATL.ARM64.Spectre",
"Microsoft.VisualStudio.Component.VC.v141.ATL.Spectre",
"Microsoft.VisualStudio.Component.VC.v141.CLI.Support",
"Microsoft.VisualStudio.Component.VC.v141.MFC.ARM",
"Microsoft.VisualStudio.Component.VC.v141.MFC.ARM64",
"Microsoft.VisualStudio.Component.VC.v141.MFC"
]
}

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

@ -4,8 +4,7 @@ echo Building 3rd party dependencies...
set ROOT=%~dp0\..
echo Using Visual Studio 2017 tools...
call "C:\Program Files (x86)\Microsoft Visual Studio\2017\Enterprise\Common7\Tools\VsDevCmd.bat"
call %~dp0\vcvars.cmd
set MAXCPUCOUNT=%NUMBER_OF_PROCESSORS%
set platform=

3
tools/download.cmd Normal file
Просмотреть файл

@ -0,0 +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

4
tools/download.ps1 Normal file
Просмотреть файл

@ -0,0 +1,4 @@
$url=$args[0]
$arr=$args[0].Split("/")
$fileName=$arr[$arr.Count-1]
Invoke-WebRequest -Uri $url -OutFile $fileName -UseBasicParsing

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

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

@ -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,64 @@
@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%" --config "%~dp0\.vsconfig.%VSVERSION%" --force --quiet --norestart
)
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,74 @@ 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"
set VSVERSION=2017
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 VSVERSION=2019
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
set VSVERSION=
exit /b 0
:tools_configured