0028824: Possibility to build OCCT 7.1.0 and above using Visual Studio 2008
[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 )
c0f08310 73) else if /I "%VCFMT%" == "gcc" (
74 rem MinGW
da67ffb7 75) else (
76 echo Error: wrong VS identifier
77 exit /B
78)
79
80rem ----- Parsing vcvarsall for qt samples and define PlatformToolset -----
71c810df 81if /I "%VCFMT%" == "vc9" (
82 set "VCVARS=%VS90COMNTOOLS%..\..\VC\vcvarsall.bat"
83 set "VCPlatformToolSet=v90"
84) else if /I "%VCFMT%" == "vc10" (
da67ffb7 85 set "VCVARS=%VS100COMNTOOLS%..\..\VC\vcvarsall.bat"
86 set "VCPlatformToolSet=v100"
87) else if /I "%VCFMT%" == "vc11" (
88 set "VCVARS=%VS110COMNTOOLS%..\..\VC\vcvarsall.bat"
89 set "VCPlatformToolSet=v110"
90) else if /I "%VCFMT%" == "vc12" (
91 set "VCVARS=%VS120COMNTOOLS%..\..\VC\vcvarsall.bat"
92 set "VCPlatformToolSet=v120"
93) else if /I "%VCFMT%" == "vc14" (
94 set "VCVARS=%VS140COMNTOOLS%..\..\VC\vcvarsall.bat"
95 set "VCPlatformToolSet=v140"
96) else if /I "%VCFMT%" == "vc141" (
97 for /f "usebackq delims=" %%i in (`vswhere.exe -version "[15.0,15.99]" -requires Microsoft.VisualStudio.Workload.%VCPROP% -property installationPath`) do (
98 set "VCVARS=%%i\VC\Auxiliary\Build\vcvarsall.bat"
99 )
100 set "VCPlatformToolSet=v141"
c0f08310 101) else if /I "%VCFMT%" == "gcc" (
102 rem MinGW
da67ffb7 103) else (
104 echo Error: first argument ^(%VCVER%^) should specify supported version of Visual C++,
105 echo one of: vc10 ^(VS 2010 SP3^), vc11 ^(VS 2012 SP3^), vc12 ^(VS 2013^) or vc14 ^(VS 2015^)
106 exit
107)
108
249dd6ed 109rem ----- For compatability with external application using CASROOT -----
110if ["%CASROOT%"] == [""] set "CASROOT=%SCRIPTROOT%"
111
112rem ----- Define path to 3rdparty products -----
113set "THIRDPARTY_DIR=@3RDPARTY_DIR@"
114
da67ffb7 115if ["%ARCH%"] == ["32"] set VCARCH=x86
116if ["%ARCH%"] == ["64"] set VCARCH=amd64
117
118if /I ["%1"] == ["vc141"] set "VCVER=vc14"
249dd6ed 119if exist "%CASROOT%\custom.bat" (
120 call "%CASROOT%\custom.bat" %VCVER% %ARCH% %CASDEB%
32856b63 121)
ad211ad3 122
0a66e59d 123if not ["%TCL_DIR%"] == [""] set "PATH=%TCL_DIR%;%PATH%"
82f443b6 124if not ["%TK_DIR%"] == [""] set "PATH=%TK_DIR%;%PATH%"
0a66e59d 125if not ["%FREETYPE_DIR%"] == [""] set "PATH=%FREETYPE_DIR%;%PATH%"
126if not ["%FREEIMAGE_DIR%"] == [""] set "PATH=%FREEIMAGE_DIR%;%PATH%"
1ce0716b 127if not ["%EGL_DIR%"] == [""] set "PATH=%EGL_DIR%;%PATH%"
128if not ["%GLES2_DIR%"] == [""] set "PATH=%GLES2_DIR%;%PATH%"
0a66e59d 129if not ["%GL2PS_DIR%"] == [""] set "PATH=%GL2PS_DIR%;%PATH%"
130if not ["%TBB_DIR%"] == [""] set "PATH=%TBB_DIR%;%PATH%"
131if not ["%VTK_DIR%"] == [""] set "PATH=%VTK_DIR%;%PATH%"
08f8a185 132if not ["%FFMPEG_DIR%"] == [""] set "PATH=%FFMPEG_DIR%;%PATH%"
14bbbdcb 133if not ["%QTDIR%"] == [""] set "PATH=%QTDIR%/bin;%PATH%"
ad211ad3 134
135rem ----- Set path to 3rd party and OCCT libraries -----
4b3541c6 136if not "%CSF_OCCTBinPath%" == "" (
137 set "PATH=%CSF_OCCTBinPath%;%PATH%"
138)
139
82f443b6 140if not ["%TK_DIR%"] == ["%TCL_DIR%"] (
4b3541c6 141 if not ["%TK_DIR%"] == [""] set "TK_LIBRARY=%TK_DIR%/../lib/tk%TK_VERSION_WITH_DOT%"
142 if not ["%TCL_DIR%"] == [""] set "TCL_LIBRARY=%TCL_DIR%/../lib/tcl%TCL_VERSION_WITH_DOT%"
82f443b6 143)
ad211ad3 144
145rem ----- Set envoronment variables used by OCCT -----
146set CSF_LANGUAGE=us
147set MMGT_CLEAR=1
4b3541c6 148set "CSF_SHMessage=%CSF_OCCTResourcePath%\SHMessage"
149set "CSF_MDTVTexturesDirectory=%CSF_OCCTResourcePath%\Textures"
150set "CSF_ShadersDirectory=%CSF_OCCTResourcePath%\Shaders"
151set "CSF_XSMessage=%CSF_OCCTResourcePath%\XSMessage"
152set "CSF_TObjMessage=%CSF_OCCTResourcePath%\TObj"
153set "CSF_StandardDefaults=%CSF_OCCTResourcePath%\StdResource"
154set "CSF_PluginDefaults=%CSF_OCCTResourcePath%\StdResource"
155set "CSF_XCAFDefaults=%CSF_OCCTResourcePath%\StdResource"
156set "CSF_TObjDefaults=%CSF_OCCTResourcePath%\StdResource"
157set "CSF_StandardLiteDefaults=%CSF_OCCTResourcePath%\StdResource"
4b3541c6 158set "CSF_IGESDefaults=%CSF_OCCTResourcePath%\XSTEPResource"
159set "CSF_STEPDefaults=%CSF_OCCTResourcePath%\XSTEPResource"
160set "CSF_XmlOcafResource=%CSF_OCCTResourcePath%\XmlOcafResource"
161set "CSF_MIGRATION_TYPES=%CSF_OCCTResourcePath%\StdResource\MigrationSheet.txt"
ad211ad3 162
249dd6ed 163rem ----- Draw Harness special stuff -----
4b3541c6 164if exist "%CSF_OCCTResourcePath%\DrawResources" (
165 set "DRAWHOME=%CSF_OCCTResourcePath%\DrawResources"
166 set "CSF_DrawPluginDefaults=%CSF_OCCTResourcePath%\DrawResources"
ad211ad3 167
4b3541c6 168 if exist "%CSF_OCCTResourcePath%\DrawResources\DrawDefault" (
169 set "DRAWDEFAULT=%CSF_OCCTResourcePath%\DrawResources\DrawDefault"
a0726e55 170 )
ad211ad3 171)