Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Build farm for Windows #839

Merged
merged 99 commits into from
Jul 8, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
99 commits
Select commit Hold shift + click to select a range
076effa
Add curl via vcpkg to WIndows builds
maxgolov May 11, 2021
0f13e20
Merge branch 'main' of http://github.com/open-telemetry/opentelemetry…
maxgolov May 13, 2021
0540d32
Merge branch 'main' of http://github.com/open-telemetry/opentelemetry…
maxgolov May 19, 2021
c437cef
Merge branch 'main' of http://github.com/open-telemetry/opentelemetry…
maxgolov May 20, 2021
54903e8
Attempt to gracefully switch over from MPark variant to absl::variant
maxgolov May 20, 2021
5c7c70c
Fixing markdownlint warning (sigh)
maxgolov May 20, 2021
24ff212
Add CHANGELOG.md entry about variant implementation switch
maxgolov May 20, 2021
8ed8943
Fix static vs extern issue in Abseil. Add Abseil Variant to include d…
maxgolov May 20, 2021
645136f
Isolate to local abseil paths to avoid picking up external Abseil lib…
maxgolov May 20, 2021
8a0b7f4
No need to specify include path to nostd since now local Abseil would…
maxgolov May 20, 2021
bdb22c6
HAVE_ABSEIL_VARIANT option is gone because by default we know build A…
maxgolov May 20, 2021
dfae1ba
Issue with GMOCK on Windows
maxgolov May 20, 2021
963ccf1
Reinstate the magic of C-string (both std and abseil variant want thi…
maxgolov May 20, 2021
fd5e041
Fix Zipkin exporter to support const char * AttributeValue
maxgolov May 20, 2021
e235db2
Make sure that our local snapshot of Abseil Variant on API surface do…
maxgolov May 20, 2021
41293fd
attribute_utils.h had wrong order for the enum and missing initialize…
maxgolov May 20, 2021
4accbbe
Adjust Resource to store const char * as std::string
maxgolov May 20, 2021
63f0b63
Fix build warning that turns an error in Bazel build
maxgolov May 20, 2021
8047102
Fix for Bazel error with no-exceptions build
maxgolov May 20, 2021
206c63c
Fix Bazel tsan build
maxgolov May 20, 2021
4f0910e
Can't declare a class using exceptions in a build with no-exceptions
maxgolov May 20, 2021
e9e2e85
Add full set of features to nostd::variant
maxgolov May 20, 2021
a8dfb7d
Variant test SHOULD NOT make assumptions about how compilers work, wh…
maxgolov May 20, 2021
9785f16
Re-enable Variant Test that was disabled in CMake build for some reason
maxgolov May 20, 2021
e389f66
Merge branch 'main' into maxgolov/absl_variant_default
maxgolov May 20, 2021
ab34030
Merge branch 'main' into maxgolov/absl_variant_default
maxgolov May 20, 2021
8811b13
Merge branch 'main' of http://github.com/open-telemetry/opentelemetry…
maxgolov May 21, 2021
2abdc1a
Can't use GSL if it's not found
maxgolov May 22, 2021
1ea289f
Add those definitions back globally since we are still building proje…
maxgolov May 22, 2021
9d8754d
Clan on Mac requires this to be inline
maxgolov May 22, 2021
a6c41bd
Add missing classes to STDLIB build
maxgolov May 22, 2021
4d10b28
Merge branch 'maxgolov/absl_variant_default' of http://github.com/ope…
maxgolov May 22, 2021
12231f6
Code formatting
maxgolov May 22, 2021
8037c8a
Add proper dependency on json.hpp
maxgolov May 22, 2021
8e2a481
Fix an issue with not finding json.hpp
maxgolov May 22, 2021
c9b56d5
Add overload with attributes as initializer list + options, no links
maxgolov May 22, 2021
2dc6cce
Make finding json.hpp quiet
maxgolov May 22, 2021
1d487fd
Minor formatting
maxgolov May 22, 2021
ec6b88d
Update server.cc
maxgolov May 24, 2021
c067783
Code formatting
maxgolov May 24, 2021
b1f127d
Merge branch 'main' into maxgolov/absl_variant_default
maxgolov May 24, 2021
8044d02
Merge branch 'main' of http://github.com/open-telemetry/opentelemetry…
maxgolov May 24, 2021
f3020a5
Merge branch 'maxgolov/absl_variant_default' of http://github.com/ope…
maxgolov May 24, 2021
fb5393b
Merge branch 'main' into maxgolov/absl_variant_default
maxgolov May 25, 2021
8c95419
Merge branch 'main' of http://github.com/open-telemetry/opentelemetry…
maxgolov May 28, 2021
719cc2d
Merge branch 'maxgolov/absl_variant_default' of http://github.com/ope…
maxgolov May 28, 2021
c478c17
Code formatting change
maxgolov May 28, 2021
ab2c5a9
Update .codecov.yaml
maxgolov May 28, 2021
8d37349
Merge branch 'maxgolov/codecov_settings' of http://github.com/open-te…
maxgolov May 28, 2021
7303c95
Merge branch 'main' of http://github.com/open-telemetry/opentelemetry…
maxgolov Jun 1, 2021
d6f5d32
Merge branch 'main' of http://github.com/open-telemetry/opentelemetry…
maxgolov Jun 1, 2021
ebdf934
Keep logs preview building
maxgolov Jun 2, 2021
692259c
Allow Resource Attributes initialized from common::AttributeValue
maxgolov Jun 2, 2021
553628b
Apply code formatting
maxgolov Jun 2, 2021
752c525
Merge branch 'main' into maxgolov/absl_variant_default
maxgolov Jun 2, 2021
1a26c7a
Merge branch 'main' of http://github.com/open-telemetry/opentelemetry…
maxgolov Jun 2, 2021
174b9d6
Merge branch 'maxgolov/absl_variant_default' of http://github.com/ope…
maxgolov Jun 2, 2021
55b1f00
Visual Studio 2019 Update 16.10 fixes
maxgolov Jun 3, 2021
3a35d05
CMake version check was not properly populating CMAKE_CXX_STANDARD
maxgolov Jun 3, 2021
de01228
Merge branch 'main' into maxgolov/protobuf_fix_vs2019_16.10
maxgolov Jun 3, 2021
fbea16f
Merge branch 'main' into maxgolov/protobuf_fix_vs2019_16.10
maxgolov Jun 4, 2021
2f3d96a
Merge branch 'main' into maxgolov/protobuf_fix_vs2019_16.10
maxgolov Jun 4, 2021
e2c9858
Fix for C++20 flag detection
maxgolov Jun 4, 2021
3452f48
Add support for clang compilers
maxgolov Jun 4, 2021
5c8d990
Merge branch 'main' of http://github.com/open-telemetry/opentelemetry…
maxgolov Jun 4, 2021
f9c46f5
Merge branch 'main' into maxgolov/protobuf_fix_vs2019_16.10
maxgolov Jun 8, 2021
0a29e0e
Merge branch 'main' of http://github.com/open-telemetry/opentelemetry…
maxgolov Jun 8, 2021
3a8d5db
Merge branch 'main' into maxgolov/protobuf_fix_vs2019_16.10
lalitb Jun 8, 2021
8daf5c8
Support vs2015 and clang
maxgolov Jun 8, 2021
8efad28
Remove unused method from Tracer API
maxgolov Jun 8, 2021
5ff530f
Turn all optional components off and fix an issue with __cplusplus
maxgolov Jun 8, 2021
430cc6a
Rename script to mention clang-12 since it assumes the path to clang-12
maxgolov Jun 8, 2021
86a1f3b
Benchmark should specify proper sha or latest vcpkg is gonna fail
maxgolov Jun 8, 2021
26b8866
Latest visual studio 2019 would like arch to be x64 instead of Win64
maxgolov Jun 8, 2021
e226489
Merge source code fixes for vs2015
maxgolov Jun 8, 2021
5d0453d
vcpkg head parameter was incorrect
maxgolov Jun 8, 2021
d20e97e
Merge code fix for vs2015
maxgolov Jun 8, 2021
5f0218a
Use Windows 8.1 SDK and clarify how to use Win 10 SDK in a comment
maxgolov Jun 8, 2021
2b1d894
Merge branch 'main' into maxgolov/protobuf_fix_vs2019_16.10
maxgolov Jun 9, 2021
fbb00b8
Merge branch 'main' into maxgolov/clang_tools
maxgolov Jun 9, 2021
a3b3eb3
Update tracer.h
maxgolov Jun 9, 2021
a23d26a
Re-add ability to auto-parent
maxgolov Jun 9, 2021
7c50310
Merge branch 'main' of http://github.com/open-telemetry/opentelemetry…
maxgolov Jun 9, 2021
eb909bd
Merge branch 'maxgolov/protobuf_fix_vs2019_16.10' of http://github.co…
maxgolov Jun 9, 2021
73b7fc5
Update vcpkg to tag: 2021.05.12
maxgolov Jun 9, 2021
cfb1779
Turn logs off
maxgolov Jun 10, 2021
95bbaf5
Use 'defined' - it is more readable
maxgolov Jun 10, 2021
10fd845
Revert etw/etw_tracer.h changes
maxgolov Jun 10, 2021
1b5444f
Merge branch 'main' of http://github.com/open-telemetry/opentelemetry…
maxgolov Jun 10, 2021
5354cc9
Merge branch 'maxgolov/clang_tools' of http://github.com/open-telemet…
maxgolov Jun 10, 2021
26bc34b
Fix Visual Studio 2017 issue
maxgolov Jun 10, 2021
2c05aee
Build farm for Windows
maxgolov Jun 10, 2021
cba5455
Merge branch 'main' into maxgolov/clang_tools
maxgolov Jun 11, 2021
13d34f2
Merge branch 'main' of http://github.com/open-telemetry/opentelemetry…
maxgolov Jun 11, 2021
32134ee
Merge branch 'maxgolov/clang_tools' of http://github.com/open-telemet…
maxgolov Jun 11, 2021
2925eeb
Merge branch 'main' into maxgolov/clang_tools
maxgolov Jun 11, 2021
acbfecc
Merge branch 'main' into maxgolov/clang_tools
maxgolov Jun 18, 2021
c90e594
Merge branch 'main' into maxgolov/clang_tools
maxgolov Jun 30, 2021
742bc6c
Merge branch 'main' into maxgolov/clang_tools
maxgolov Jul 7, 2021
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion tools/build-benchmark.cmd
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
@echo off
set VS_TOOLS_VERSION=vs2019
set BUILDTOOLS_VERSION=vs2019
set CMAKE_GEN="Visual Studio 16 2019"
echo Building Google Benchmark (test only dependency)...
@setlocal ENABLEEXTENSIONS
Expand Down
7 changes: 7 additions & 0 deletions tools/build-clang-12.cmd
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
@echo off
pushd %~dp0
set "PATH=%ProgramFiles%\LLVM-12\bin;%PATH%"
set BUILDTOOLS_VERSION=clang-12
set CMAKE_GEN=Ninja
call build.cmd %*
popd
7 changes: 7 additions & 0 deletions tools/build-clang.cmd
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
@echo off
pushd %~dp0
set "PATH=%ProgramFiles%\LLVM\bin;%PATH%"
set BUILDTOOLS_VERSION=clang
set CMAKE_GEN=Ninja
call build.cmd %*
popd
32 changes: 27 additions & 5 deletions tools/build-vs2015.cmd
Original file line number Diff line number Diff line change
@@ -1,11 +1,33 @@
REM Build with Visual Studio 2015
set "VS_TOOLS_VERSION=vs2015"
set ARCH=Win64
set "PATH=%ProgramFiles(x86)%\MSBuild\14.0\Bin;%ProgramFiles(x86)%\Microsoft Visual Studio 14.0\VC\bin;%PATH%"

REM ### Note that vcpkg built with 2019/2017 can't be used with 2015!
REM ### Consider to specify custom VCPKG_ROOT for 2015 as follows:
REM
REM set VCPKG_ROOT=C:\vcpkg.2015
REM

set BUILDTOOLS_VERSION=vs2015
set ARCH=x64
if NOT "%1"=="" (
set ARCH=%1
)
set "CMAKE_GEN=Visual Studio 14 2015 %ARCH%"
set "CMAKE_GEN=Ninja"
set "VCPKG_VISUAL_STUDIO_PATH=%ProgramFiles(x86)%\Microsoft Visual Studio 14.0"

REM Building with Windows SDK 8.1
set "PATH=%ProgramFiles(x86)%\Windows Kits\8.1\bin\%ARCH%;%PATH%"
set WINSDK_VERSION=8.1
set CMAKE_SYSTEM_VERSION=8.1
set VCPKG_PLATFORM_TOOLSET=v140

REM ### Replace above Windows SDK 8.1 by Windows 10 SDK if necessary.
REM ### Resulting binaries may not be compatible with Windows 8
REM
REM set WINSDK_VERSION=10.0.19041.0
REM set "PATH=%ProgramFiles(x86)%\Windows Kits\10\bin\10.0.19041.0\%ARCH%\;%PATH%"
REM

cd %~dp0
call setup-buildtools.cmd
REM TODO: currently we cannot build without Abseil variant for Visual Studio 2015
call build.cmd -DWITH_ABSEIL:BOOL=ON
call build.cmd -DMSVC_TOOLSET_VERSION=140
13 changes: 10 additions & 3 deletions tools/build-vs2017.cmd
Original file line number Diff line number Diff line change
@@ -1,10 +1,17 @@
REM Build with Visual Studio 2017
set "VS_TOOLS_VERSION=vs2017"
set ARCH=Win64
set "BUILDTOOLS_VERSION=vs2017"
set ARCH=x64
if NOT "%1"=="" (
set ARCH=%1
)
set "CMAKE_GEN=Visual Studio 15 2017 %ARCH%"

REM ### Uncomment below to use Visual Studio MSBuild solution.
REM ### Ninja generator produces much faster builds. But it is
REM ### easier to debug MSBuild solution in vs2017 IDE :
REM
REM set "CMAKE_GEN=Visual Studio 15 2017"
REM

cd %~dp0
call setup-buildtools.cmd
call build.cmd
8 changes: 3 additions & 5 deletions tools/build-vs2019.cmd
Original file line number Diff line number Diff line change
@@ -1,15 +1,13 @@
REM Build with Visual Studio 2017
set "VS_TOOLS_VERSION=vs2019"
set ARCH=Win64
set "BUILDTOOLS_VERSION=vs2019"
set ARCH=x64
if NOT "%1"=="" (
set ARCH=%1
)
if "%ARCH%"=="Win64" (
if "%ARCH%"=="x64" (
REM Parameter needed for CMake Visual Studio 2019 generator
set CMAKE_ARCH=x64
)

set "CMAKE_GEN=Visual Studio 16 2019"
cd %~dp0
call setup-buildtools.cmd
call build.cmd
100 changes: 60 additions & 40 deletions tools/build.cmd
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
@echo off
REM ##########################################################################################
REM # Build SDK with Visual Studio + CMake + MSBUild or Ninja. #
REM # Build SDK with (msvc or clang) + CMake + (MSBuild or Ninja). #
REM # #
REM # CMake arguments may be passed as parameters to this script. #
REM # If Visual Studio is not installed, then this script falls back to LLVM-CLang, #
Expand All @@ -10,7 +10,7 @@ REM ############################################################################
REM # #
REM # Options passed as environment variables: #
REM # #
REM # VS_TOOLS_VERSION - specify visual studio version. See `vcvars.cmd` for details. #
REM # BUILDTOOLS_VERSION - specify build tools version. See `vcvars.cmd` for details. #
REM # CMAKE_GEN - specify CMake generator. #
REM # VCPKG_ROOT - path to vcpkg root #
REM # ARCH - architecture to build for (default: x64) #
Expand All @@ -20,36 +20,43 @@ set "PATH=%PATH%;%ProgramFiles%\CMake\bin"
pushd %~dp0
setlocal enableextensions
setlocal enabledelayedexpansion
if not defined VS_TOOLS_VERSION (
set VS_TOOLS_VERSION=vs2019
if not defined BUILDTOOLS_VERSION (
set BUILDTOOLS_VERSION=vs2019
)

REM ##########################################################################################
REM Set up CMake generator. Use Ninja if available.
REM ##########################################################################################
if not defined CMAKE_GEN (
set CMAKE_GEN=Visual Studio 16 2019
for /f "tokens=*" %%F in ('where ninja') do (
set NINJA=%%F
)
if defined VCPKG_ROOT (
if not defined NINJA (
for /f "tokens=*" %%F in ('where /R %VCPKG_ROOT%\vcpkg\downloads\tools ninja') do (
set NINJA=%%F
)
popd
)
)
for /f "tokens=*" %%F in ('where ninja') do (
set NINJA=%%F
)

if defined VCPKG_ROOT (
if not defined NINJA (
for /f "tokens=*" %%F in ('where /R %CD%\vcpkg\downloads\tools ninja') do (
for /f "tokens=*" %%F in ('where /R %VCPKG_ROOT%\vcpkg\downloads\tools ninja') do (
set NINJA=%%F
)
popd
)
if defined NINJA (
echo Using ninja at !NINJA!
)

if not defined NINJA (
for /f "tokens=*" %%F in ('where /R %CD%\vcpkg\downloads\tools ninja') do (
set NINJA=%%F
)
)

if defined NINJA (
echo Found ninja: !NINJA!
if not defined CMAKE_GEN (
set CMAKE_GEN=Ninja
)
)

if not defined CMAKE_GEN (
set CMAKE_GEN=Visual Studio 16 2019
)

set "ROOT=%~dp0\.."
if not defined ARCH (
set ARCH=x64
Expand Down Expand Up @@ -80,23 +87,18 @@ REM The following two configurations are built below:
REM - nostd - build with OpenTelemetry C++ Template library
REM - stl - build with Standard Template Library
REM ##########################################################################################
REM Build with nostd implementation. Supported VS_TOOLS_VERSION:
REM - vs2015 (C++11)
REM - vs2017 (C++14)
REM - vs2019 (C++20)
REM Build with nostd implementation.
REM ##########################################################################################
set CONFIG=-DWITH_STL:BOOL=OFF %*
set "OUTDIR=%ROOT%\out\%VS_TOOLS_VERSION%\nostd"
set "OUTDIR=%ROOT%\out\%BUILDTOOLS_VERSION%\nostd"
call :build_config

REM ##########################################################################################
REM Build with STL implementation (only for vs2017+). Supported VS_TOOLS_VERSION:
REM - vs2017 (C++14)
REM - vs2019 (C++20) - optimal config with all OpenTelemetry API classes using STL only.
REM Build with STL implementation. This option does not yield benefits for vs2015 build.
REM ##########################################################################################
if "%VS_TOOLS_VERSION%" neq "vs2015" (
if "%BUILDTOOLS_VERSION%" neq "vs2015" (
set CONFIG=-DWITH_STL:BOOL=ON %*
set "OUTDIR=%ROOT%\out\%VS_TOOLS_VERSION%\stl"
set "OUTDIR=%ROOT%\out\%BUILDTOOLS_VERSION%\stl"
call :build_config
)

Expand All @@ -110,18 +112,36 @@ REM TODO: consider rmdir for clean builds
if not exist "%OUTDIR%" mkdir "%OUTDIR%"
cd "%OUTDIR%"

if "!VS_TOOLS_VERSION!" == "vs2019" (
REM Prefer ninja if available
if "!CMAKE_GEN!" == "Ninja" (
call :build_config_ninja
exit /b
)
REM Only latest vs2019 generator supports and requires -A parameter
REM Prefer ninja if available
if "!CMAKE_GEN!" == "Ninja" (
call :build_config_ninja
exit /b
)

if "!BUILDTOOLS_VERSION!" == "vs2015" (
cmake -G "!CMAKE_GEN!" -A !ARCH! -DCMAKE_TOOLCHAIN_FILE="!VCPKG_CMAKE!" !CONFIG! "!ROOT!"
) else (
REM Old vs2017 generator does not support -A parameter
cmake -G "!CMAKE_GEN!" -DCMAKE_TOOLCHAIN_FILE="!VCPKG_CMAKE!" !CONFIG! "!ROOT!"
call :build_msbuild
exit /b
)

if "!BUILDTOOLS_VERSION!" == "vs2017" (
cmake -G "!CMAKE_GEN!" -A !ARCH! -DCMAKE_TOOLCHAIN_FILE="!VCPKG_CMAKE!" !CONFIG! "!ROOT!"
call :build_msbuild
exit /b
)

if "!BUILDTOOLS_VERSION!" == "vs2019" (
cmake -G "!CMAKE_GEN!" -A !ARCH! -DCMAKE_TOOLCHAIN_FILE="!VCPKG_CMAKE!" !CONFIG! "!ROOT!"
call :build_msbuild
exit /b
)

REM ##########################################################################################
REM Exotic CMake generators, like MSYS and MinGW MAY work, but untested
REM ##########################################################################################
cmake -G "!CMAKE_GEN!" -DCMAKE_TOOLCHAIN_FILE="!VCPKG_CMAKE!" !CONFIG! "!ROOT!"

:build_msbuild
set "SOLUTION=%OUTDIR%\opentelemetry-cpp.sln"
msbuild "%SOLUTION%" /p:Configuration=Release /p:VcpkgEnabled=true
exit /b
Expand Down
4 changes: 0 additions & 4 deletions tools/ports/benchmark/portfile.cmake
Original file line number Diff line number Diff line change
@@ -1,11 +1,7 @@
if (VCPKG_PLATFORM_TOOLSET STREQUAL "v140")
# set(CMAKE_C_COMPILER_WORKS 1)
# set(CMAKE_CXX_COMPILER_WORKS 1)
set(CMAKE_C_COMPILER cl.exe)
set(CMAKE_CXX_COMPILER cl.exe)
set(MSVC_TOOLSET_VERSION 140)
# set(VCPKG_VISUAL_STUDIO_PATH "C:\\Program Files (x86)\\Microsoft Visual Studio 14.0")
# set(VCPKG_PLATFORM_TOOLSET v140)
else()
# Make sure vs2019 compiled binaries are compat with vs2017
set(VCPKG_CXX_FLAGS "/Zc:__cplusplus /d2FH4-")
Expand Down
20 changes: 13 additions & 7 deletions tools/setup-buildtools.cmd
Original file line number Diff line number Diff line change
@@ -1,8 +1,12 @@
@echo off
setlocal enableextensions
setlocal enabledelayedexpansion
set "PATH=%ProgramFiles%\CMake\bin;%~dp0;%~dp0vcpkg;%ProgramData%\chocolatey\bin;%PATH%"
if "%VCPKG_ROOT%" NEQ "" set "PATH=%VCPKG_ROOT%;%PATH%"
set "PATH=%ProgramFiles%\CMake\bin;%~dp0;%ProgramData%\chocolatey\bin;%PATH%"
if defined VCPKG_ROOT (
set "PATH=%VCPKG_ROOT%;%PATH%"
) else (
set "PATH=%~dp0vcpkg;%PATH%"
)
pushd %~dp0

net session >nul 2>&1
Expand All @@ -22,11 +26,13 @@ if %errorLevel% == 0 (
echo Running without Administrative privilege...
)

REM Print current Visual Studio installations detected
where /Q vswhere
if %ERRORLEVEL% == 0 (
echo Visual Studio installations detected:
vswhere -property installationPath
if not defined BUILDTOOLS_VERSION (
REM Print current Visual Studio installations detected
where /Q vswhere
if %ERRORLEVEL% == 0 (
echo Visual Studio installations detected:
vswhere -property installationPath
)
)

REM This script allows to pass architecture in ARCH env var
Expand Down
52 changes: 46 additions & 6 deletions tools/vcvars.cmd
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
@echo off
REM +-------------------------------------------------------------------+
REM | Autodetect and set up the build environment for Visual Studio. |
REM | Visual Studio version may be specified as 1st argument. |
REM | Autodetect and set up the build environment. |
REM | Build Tools version may be specified as 1st argument. |
REM +-------------------------------------------------------------------+
REM | Description | Argument value |
REM +-----------------------------------------+-------------------------+
Expand All @@ -18,6 +18,12 @@ REM | Visual Studio 2017 Community | vs2017_community |
REM | Visual Studio 2017 Build Tools (no IDE) | vs2017_buildtools |
REM | | |
REM | Visual Studio 2015 Build Tools (no IDE) | vs2015 |
REM | | |
REM | LLVM Clang (any version) | clang |
REM | LLVM Clang 9 | clang-9 |
REM | LLVM Clang 10 | clang-10 |
REM | LLVM Clang 11 | clang-11 |
REM | LLVM Clang 11 | clang-12 |
REM +-----------------------------------------+-------------------------+
set "VSCMD_START_DIR=%CD%"

Expand All @@ -29,8 +35,8 @@ if "%1" neq "" (
goto %1
)

if defined VS_TOOLS_VERSION (
goto %VS_TOOLS_VERSION%
if defined BUILDTOOLS_VERSION (
goto %BUILDTOOLS_VERSION%
)

:vs2019
Expand Down Expand Up @@ -100,10 +106,10 @@ if exist %TOOLS_VS2017% (
)

:vs2015
set TOOLS_VS2015="%ProgramFiles(x86)%\Microsoft Visual Studio 14.0\VC\bin\vcvarsall.bat"
set TOOLS_VS2015="%ProgramFiles(x86)%\Microsoft Visual Studio 14.0\VC\vcvarsall.bat"
if exist %TOOLS_VS2015% (
echo Building with vs2015 BuildTools...
call %TOOLS_VS2015% %ARCH%
call %TOOLS_VS2015% %ARCH% %WINSDK_VERSION%
set "VCPKG_VISUAL_STUDIO_PATH=%ProgramFiles(x86)%\Microsoft Visual Studio 14.0"
set VCPKG_PLATFORM_TOOLSET=v140
goto tools_configured
Expand All @@ -115,4 +121,38 @@ REM is not set up by checking TOOLS_VS_NOTFOUND
set TOOLS_VS_NOTFOUND=1
exit /b 0

REM +-------------------------------------------------------------------+
REM | There is no auto-detection of LLVM Clang version. |
REM | LLVM Clang of any version is installed in the same directory |
REM | at %ProgramFiles%\LLVM\bin . Developers choose their own custom |
REM | layout for installing multiple clang toolchains side-by-side. |
REM | |
REM | Example layout (merely a guideline, layout could differ): |
REM | |
REM | %ProgramFiles%\LLVM-9\bin |
REM | %ProgramFiles%\LLVM-10\bin |
REM | %ProgramFiles%\LLVM-11\bin |
REM | %ProgramFiles%\LLVM-12\bin |
REM +-------------------------------------------------------------------+
REM
REM ## Example 1: use clang-10 located in LLVM-10 directory:
REM set BUILDTOOLS_VERSION=clang-10
REM set "PATH=%ProgramFiles%\LLVM-10\bin;%PATH%"
REM tools\build.cmd
REM
REM ## Example 2: use whatever clang located in LLVM directory:
REM set BUILDTOOLS_VERSION=clang
REM set "PATH=%ProgramFiles%\LLVM\bin;%PATH%"
REM tools\build.cmd
REM
REM BUILDTOOLS_VERSION determines the output directory location.
REM Store build artifacts produced by different toolchains -
REM side-by-side, each in its own separate output directory.
REM
:clang
:clang-9
:clang-10
:clang-11
:clang-12

:tools_configured