dfc842a6781310076d1cd6a21c93bddeeb0daf69
[occt.git] / adm / templates / env.bat
1 @echo off
2
3 rem Use:
4 rem - first argument specifies version of Visual Studio (vc8, vc9, or vc10),
5 rem - second argument specifies architecture (win32 or win64),
6 rem - third argument specifies build mode (Debug or Release)
7 rem Default options are:
8 rem   vc8 win32 Release
9
10 set "SCRIPTROOT=%~dp0"
11 set "SCRIPTROOT=%SCRIPTROOT:~0,-1%"
12
13 rem ----- Reset values to defaults -----
14 set "CASDEB="
15 set "VCVER=vc10"
16 set "ARCH=64"
17 set "VCVARS="
18 set "HAVE_TBB=false"
19 set "HAVE_OPENCL=false"
20 set "HAVE_FREEIMAGE=false"
21 set "HAVE_FFMPEG=false"
22 set "HAVE_GL2PS=false"
23 set "HAVE_VTK=false"
24 set "HAVE_GLES2=false"
25 set "HAVE_D3D=false"
26 set "HAVE_ZLIB=false"
27 set "HAVE_LIBLZMA=false"
28 set "CSF_OPT_INC="
29 set "CSF_OPT_LIB32="
30 set "CSF_OPT_LIB64="
31 set "CSF_OPT_BIN32="
32 set "CSF_OPT_BIN64="
33
34 rem ----- Load local settings -----
35 if exist "%~dp0custom.bat" (
36   call "%~dp0custom.bat" %1 %2 %3 %4 %5
37 )
38
39 if not ["%CASROOT%"] == [""] if exist "%SCRIPTROOT%\%CASROOT%" set "CASROOT=%SCRIPTROOT%\%CASROOT%"
40 if     ["%CASROOT%"] == [""] set "CASROOT=%SCRIPTROOT%"
41
42 rem ----- Read script arguments (override local settings) -----
43 if not ["%1"]    == [""]      set "VCVER=%1"
44 if not ["%2"]    == [""]      set "ARCH=%2"
45 if /I ["%ARCH%"] == ["win32"] set "ARCH=32"
46 if /I ["%ARCH%"] == ["win64"] set "ARCH=64"
47 if /I ["%3"]     == ["debug"] set "CASDEB=d"
48 if /I ["%3"]     == ["d"]     set "CASDEB=d"
49 if /I ["%3"]     == ["i"]     set "CASDEB=i"
50 if /I ["%3"]     == ["relwithdeb"] set "CASDEB=i"
51
52 rem Decode VCVER
53 call "%~dp0adm\vcver.bat"
54
55 set "CSF_OPT_LIB32D=%CSF_OPT_LIB32%"
56 set "CSF_OPT_LIB64D=%CSF_OPT_LIB64%"
57 set "CSF_OPT_BIN32D=%CSF_OPT_BIN32%"
58 set "CSF_OPT_BIN64D=%CSF_OPT_BIN64%"
59 set "CSF_OPT_LIB32I=%CSF_OPT_LIB32%"
60 set "CSF_OPT_LIB64I=%CSF_OPT_LIB64%"
61 set "CSF_OPT_BIN32I=%CSF_OPT_BIN32%"
62 set "CSF_OPT_BIN64I=%CSF_OPT_BIN64%"
63
64 rem ----- Optional 3rd-parties should be enabled by HAVE macros -----
65 set "CSF_OPT_CMPL="
66 set "PRODUCTS_DEFINES="
67 if ["%HAVE_TBB%"]       == ["true"] set "PRODUCTS_DEFINES=%PRODUCTS_DEFINES% -DHAVE_TBB"       & set "CSF_DEFINES=HAVE_TBB;%CSF_DEFINES%"
68 if ["%HAVE_OPENCL%"]    == ["true"] set "PRODUCTS_DEFINES=%PRODUCTS_DEFINES% -DHAVE_OPENCL"    & set "CSF_DEFINES=HAVE_OPENCL;%CSF_DEFINES%"
69 if ["%HAVE_GL2PS%"]     == ["true"] set "PRODUCTS_DEFINES=%PRODUCTS_DEFINES% -DHAVE_GL2PS"     & set "CSF_DEFINES=HAVE_GL2PS;%CSF_DEFINES%"
70 if ["%HAVE_FREEIMAGE%"] == ["true"] set "PRODUCTS_DEFINES=%PRODUCTS_DEFINES% -DHAVE_FREEIMAGE" & set "CSF_DEFINES=HAVE_FREEIMAGE;%CSF_DEFINES%"
71 if ["%HAVE_FFMPEG%"]    == ["true"] set "PRODUCTS_DEFINES=%PRODUCTS_DEFINES% -DHAVE_FFMPEG"    & set "CSF_DEFINES=HAVE_FFMPEG;%CSF_DEFINES%"
72 if ["%HAVE_VTK%"]       == ["true"] set "PRODUCTS_DEFINES=%PRODUCTS_DEFINES% -DHAVE_VTK"       & set "CSF_DEFINES=HAVE_VTK;%CSF_DEFINES%"
73 if ["%HAVE_GLES2%"]     == ["true"] set "PRODUCTS_DEFINES=%PRODUCTS_DEFINES% -DHAVE_GLES2"     & set "CSF_DEFINES=HAVE_GLES2;%CSF_DEFINES%"
74 if ["%HAVE_D3D%"]       == ["true"] set "PRODUCTS_DEFINES=%PRODUCTS_DEFINES% -DHAVE_D3D"       & set "CSF_DEFINES=HAVE_D3D;%CSF_DEFINES%"
75 if ["%HAVE_ZLIB%"]      == ["true"] set "PRODUCTS_DEFINES=%PRODUCTS_DEFINES% -DHAVE_ZLIB"      & set "CSF_DEFINES=HAVE_ZLIB;%CSF_DEFINES%"
76 if ["%HAVE_LIBLZMA%"]   == ["true"] set "PRODUCTS_DEFINES=%PRODUCTS_DEFINES% -DHAVE_LIBLZMA"   & set "CSF_DEFINES=HAVE_LIBLZMA;%CSF_DEFINES%"
77
78 rem Eliminate VS warning
79 if ["%CSF_DEFINES%"]  == [""] set "CSF_DEFINES=;"
80
81 rem ----- Optional 3rd-parties should be enabled by HAVE macros -----
82 if not ["%PRODUCTS_DEFINES%"] == [""] set "CSF_OPT_CMPL=%CSF_OPT_CMPL% %PRODUCTS_DEFINES%"
83
84 rem ----- Colect 3rd-parties additional include paths into compiler options -----
85 for %%a in ("%CSF_OPT_INC:;=";"%") do (
86   set "anItem=%%~a"
87   if not ["%%~a"] == [""] call :concatCmplInc %%~a
88 )
89
90 rem ----- Colect 3rd-parties additional library paths (32-bit) into linker options -----
91 set "OPT_LIB32="
92 for %%a in ("%CSF_OPT_LIB32:;=";"%") do (
93   set "anItem=%%~a"
94   if not ["%%~a"] == [""] call :concatLib32 %%~a
95 )
96
97 rem ----- Colect 3rd-parties additional library paths (64-bit) into linker options -----
98 set "OPT_LIB64="
99 for %%a in ("%CSF_OPT_LIB64:;=";"%") do (
100   set "anItem=%%~a"
101   if not ["%%~a"] == [""] call :concatLib64 %%~a
102 )
103
104 set "CSF_OPT_LNK32=%CSF_OPT_LNK32% %OPT_LIB32%"
105 set "CSF_OPT_LNK64=%CSF_OPT_LNK64% %OPT_LIB64%"
106 set "CSF_OPT_LNK32D=%CSF_OPT_LNK32D% %OPT_LIB32%"
107 set "CSF_OPT_LNK64D=%CSF_OPT_LNK64D% %OPT_LIB64%"
108 set "CSF_OPT_LNK32I=%CSF_OPT_LNK32I% %OPT_LIB32%"
109 set "CSF_OPT_LNK64I=%CSF_OPT_LNK64I% %OPT_LIB64%"
110
111 rem ----- Default paths to sub-folders (can be different in install env) -----
112 if "%CSF_OCCTIncludePath%" == "" set "CSF_OCCTIncludePath=%CASROOT%\inc"
113 if "%CSF_OCCTResourcePath%" == "" set "CSF_OCCTResourcePath=%CASROOT%\src"
114 if "%CSF_OCCTSamplesPath%" == "" set "CSF_OCCTSamplesPath=%CASROOT%\samples"
115 if "%CSF_OCCTDataPath%" == "" set "CSF_OCCTDataPath=%CASROOT%\data"
116 if "%CSF_OCCTTestsPath%" == "" set "CSF_OCCTTestsPath=%CASROOT%\tests"
117 if "%CSF_OCCTBinPath%" == "" set "CSF_OCCTBinPath=%CASROOT%\win%ARCH%\%VCLIB%\bin%CASDEB%"
118 if "%CSF_OCCTLibPath%" == "" set "CSF_OCCTLibPath=%CASROOT%\win%ARCH%\%VCLIB%\lib%CASDEB%"
119
120 rem ----- Set path to 3rd party and OCCT libraries -----
121 set "PATH=%CSF_OCCTBinPath%;%PATH%"
122 if ["%CASDEB%"] == [""] if ["%ARCH%"] == ["32"] set "PATH=%CSF_OPT_BIN32%;%PATH%"
123 if ["%CASDEB%"] == [""] if ["%ARCH%"] == ["64"] set "PATH=%CSF_OPT_BIN64%;%PATH%"
124 if ["%CASDEB%"] == ["d"] if ["%ARCH%"] == ["32"] set "PATH=%CSF_OPT_BIN32D%;%PATH%"
125 if ["%CASDEB%"] == ["d"] if ["%ARCH%"] == ["64"] set "PATH=%CSF_OPT_BIN64D%;%PATH%"
126 if ["%CASDEB%"] == ["i"] if ["%ARCH%"] == ["32"] set "PATH=%CSF_OPT_BIN32I%;%PATH%"
127 if ["%CASDEB%"] == ["i"] if ["%ARCH%"] == ["64"] set "PATH=%CSF_OPT_BIN64I%;%PATH%"
128
129 rem ----- Set envoronment variables used by OCCT -----
130 set CSF_LANGUAGE=us
131 set MMGT_CLEAR=1
132 set "CSF_SHMessage=%CSF_OCCTResourcePath%\SHMessage"
133 set "CSF_MDTVTexturesDirectory=%CSF_OCCTResourcePath%\Textures"
134 set "CSF_ShadersDirectory=%CSF_OCCTResourcePath%\Shaders"
135 set "CSF_XSMessage=%CSF_OCCTResourcePath%\XSMessage"
136 set "CSF_TObjMessage=%CSF_OCCTResourcePath%\TObj"
137 set "CSF_StandardDefaults=%CSF_OCCTResourcePath%\StdResource"
138 set "CSF_PluginDefaults=%CSF_OCCTResourcePath%\StdResource"
139 set "CSF_XCAFDefaults=%CSF_OCCTResourcePath%\StdResource"
140 set "CSF_TObjDefaults=%CSF_OCCTResourcePath%\StdResource"
141 set "CSF_StandardLiteDefaults=%CSF_OCCTResourcePath%\StdResource"
142 set "CSF_IGESDefaults=%CSF_OCCTResourcePath%\XSTEPResource"
143 set "CSF_STEPDefaults=%CSF_OCCTResourcePath%\XSTEPResource"
144 set "CSF_XmlOcafResource=%CSF_OCCTResourcePath%\XmlOcafResource"
145 set "CSF_MIGRATION_TYPES=%CSF_OCCTResourcePath%\StdResource\MigrationSheet.txt"
146
147 rem Draw Harness special stuff
148 if exist "%CSF_OCCTResourcePath%\DrawResources\DrawDefault" (
149   set "DRAWDEFAULT=%CSF_OCCTResourcePath%\DrawResources\DrawDefault"
150 )
151 if exist "%CSF_OCCTResourcePath%\DrawResources" (
152   set "DRAWHOME=%CSF_OCCTResourcePath%\DrawResources"
153   set "CSF_DrawPluginDefaults=%DRAWHOME%"
154 )
155 goto :eof
156
157 :concatCmplInc
158 set "CSF_OPT_CMPL=%CSF_OPT_CMPL% -I%1"
159 goto :eof
160
161 :concatLib32
162 rem Compiler options for Code::Blocks: -L for gcc/mingw and /LIBPATH for msvc
163 rem set "OPT_LIB32=%OPT_LIB32% /LIBPATH:%1"
164 set "OPT_LIB32=%OPT_LIB32% -L%1"
165 goto :eof
166
167 :concatLib64
168 rem Compiler options for Code::Blocks: -L for gcc/mingw and /LIBPATH for msvc
169 rem set "OPT_LIB64=%OPT_LIB64% /LIBPATH:%1"
170 set "OPT_LIB64=%OPT_LIB64% -L%1"
171 goto :eof