• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1@ECHO OFF
2
3REM ~ Copyright 2002-2018 Rene Rivera.
4REM ~ Distributed under the Boost Software License, Version 1.0.
5REM ~ (See accompanying file LICENSE_1_0.txt or http://www.boost.org/LICENSE_1_0.txt)
6
7if "_%1_" == "_yacc_" goto Guess_Yacc
8if "_%1_" == "_test_path_" (
9    shift
10    goto Test_Path)
11goto Guess
12
13
14:Clear_Error
15ver >nul
16goto :eof
17
18
19:Test_Path
20REM Tests for the given executable file presence in the directories in the PATH
21REM environment variable. Additionally sets FOUND_PATH to the path of the
22REM found file.
23call :Clear_Error
24setlocal
25set test=%~$PATH:1
26endlocal
27if not errorlevel 1 set FOUND_PATH=%~dp$PATH:1
28goto :eof
29
30
31:Guess
32REM Let vswhere tell us where msvc is at, if available.
33call :Clear_Error
34call vswhere_usability_wrapper.cmd
35call :Clear_Error
36if NOT "_%VS160COMNTOOLS%_" == "__" (
37    set "B2_TOOLSET=vc142"
38    set "B2_TOOLSET_ROOT=%VS160COMNTOOLS%..\..\VC\"
39    goto :eof)
40if NOT "_%VS150COMNTOOLS%_" == "__" (
41    set "B2_TOOLSET=vc141"
42    set "B2_TOOLSET_ROOT=%VS150COMNTOOLS%..\..\VC\"
43    goto :eof)
44REM VSUNKCOMNTOOLS represents unknown but detected version from vswhere
45if NOT "_%VSUNKCOMNTOOLS%_" == "__" (
46    set "B2_TOOLSET=vcunk"
47    set "B2_TOOLSET_ROOT=%VSUNKCOMNTOOLS%..\..\VC\"
48    goto :eof)
49if EXIST "%VS_ProgramFiles%\Microsoft Visual Studio\2017\Enterprise\VC\Auxiliary\Build\vcvarsall.bat"  (
50    set "B2_TOOLSET=vc141"
51    set "B2_TOOLSET_ROOT=%VS_ProgramFiles%\Microsoft Visual Studio\2017\Enterprise\VC\"
52    exit /b 0)
53if EXIST "%VS_ProgramFiles%\Microsoft Visual Studio\2017\Professional\VC\Auxiliary\Build\vcvarsall.bat"  (
54    set "B2_TOOLSET=vc141"
55    set "B2_TOOLSET_ROOT=%VS_ProgramFiles%\Microsoft Visual Studio\2017\Professional\VC\"
56    exit /b 0)
57if EXIST "%VS_ProgramFiles%\Microsoft Visual Studio\2017\Community\VC\Auxiliary\Build\vcvarsall.bat"  (
58    set "B2_TOOLSET=vc141"
59    set "B2_TOOLSET_ROOT=%VS_ProgramFiles%\Microsoft Visual Studio\2017\Community\VC\"
60    exit /b 0)
61if NOT "_%VS140COMNTOOLS%_" == "__" (
62    set "B2_TOOLSET=vc14"
63    set "B2_TOOLSET_ROOT=%VS140COMNTOOLS%..\..\VC\"
64    exit /b 0)
65if EXIST "%VS_ProgramFiles%\Microsoft Visual Studio 14.0\VC\VCVARSALL.BAT" (
66    set "B2_TOOLSET=vc14"
67    set "B2_TOOLSET_ROOT=%VS_ProgramFiles%\Microsoft Visual Studio 14.0\VC\"
68    exit /b 0)
69if NOT "_%VS120COMNTOOLS%_" == "__" (
70    set "B2_TOOLSET=vc12"
71    set "B2_TOOLSET_ROOT=%VS120COMNTOOLS%..\..\VC\"
72    exit /b 0)
73if EXIST "%VS_ProgramFiles%\Microsoft Visual Studio 12.0\VC\VCVARSALL.BAT" (
74    set "B2_TOOLSET=vc12"
75    set "B2_TOOLSET_ROOT=%VS_ProgramFiles%\Microsoft Visual Studio 12.0\VC\"
76    exit /b 0)
77call :Test_Path cl.exe
78if not errorlevel 1 (
79    set "B2_TOOLSET=msvc"
80    set "B2_TOOLSET_ROOT=%FOUND_PATH%..\"
81    exit /b 0)
82call :Test_Path vcvars32.bat
83if not errorlevel 1 (
84    set "B2_TOOLSET=msvc"
85    call "%FOUND_PATH%VCVARS32.BAT"
86    set "B2_TOOLSET_ROOT=%MSVCDir%\"
87    exit /b 0)
88if EXIST "C:\Borland\BCC55\Bin\bcc32.exe" (
89    set "B2_TOOLSET=borland"
90    set "B2_TOOLSET_ROOT=C:\Borland\BCC55\"
91    exit /b 0)
92call :Test_Path bcc32.exe
93if not errorlevel 1 (
94    set "B2_TOOLSET=borland"
95    set "B2_TOOLSET_ROOT=%FOUND_PATH%..\"
96    exit /b 0)
97call :Test_Path icl.exe
98if not errorlevel 1 (
99    set "B2_TOOLSET=intel-win32"
100    set "B2_TOOLSET_ROOT=%FOUND_PATH%..\"
101    exit /b 0)
102if EXIST "C:\MinGW\bin\gcc.exe" (
103    set "B2_TOOLSET=mingw"
104    set "B2_TOOLSET_ROOT=C:\MinGW\"
105    exit /b 0)
106REM Could not find a suitable toolset
107exit /b 1
108