0028312: Configuration, genproj.tcl - support CSF_ZLIB and CSF_LIBLZMA within project...
[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 set "CSF_OPT_LIB32D=%CSF_OPT_LIB32%"
53 set "CSF_OPT_LIB64D=%CSF_OPT_LIB64%"
54 set "CSF_OPT_BIN32D=%CSF_OPT_BIN32%"
55 set "CSF_OPT_BIN64D=%CSF_OPT_BIN64%"
56 set "CSF_OPT_LIB32I=%CSF_OPT_LIB32%"
57 set "CSF_OPT_LIB64I=%CSF_OPT_LIB64%"
58 set "CSF_OPT_BIN32I=%CSF_OPT_BIN32%"
59 set "CSF_OPT_BIN64I=%CSF_OPT_BIN64%"
60
61 rem ----- Optional 3rd-parties should be enabled by HAVE macros -----
62 set "CSF_OPT_CMPL="
63 set "PRODUCTS_DEFINES="
64 if ["%HAVE_TBB%"]       == ["true"] set "PRODUCTS_DEFINES=%PRODUCTS_DEFINES% -DHAVE_TBB"       & set "CSF_DEFINES=HAVE_TBB;%CSF_DEFINES%"
65 if ["%HAVE_OPENCL%"]    == ["true"] set "PRODUCTS_DEFINES=%PRODUCTS_DEFINES% -DHAVE_OPENCL"    & set "CSF_DEFINES=HAVE_OPENCL;%CSF_DEFINES%"
66 if ["%HAVE_GL2PS%"]     == ["true"] set "PRODUCTS_DEFINES=%PRODUCTS_DEFINES% -DHAVE_GL2PS"     & set "CSF_DEFINES=HAVE_GL2PS;%CSF_DEFINES%"
67 if ["%HAVE_FREEIMAGE%"] == ["true"] set "PRODUCTS_DEFINES=%PRODUCTS_DEFINES% -DHAVE_FREEIMAGE" & set "CSF_DEFINES=HAVE_FREEIMAGE;%CSF_DEFINES%"
68 if ["%HAVE_FFMPEG%"]    == ["true"] set "PRODUCTS_DEFINES=%PRODUCTS_DEFINES% -DHAVE_FFMPEG"    & set "CSF_DEFINES=HAVE_FFMPEG;%CSF_DEFINES%"
69 if ["%HAVE_VTK%"]       == ["true"] set "PRODUCTS_DEFINES=%PRODUCTS_DEFINES% -DHAVE_VTK"       & set "CSF_DEFINES=HAVE_VTK;%CSF_DEFINES%"
70 if ["%HAVE_GLES2%"]     == ["true"] set "PRODUCTS_DEFINES=%PRODUCTS_DEFINES% -DHAVE_GLES2"     & set "CSF_DEFINES=HAVE_GLES2;%CSF_DEFINES%"
71 if ["%HAVE_D3D%"]       == ["true"] set "PRODUCTS_DEFINES=%PRODUCTS_DEFINES% -DHAVE_D3D"       & set "CSF_DEFINES=HAVE_D3D;%CSF_DEFINES%"
72 if ["%HAVE_ZLIB%"]      == ["true"] set "PRODUCTS_DEFINES=%PRODUCTS_DEFINES% -DHAVE_ZLIB"      & set "CSF_DEFINES=HAVE_ZLIB;%CSF_DEFINES%"
73 if ["%HAVE_LIBLZMA%"]   == ["true"] set "PRODUCTS_DEFINES=%PRODUCTS_DEFINES% -DHAVE_LIBLZMA"   & set "CSF_DEFINES=HAVE_LIBLZMA;%CSF_DEFINES%"
74
75 rem Eliminate VS warning
76 if ["%CSF_DEFINES%"]  == [""] set "CSF_DEFINES=;"
77
78 rem ----- Optional 3rd-parties should be enabled by HAVE macros -----
79 if not ["%PRODUCTS_DEFINES%"] == [""] set "CSF_OPT_CMPL=%CSF_OPT_CMPL% %PRODUCTS_DEFINES%"
80
81 rem ----- Colect 3rd-parties additional include paths into compiler options -----
82 for %%a in ("%CSF_OPT_INC:;=";"%") do (
83   set "anItem=%%~a"
84   if not ["%%~a"] == [""] call :concatCmplInc %%~a
85 )
86
87 rem ----- Colect 3rd-parties additional library paths (32-bit) into linker options -----
88 set "OPT_LIB32="
89 for %%a in ("%CSF_OPT_LIB32:;=";"%") do (
90   set "anItem=%%~a"
91   if not ["%%~a"] == [""] call :concatLib32 %%~a
92 )
93
94 rem ----- Colect 3rd-parties additional library paths (64-bit) into linker options -----
95 set "OPT_LIB64="
96 for %%a in ("%CSF_OPT_LIB64:;=";"%") do (
97   set "anItem=%%~a"
98   if not ["%%~a"] == [""] call :concatLib64 %%~a
99 )
100
101 set "CSF_OPT_LNK32=%CSF_OPT_LNK32% %OPT_LIB32%"
102 set "CSF_OPT_LNK64=%CSF_OPT_LNK64% %OPT_LIB64%"
103 set "CSF_OPT_LNK32D=%CSF_OPT_LNK32D% %OPT_LIB32%"
104 set "CSF_OPT_LNK64D=%CSF_OPT_LNK64D% %OPT_LIB64%"
105 set "CSF_OPT_LNK32I=%CSF_OPT_LNK32I% %OPT_LIB32%"
106 set "CSF_OPT_LNK64I=%CSF_OPT_LNK64I% %OPT_LIB64%"
107
108 rem ----- Default paths to sub-folders (can be different in install env) -----
109 if "%CSF_OCCTIncludePath%" == "" set "CSF_OCCTIncludePath=%CASROOT%\inc"
110 if "%CSF_OCCTResourcePath%" == "" set "CSF_OCCTResourcePath=%CASROOT%\src"
111 if "%CSF_OCCTSamplesPath%" == "" set "CSF_OCCTSamplesPath=%CASROOT%\samples"
112 if "%CSF_OCCTDataPath%" == "" set "CSF_OCCTDataPath=%CASROOT%\data"
113 if "%CSF_OCCTTestsPath%" == "" set "CSF_OCCTTestsPath=%CASROOT%\tests"
114 if "%CSF_OCCTBinPath%" == "" set "CSF_OCCTBinPath=%CASROOT%\win%ARCH%\%VCVER%\bin%CASDEB%"
115 if "%CSF_OCCTLibPath%" == "" set "CSF_OCCTLibPath=%CASROOT%\win%ARCH%\%VCVER%\lib%CASDEB%"
116
117 rem ----- Set path to 3rd party and OCCT libraries -----
118 set "PATH=%CSF_OCCTBinPath%;%PATH%"
119 if ["%CASDEB%"] == [""] if ["%ARCH%"] == ["32"] set "PATH=%CSF_OPT_BIN32%;%PATH%"
120 if ["%CASDEB%"] == [""] if ["%ARCH%"] == ["64"] set "PATH=%CSF_OPT_BIN64%;%PATH%"
121 if ["%CASDEB%"] == ["d"] if ["%ARCH%"] == ["32"] set "PATH=%CSF_OPT_BIN32D%;%PATH%"
122 if ["%CASDEB%"] == ["d"] if ["%ARCH%"] == ["64"] set "PATH=%CSF_OPT_BIN64D%;%PATH%"
123 if ["%CASDEB%"] == ["i"] if ["%ARCH%"] == ["32"] set "PATH=%CSF_OPT_BIN32I%;%PATH%"
124 if ["%CASDEB%"] == ["i"] if ["%ARCH%"] == ["64"] set "PATH=%CSF_OPT_BIN64I%;%PATH%"
125
126 rem ----- Set envoronment variables used by OCCT -----
127 set CSF_LANGUAGE=us
128 set MMGT_CLEAR=1
129 set "CSF_SHMessage=%CSF_OCCTResourcePath%\SHMessage"
130 set "CSF_MDTVTexturesDirectory=%CSF_OCCTResourcePath%\Textures"
131 set "CSF_ShadersDirectory=%CSF_OCCTResourcePath%\Shaders"
132 set "CSF_XSMessage=%CSF_OCCTResourcePath%\XSMessage"
133 set "CSF_TObjMessage=%CSF_OCCTResourcePath%\TObj"
134 set "CSF_StandardDefaults=%CSF_OCCTResourcePath%\StdResource"
135 set "CSF_PluginDefaults=%CSF_OCCTResourcePath%\StdResource"
136 set "CSF_XCAFDefaults=%CSF_OCCTResourcePath%\StdResource"
137 set "CSF_TObjDefaults=%CSF_OCCTResourcePath%\StdResource"
138 set "CSF_StandardLiteDefaults=%CSF_OCCTResourcePath%\StdResource"
139 set "CSF_IGESDefaults=%CSF_OCCTResourcePath%\XSTEPResource"
140 set "CSF_STEPDefaults=%CSF_OCCTResourcePath%\XSTEPResource"
141 set "CSF_XmlOcafResource=%CSF_OCCTResourcePath%\XmlOcafResource"
142 set "CSF_MIGRATION_TYPES=%CSF_OCCTResourcePath%\StdResource\MigrationSheet.txt"
143
144 rem Draw Harness special stuff
145 if exist "%CSF_OCCTResourcePath%\DrawResources\DrawDefault" (
146   set "DRAWDEFAULT=%CSF_OCCTResourcePath%\DrawResources\DrawDefault"
147 )
148 if exist "%CSF_OCCTResourcePath%\DrawResources" (
149   set "DRAWHOME=%CSF_OCCTResourcePath%\DrawResources"
150   set "CSF_DrawPluginDefaults=%DRAWHOME%"
151 )
152 goto :eof
153
154 :concatCmplInc
155 set "CSF_OPT_CMPL=%CSF_OPT_CMPL% -I%1"
156 goto :eof
157
158 :concatLib32
159 rem Compiler options for Code::Blocks: -L for gcc/mingw and /LIBPATH for msvc
160 rem set "OPT_LIB32=%OPT_LIB32% /LIBPATH:%1"
161 set "OPT_LIB32=%OPT_LIB32% -L%1"
162 goto :eof
163
164 :concatLib64
165 rem Compiler options for Code::Blocks: -L for gcc/mingw and /LIBPATH for msvc
166 rem set "OPT_LIB64=%OPT_LIB64% /LIBPATH:%1"
167 set "OPT_LIB64=%OPT_LIB64% -L%1"
168 goto :eof