0028920: Samples - fix msvc.bat for building samples without CMake
[occt.git] / adm / vcver.bat
1 @echo off
2 rem Decode VCVER variable and define related ones:
3 rem
4 rem VCFMT - "vc" followed by full version number of Visual Studio toolset
5 rem         (same as VCVER without optional suffix "-uwp")
6 rem VCLIB - name of folder contining binaries
7 rem         (same as VCVER except without third version in number)
8 rem VCPROP - name of required Visual Studion Workload (starting with VS 2017)
9 rem
10 rem Note that for VS before 2015 (vc14) always
11 rem VCFMT=VCLIB=VCVER and VCPROP=NativeDesktop
12
13 rem Since VS 2017, environment variables like VS100COMNTOOLS are not defined 
14 rem any more, we can only use vswhere.exe tool to find Visual Studio.
15 rem Add path to vswhere.exe
16 set "PATH=%PATH%;%ProgramFiles(x86)%\Microsoft Visual Studio\Installer"
17
18 rem for vc10-12, interpretation is trivial
19 set VCFMT=%VCVER%
20 set VCLIB=%VCVER:~0,4%
21 set VCPROP=NativeDesktop
22
23 rem vc14 and later can have optional suffix "-uwp"
24 if "%VCVER:~-4%" == "-uwp" (
25   set VCFMT=%VCVER:~0,-4%
26   set VCLIB=%VCLIB%-uwp
27   set VCPROP=Universal
28 )
29
30 rem echo VCVER=%VCVER% VCFMT=%VCFMT% VCLIB=%VCLIB% VCPROP=%VCPROP%