Update of environment files
[occt.git] / adm / templates / env.bat.in
CommitLineData
ad211ad3 1echo off
2
3set "SCRIPTROOT=%~dp0"
4set "SCRIPTROOT=%SCRIPTROOT:~0,-1%"
5
4b3541c6 6rem ----- Reset values to defaults -----
32856b63 7set "VCVER=@COMPILER@"
8set "ARCH=@COMPILER_BITNESS@"
4b3541c6 9set "CASDEB="
a0726e55 10
32856b63 11if not ["%1"] == [""] set "VCVER=%1"
12if not ["%2"] == [""] set "ARCH=%2"
13if /I ["%ARCH%"] == ["win32"] set "ARCH=32"
14if /I ["%ARCH%"] == ["win64"] set "ARCH=64"
15if /I ["%3"] == ["debug"] set "CASDEB=d"
16if /I ["%3"] == ["d"] set "CASDEB=d"
316d77d9 17if /I ["%3"] == ["i"] set "CASDEB=i"
18if /I ["%3"] == ["relwithdeb"] set "CASDEB=i"
ad211ad3 19
da67ffb7 20rem ----- Decode VCVER variable and define related ones -----
21rem
22rem VCFMT - "vc" followed by full version number of Visual Studio toolset
23rem (same as VCVER without optional suffix "-uwp")
24rem VCLIB - name of folder contining binaries
25rem (same as VCVER except without third version in number)
26rem VCPROP - name of required Visual Studion Workload (starting with VS 2017)
27rem
28rem Note that for VS before 2015 (vc14) always
29rem VCFMT=VCLIB=VCVER and VCPROP=NativeDesktop
30
31rem Since VS 2017, environment variables like VS100COMNTOOLS are not defined
32rem any more, we can only use vswhere.exe tool to find Visual Studio.
33rem Add path to vswhere.exe
c0f08310 34if /I not "%VCFMT%" == "gcc" (
35 set "PATH=%PATH%;%ProgramFiles(x86)%\Microsoft Visual Studio\Installer"
36)
da67ffb7 37
38rem for vc10-12, interpretation is trivial
39set VCFMT=%VCVER%
40set VCLIB=%VCVER:~0,4%
41set VCPROP=NativeDesktop
42rem vc14 and later can have optional suffix "-uwp"
43if "%VCVER:~-4%" == "-uwp" (
44 set VCFMT=%VCVER:~0,-4%
45 set VCLIB=%VCLIB%-uwp
46 set VCPROP=Universal
47)
48rem echo VCVER=%VCVER% VCFMT=%VCFMT% VCLIB=%VCLIB% VCPROP=%VCPROP%
49
50rem ----- Parsing of Visual Studio platform -----
51set "VisualStudioExpressName=VCExpress"
52
53if not "%DevEnvDir%" == "" (
54 rem If DevEnvDir is already defined (e.g. in custom.bat), use that value
71c810df 55) else if /I "%VCFMT%" == "vc9" (
56 set "DevEnvDir=%VS90COMNTOOLS%..\IDE"
da67ffb7 57) else if /I "%VCFMT%" == "vc10" (
58 set "DevEnvDir=%VS100COMNTOOLS%..\IDE"
59) else if /I "%VCFMT%" == "vc11" (
60 set "DevEnvDir=%VS110COMNTOOLS%..\IDE"
61 rem Visual Studio Express starting from VS 2012 is called "for Windows Desktop"
62 rem and has a new name for executable - WDExpress
63 set "VisualStudioExpressName=WDExpress"
64) else if /I "%VCFMT%" == "vc12" (
65 set "DevEnvDir=%VS120COMNTOOLS%..\IDE"
66 set "VisualStudioExpressName=WDExpress"
67) else if /I "%VCFMT%" == "vc14" (
68 set "DevEnvDir=%VS140COMNTOOLS%..\IDE"
69) else if /I "%VCFMT%" == "vc141" (
70 for /f "usebackq delims=" %%i in (`vswhere.exe -version "[15.0,15.99]" -requires Microsoft.VisualStudio.Workload.%VCPROP% -property installationPath`) do (
71 set "DevEnvDir=%%i\Common7\IDE\"
72 )
d9619512 73) else if /I "%VCFMT%" == "vc142" (
74 for /f "usebackq delims=" %%i in (`vswhere.exe -version "[16.0,16.99]" -latest -requires Microsoft.VisualStudio.Workload.%VCPROP% -property installationPath`) do (
75 set "DevEnvDir=%%i\Common7\IDE\"
76 )
c0f08310 77) else if /I "%VCFMT%" == "gcc" (
78 rem MinGW
da67ffb7 79) else (
80 echo Error: wrong VS identifier
81 exit /B
82)
83
84rem ----- Parsing vcvarsall for qt samples and define PlatformToolset -----
71c810df 85if /I "%VCFMT%" == "vc9" (
86 set "VCVARS=%VS90COMNTOOLS%..\..\VC\vcvarsall.bat"
87 set "VCPlatformToolSet=v90"
88) else if /I "%VCFMT%" == "vc10" (
da67ffb7 89 set "VCVARS=%VS100COMNTOOLS%..\..\VC\vcvarsall.bat"
90 set "VCPlatformToolSet=v100"
91) else if /I "%VCFMT%" == "vc11" (
92 set "VCVARS=%VS110COMNTOOLS%..\..\VC\vcvarsall.bat"
93 set "VCPlatformToolSet=v110"
94) else if /I "%VCFMT%" == "vc12" (
95 set "VCVARS=%VS120COMNTOOLS%..\..\VC\vcvarsall.bat"
96 set "VCPlatformToolSet=v120"
97) else if /I "%VCFMT%" == "vc14" (
98 set "VCVARS=%VS140COMNTOOLS%..\..\VC\vcvarsall.bat"
99 set "VCPlatformToolSet=v140"
100) else if /I "%VCFMT%" == "vc141" (
101 for /f "usebackq delims=" %%i in (`vswhere.exe -version "[15.0,15.99]" -requires Microsoft.VisualStudio.Workload.%VCPROP% -property installationPath`) do (
102 set "VCVARS=%%i\VC\Auxiliary\Build\vcvarsall.bat"
103 )
104 set "VCPlatformToolSet=v141"
d9619512 105) else if /I "%VCFMT%" == "vc142" (
106 for /f "usebackq delims=" %%i in (`vswhere.exe -version "[16.0,16.99]" -latest -requires Microsoft.VisualStudio.Workload.%VCPROP% -property installationPath`) do (
107 set "VCVARS=%%i\VC\Auxiliary\Build\vcvarsall.bat"
108 )
109 set "VCPlatformToolSet=v142"
c0f08310 110) else if /I "%VCFMT%" == "gcc" (
111 rem MinGW
da67ffb7 112) else (
113 echo Error: first argument ^(%VCVER%^) should specify supported version of Visual C++,
114 echo one of: vc10 ^(VS 2010 SP3^), vc11 ^(VS 2012 SP3^), vc12 ^(VS 2013^) or vc14 ^(VS 2015^)
115 exit
116)
117
249dd6ed 118rem ----- For compatability with external application using CASROOT -----
119if ["%CASROOT%"] == [""] set "CASROOT=%SCRIPTROOT%"
120
121rem ----- Define path to 3rdparty products -----
122set "THIRDPARTY_DIR=@3RDPARTY_DIR@"
123
da67ffb7 124if ["%ARCH%"] == ["32"] set VCARCH=x86
125if ["%ARCH%"] == ["64"] set VCARCH=amd64
126
127if /I ["%1"] == ["vc141"] set "VCVER=vc14"
249dd6ed 128if exist "%CASROOT%\custom.bat" (
129 call "%CASROOT%\custom.bat" %VCVER% %ARCH% %CASDEB%
32856b63 130)
ad211ad3 131
0a66e59d 132if not ["%TCL_DIR%"] == [""] set "PATH=%TCL_DIR%;%PATH%"
82f443b6 133if not ["%TK_DIR%"] == [""] set "PATH=%TK_DIR%;%PATH%"
0a66e59d 134if not ["%FREETYPE_DIR%"] == [""] set "PATH=%FREETYPE_DIR%;%PATH%"
135if not ["%FREEIMAGE_DIR%"] == [""] set "PATH=%FREEIMAGE_DIR%;%PATH%"
1ce0716b 136if not ["%EGL_DIR%"] == [""] set "PATH=%EGL_DIR%;%PATH%"
137if not ["%GLES2_DIR%"] == [""] set "PATH=%GLES2_DIR%;%PATH%"
0a66e59d 138if not ["%TBB_DIR%"] == [""] set "PATH=%TBB_DIR%;%PATH%"
139if not ["%VTK_DIR%"] == [""] set "PATH=%VTK_DIR%;%PATH%"
08f8a185 140if not ["%FFMPEG_DIR%"] == [""] set "PATH=%FFMPEG_DIR%;%PATH%"
14bbbdcb 141if not ["%QTDIR%"] == [""] set "PATH=%QTDIR%/bin;%PATH%"
ad211ad3 142
143rem ----- Set path to 3rd party and OCCT libraries -----
4b3541c6 144if not "%CSF_OCCTBinPath%" == "" (
145 set "PATH=%CSF_OCCTBinPath%;%PATH%"
146)
147
82f443b6 148if not ["%TK_DIR%"] == ["%TCL_DIR%"] (
4b3541c6 149 if not ["%TK_DIR%"] == [""] set "TK_LIBRARY=%TK_DIR%/../lib/tk%TK_VERSION_WITH_DOT%"
150 if not ["%TCL_DIR%"] == [""] set "TCL_LIBRARY=%TCL_DIR%/../lib/tcl%TCL_VERSION_WITH_DOT%"
82f443b6 151)
ad211ad3 152
153rem ----- Set envoronment variables used by OCCT -----
154set CSF_LANGUAGE=us
155set MMGT_CLEAR=1
4b3541c6 156set "CSF_SHMessage=%CSF_OCCTResourcePath%\SHMessage"
157set "CSF_MDTVTexturesDirectory=%CSF_OCCTResourcePath%\Textures"
158set "CSF_ShadersDirectory=%CSF_OCCTResourcePath%\Shaders"
159set "CSF_XSMessage=%CSF_OCCTResourcePath%\XSMessage"
160set "CSF_TObjMessage=%CSF_OCCTResourcePath%\TObj"
161set "CSF_StandardDefaults=%CSF_OCCTResourcePath%\StdResource"
162set "CSF_PluginDefaults=%CSF_OCCTResourcePath%\StdResource"
163set "CSF_XCAFDefaults=%CSF_OCCTResourcePath%\StdResource"
164set "CSF_TObjDefaults=%CSF_OCCTResourcePath%\StdResource"
165set "CSF_StandardLiteDefaults=%CSF_OCCTResourcePath%\StdResource"
4b3541c6 166set "CSF_IGESDefaults=%CSF_OCCTResourcePath%\XSTEPResource"
167set "CSF_STEPDefaults=%CSF_OCCTResourcePath%\XSTEPResource"
168set "CSF_XmlOcafResource=%CSF_OCCTResourcePath%\XmlOcafResource"
169set "CSF_MIGRATION_TYPES=%CSF_OCCTResourcePath%\StdResource\MigrationSheet.txt"
ad211ad3 170
249dd6ed 171rem ----- Draw Harness special stuff -----
4b3541c6 172if exist "%CSF_OCCTResourcePath%\DrawResources" (
173 set "DRAWHOME=%CSF_OCCTResourcePath%\DrawResources"
174 set "CSF_DrawPluginDefaults=%CSF_OCCTResourcePath%\DrawResources"
ad211ad3 175
4b3541c6 176 if exist "%CSF_OCCTResourcePath%\DrawResources\DrawDefault" (
177 set "DRAWDEFAULT=%CSF_OCCTResourcePath%\DrawResources\DrawDefault"
a0726e55 178 )
ad211ad3 179)