0029520: Visualization - drop deprecated V3d_View::Export() functionality and depende...
[occt.git] / adm / templates / env.bat
CommitLineData
910970ab 1@echo off
2
3rem Use:
4rem - first argument specifies version of Visual Studio (vc8, vc9, or vc10),
5rem - second argument specifies architecture (win32 or win64),
6rem - third argument specifies build mode (Debug or Release)
7rem Default options are:
8rem vc8 win32 Release
9
10set "SCRIPTROOT=%~dp0"
11set "SCRIPTROOT=%SCRIPTROOT:~0,-1%"
910970ab 12
13rem ----- Reset values to defaults -----
14set "CASDEB="
72c37458 15set "VCVER=vc10"
16set "ARCH=64"
910970ab 17set "VCVARS="
18set "HAVE_TBB=false"
19set "HAVE_OPENCL=false"
20set "HAVE_FREEIMAGE=false"
e22105a9 21set "HAVE_FFMPEG=false"
910970ab 22set "HAVE_VTK=false"
1ce0716b 23set "HAVE_GLES2=false"
f60111dc 24set "HAVE_D3D=false"
e22105a9 25set "HAVE_ZLIB=false"
26set "HAVE_LIBLZMA=false"
910970ab 27set "CSF_OPT_INC="
28set "CSF_OPT_LIB32="
29set "CSF_OPT_LIB64="
30set "CSF_OPT_BIN32="
31set "CSF_OPT_BIN64="
32
e31a8e52 33if not ["%CASROOT%"] == [""] if exist "%SCRIPTROOT%\%CASROOT%" set "CASROOT=%SCRIPTROOT%\%CASROOT%"
34if ["%CASROOT%"] == [""] set "CASROOT=%SCRIPTROOT%"
35
249dd6ed 36rem ----- Load local settings -----
37if exist "%CASROOT%\custom.bat" (
38 call "%CASROOT%\custom.bat" %1 %2 %3 %4 %5
39)
40
910970ab 41rem ----- Read script arguments (override local settings) -----
42if not ["%1"] == [""] set "VCVER=%1"
43if not ["%2"] == [""] set "ARCH=%2"
44if /I ["%ARCH%"] == ["win32"] set "ARCH=32"
45if /I ["%ARCH%"] == ["win64"] set "ARCH=64"
46if /I ["%3"] == ["debug"] set "CASDEB=d"
47if /I ["%3"] == ["d"] set "CASDEB=d"
316d77d9 48if /I ["%3"] == ["i"] set "CASDEB=i"
49if /I ["%3"] == ["relwithdeb"] set "CASDEB=i"
910970ab 50
249dd6ed 51rem Decode VCVER variable and define related ones:
52rem
53rem VCFMT - "vc" followed by full version number of Visual Studio toolset
54rem (same as VCVER without optional suffix "-uwp")
55rem VCLIB - name of folder contining binaries
56rem (same as VCVER except without third version in number)
57rem VCPROP - name of required Visual Studion Workload (starting with VS 2017)
58rem
59rem Note that for VS before 2015 (vc14) always
60rem VCFMT=VCLIB=VCVER and VCPROP=NativeDesktop
61
62rem Since VS 2017, environment variables like VS100COMNTOOLS are not defined
63rem any more, we can only use vswhere.exe tool to find Visual Studio.
64rem Add path to vswhere.exe
65set "PATH=%PATH%;%ProgramFiles(x86)%\Microsoft Visual Studio\Installer"
66
67rem for vc10-12, interpretation is trivial
68set VCFMT=%VCVER%
69set VCLIB=%VCVER:~0,4%
70set VCPROP=NativeDesktop
71rem vc14 and later can have optional suffix "-uwp"
72if "%VCVER:~-4%" == "-uwp" (
73 set VCFMT=%VCVER:~0,-4%
74 set VCLIB=%VCLIB%-uwp
75 set VCPROP=Universal
76)
77rem echo VCVER=%VCVER% VCFMT=%VCFMT% VCLIB=%VCLIB% VCPROP=%VCPROP%
d6cda17a 78
48691eaa 79rem ----- Parsing of Visual Studio platform -----
80set "VisualStudioExpressName=VCExpress"
81
82if not "%DevEnvDir%" == "" (
83 rem If DevEnvDir is already defined (e.g. in custom.bat), use that value
71c810df 84) else if /I "%VCFMT%" == "vc9" (
85 set "DevEnvDir=%VS90COMNTOOLS%..\IDE"
48691eaa 86) else if /I "%VCFMT%" == "vc10" (
87 set "DevEnvDir=%VS100COMNTOOLS%..\IDE"
88) else if /I "%VCFMT%" == "vc11" (
89 set "DevEnvDir=%VS110COMNTOOLS%..\IDE"
90 rem Visual Studio Express starting from VS 2012 is called "for Windows Desktop"
91 rem and has a new name for executable - WDExpress
92 set "VisualStudioExpressName=WDExpress"
93) else if /I "%VCFMT%" == "vc12" (
94 set "DevEnvDir=%VS120COMNTOOLS%..\IDE"
95 set "VisualStudioExpressName=WDExpress"
96) else if /I "%VCFMT%" == "vc14" (
97 set "DevEnvDir=%VS140COMNTOOLS%..\IDE"
98) else if /I "%VCFMT%" == "vc141" (
99 for /f "usebackq delims=" %%i in (`vswhere.exe -version "[15.0,15.99]" -requires Microsoft.VisualStudio.Workload.%VCPROP% -property installationPath`) do (
100 set "DevEnvDir=%%i\Common7\IDE\"
101 )
c0f08310 102) else if /I "%VCFMT%" == "gcc" (
103 rem MinGW
48691eaa 104) else (
71c810df 105 echo Error: first argument ^(%VCVER%^) should specify supported version of Visual C++,
106 echo one of:
107 echo vc9 = VS 2008 ^(SP1^)
108 echo vc10 = VS 2010 ^(SP3^)
109 echo vc11 = VS 2012 ^(SP3^)
110 echo vc12 = VS 2013 ^(SP3^)
111 echo vc14 = VS 2015
112 echo vc141 = VS 2017
48691eaa 113 exit /B
114)
115
116rem ----- Parsing vcvarsall for qt samples and define PlatformToolset -----
71c810df 117if /I "%VCFMT%" == "vc9" (
118 set "VCVARS=%VS90COMNTOOLS%..\..\VC\vcvarsall.bat"
119 set "VCPlatformToolSet=v90"
120) else if /I "%VCFMT%" == "vc10" (
48691eaa 121 set "VCVARS=%VS100COMNTOOLS%..\..\VC\vcvarsall.bat"
122 set "VCPlatformToolSet=v100"
123) else if /I "%VCFMT%" == "vc11" (
124 set "VCVARS=%VS110COMNTOOLS%..\..\VC\vcvarsall.bat"
125 set "VCPlatformToolSet=v110"
126) else if /I "%VCFMT%" == "vc12" (
127 set "VCVARS=%VS120COMNTOOLS%..\..\VC\vcvarsall.bat"
128 set "VCPlatformToolSet=v120"
129) else if /I "%VCFMT%" == "vc14" (
130 set "VCVARS=%VS140COMNTOOLS%..\..\VC\vcvarsall.bat"
131 set "VCPlatformToolSet=v140"
132) else if /I "%VCFMT%" == "vc141" (
133 for /f "usebackq delims=" %%i in (`vswhere.exe -version "[15.0,15.99]" -requires Microsoft.VisualStudio.Workload.%VCPROP% -property installationPath`) do (
134 set "VCVARS=%%i\VC\Auxiliary\Build\vcvarsall.bat"
135 )
136 set "VCPlatformToolSet=v141"
c0f08310 137) else if /I "%VCFMT%" == "gcc" (
138 rem MinGW
48691eaa 139) else (
71c810df 140 echo Error: wrong VS identifier
141 exit /B
48691eaa 142)
143
72c37458 144set "CSF_OPT_LIB32D=%CSF_OPT_LIB32%"
145set "CSF_OPT_LIB64D=%CSF_OPT_LIB64%"
146set "CSF_OPT_BIN32D=%CSF_OPT_BIN32%"
147set "CSF_OPT_BIN64D=%CSF_OPT_BIN64%"
148set "CSF_OPT_LIB32I=%CSF_OPT_LIB32%"
149set "CSF_OPT_LIB64I=%CSF_OPT_LIB64%"
150set "CSF_OPT_BIN32I=%CSF_OPT_BIN32%"
151set "CSF_OPT_BIN64I=%CSF_OPT_BIN64%"
910970ab 152
153rem ----- Optional 3rd-parties should be enabled by HAVE macros -----
154set "CSF_OPT_CMPL="
155set "PRODUCTS_DEFINES="
e22105a9 156if ["%HAVE_TBB%"] == ["true"] set "PRODUCTS_DEFINES=%PRODUCTS_DEFINES% -DHAVE_TBB" & set "CSF_DEFINES=HAVE_TBB;%CSF_DEFINES%"
157if ["%HAVE_OPENCL%"] == ["true"] set "PRODUCTS_DEFINES=%PRODUCTS_DEFINES% -DHAVE_OPENCL" & set "CSF_DEFINES=HAVE_OPENCL;%CSF_DEFINES%"
e22105a9 158if ["%HAVE_FREEIMAGE%"] == ["true"] set "PRODUCTS_DEFINES=%PRODUCTS_DEFINES% -DHAVE_FREEIMAGE" & set "CSF_DEFINES=HAVE_FREEIMAGE;%CSF_DEFINES%"
159if ["%HAVE_FFMPEG%"] == ["true"] set "PRODUCTS_DEFINES=%PRODUCTS_DEFINES% -DHAVE_FFMPEG" & set "CSF_DEFINES=HAVE_FFMPEG;%CSF_DEFINES%"
160if ["%HAVE_VTK%"] == ["true"] set "PRODUCTS_DEFINES=%PRODUCTS_DEFINES% -DHAVE_VTK" & set "CSF_DEFINES=HAVE_VTK;%CSF_DEFINES%"
161if ["%HAVE_GLES2%"] == ["true"] set "PRODUCTS_DEFINES=%PRODUCTS_DEFINES% -DHAVE_GLES2" & set "CSF_DEFINES=HAVE_GLES2;%CSF_DEFINES%"
162if ["%HAVE_D3D%"] == ["true"] set "PRODUCTS_DEFINES=%PRODUCTS_DEFINES% -DHAVE_D3D" & set "CSF_DEFINES=HAVE_D3D;%CSF_DEFINES%"
163if ["%HAVE_ZLIB%"] == ["true"] set "PRODUCTS_DEFINES=%PRODUCTS_DEFINES% -DHAVE_ZLIB" & set "CSF_DEFINES=HAVE_ZLIB;%CSF_DEFINES%"
164if ["%HAVE_LIBLZMA%"] == ["true"] set "PRODUCTS_DEFINES=%PRODUCTS_DEFINES% -DHAVE_LIBLZMA" & set "CSF_DEFINES=HAVE_LIBLZMA;%CSF_DEFINES%"
910970ab 165
166rem Eliminate VS warning
167if ["%CSF_DEFINES%"] == [""] set "CSF_DEFINES=;"
168
169rem ----- Optional 3rd-parties should be enabled by HAVE macros -----
170if not ["%PRODUCTS_DEFINES%"] == [""] set "CSF_OPT_CMPL=%CSF_OPT_CMPL% %PRODUCTS_DEFINES%"
171
172rem ----- Colect 3rd-parties additional include paths into compiler options -----
173for %%a in ("%CSF_OPT_INC:;=";"%") do (
174 set "anItem=%%~a"
175 if not ["%%~a"] == [""] call :concatCmplInc %%~a
176)
177
178rem ----- Colect 3rd-parties additional library paths (32-bit) into linker options -----
179set "OPT_LIB32="
180for %%a in ("%CSF_OPT_LIB32:;=";"%") do (
181 set "anItem=%%~a"
182 if not ["%%~a"] == [""] call :concatLib32 %%~a
183)
184
185rem ----- Colect 3rd-parties additional library paths (64-bit) into linker options -----
186set "OPT_LIB64="
187for %%a in ("%CSF_OPT_LIB64:;=";"%") do (
188 set "anItem=%%~a"
189 if not ["%%~a"] == [""] call :concatLib64 %%~a
190)
191
910970ab 192set "CSF_OPT_LNK32=%CSF_OPT_LNK32% %OPT_LIB32%"
910970ab 193set "CSF_OPT_LNK64=%CSF_OPT_LNK64% %OPT_LIB64%"
316d77d9 194set "CSF_OPT_LNK32D=%CSF_OPT_LNK32D% %OPT_LIB32%"
910970ab 195set "CSF_OPT_LNK64D=%CSF_OPT_LNK64D% %OPT_LIB64%"
316d77d9 196set "CSF_OPT_LNK32I=%CSF_OPT_LNK32I% %OPT_LIB32%"
197set "CSF_OPT_LNK64I=%CSF_OPT_LNK64I% %OPT_LIB64%"
910970ab 198
4b3541c6 199rem ----- Default paths to sub-folders (can be different in install env) -----
200if "%CSF_OCCTIncludePath%" == "" set "CSF_OCCTIncludePath=%CASROOT%\inc"
201if "%CSF_OCCTResourcePath%" == "" set "CSF_OCCTResourcePath=%CASROOT%\src"
202if "%CSF_OCCTSamplesPath%" == "" set "CSF_OCCTSamplesPath=%CASROOT%\samples"
203if "%CSF_OCCTDataPath%" == "" set "CSF_OCCTDataPath=%CASROOT%\data"
204if "%CSF_OCCTTestsPath%" == "" set "CSF_OCCTTestsPath=%CASROOT%\tests"
d6cda17a 205if "%CSF_OCCTBinPath%" == "" set "CSF_OCCTBinPath=%CASROOT%\win%ARCH%\%VCLIB%\bin%CASDEB%"
206if "%CSF_OCCTLibPath%" == "" set "CSF_OCCTLibPath=%CASROOT%\win%ARCH%\%VCLIB%\lib%CASDEB%"
910970ab 207
208rem ----- Set path to 3rd party and OCCT libraries -----
4b3541c6 209set "PATH=%CSF_OCCTBinPath%;%PATH%"
316d77d9 210if ["%CASDEB%"] == [""] if ["%ARCH%"] == ["32"] set "PATH=%CSF_OPT_BIN32%;%PATH%"
211if ["%CASDEB%"] == [""] if ["%ARCH%"] == ["64"] set "PATH=%CSF_OPT_BIN64%;%PATH%"
212if ["%CASDEB%"] == ["d"] if ["%ARCH%"] == ["32"] set "PATH=%CSF_OPT_BIN32D%;%PATH%"
213if ["%CASDEB%"] == ["d"] if ["%ARCH%"] == ["64"] set "PATH=%CSF_OPT_BIN64D%;%PATH%"
316d77d9 214if ["%CASDEB%"] == ["i"] if ["%ARCH%"] == ["32"] set "PATH=%CSF_OPT_BIN32I%;%PATH%"
215if ["%CASDEB%"] == ["i"] if ["%ARCH%"] == ["64"] set "PATH=%CSF_OPT_BIN64I%;%PATH%"
910970ab 216
217rem ----- Set envoronment variables used by OCCT -----
218set CSF_LANGUAGE=us
219set MMGT_CLEAR=1
4b3541c6 220set "CSF_SHMessage=%CSF_OCCTResourcePath%\SHMessage"
221set "CSF_MDTVTexturesDirectory=%CSF_OCCTResourcePath%\Textures"
222set "CSF_ShadersDirectory=%CSF_OCCTResourcePath%\Shaders"
223set "CSF_XSMessage=%CSF_OCCTResourcePath%\XSMessage"
224set "CSF_TObjMessage=%CSF_OCCTResourcePath%\TObj"
225set "CSF_StandardDefaults=%CSF_OCCTResourcePath%\StdResource"
226set "CSF_PluginDefaults=%CSF_OCCTResourcePath%\StdResource"
227set "CSF_XCAFDefaults=%CSF_OCCTResourcePath%\StdResource"
228set "CSF_TObjDefaults=%CSF_OCCTResourcePath%\StdResource"
229set "CSF_StandardLiteDefaults=%CSF_OCCTResourcePath%\StdResource"
4b3541c6 230set "CSF_IGESDefaults=%CSF_OCCTResourcePath%\XSTEPResource"
231set "CSF_STEPDefaults=%CSF_OCCTResourcePath%\XSTEPResource"
232set "CSF_XmlOcafResource=%CSF_OCCTResourcePath%\XmlOcafResource"
233set "CSF_MIGRATION_TYPES=%CSF_OCCTResourcePath%\StdResource\MigrationSheet.txt"
910970ab 234
235rem Draw Harness special stuff
4b3541c6 236if exist "%CSF_OCCTResourcePath%\DrawResources\DrawDefault" (
237 set "DRAWDEFAULT=%CSF_OCCTResourcePath%\DrawResources\DrawDefault"
238)
239if exist "%CSF_OCCTResourcePath%\DrawResources" (
240 set "DRAWHOME=%CSF_OCCTResourcePath%\DrawResources"
910970ab 241 set "CSF_DrawPluginDefaults=%DRAWHOME%"
242)
910970ab 243goto :eof
244
245:concatCmplInc
246set "CSF_OPT_CMPL=%CSF_OPT_CMPL% -I%1"
247goto :eof
248
249:concatLib32
7c65581d 250rem Compiler options for Code::Blocks: -L for gcc/mingw and /LIBPATH for msvc
251rem set "OPT_LIB32=%OPT_LIB32% /LIBPATH:%1"
252set "OPT_LIB32=%OPT_LIB32% -L%1"
910970ab 253goto :eof
254
255:concatLib64
7c65581d 256rem Compiler options for Code::Blocks: -L for gcc/mingw and /LIBPATH for msvc
257rem set "OPT_LIB64=%OPT_LIB64% /LIBPATH:%1"
258set "OPT_LIB64=%OPT_LIB64% -L%1"
910970ab 259goto :eof