0027056: Configuration, genproj.tcl - fix generation of project files for Products
[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 -----
e31a8e52 14set "CASROOT=__CASROOT__"
910970ab 15set "CASDEB="
16set "VCVER=vc8"
17set "ARCH=32"
18set "VCVARS="
19set "HAVE_TBB=false"
20set "HAVE_OPENCL=false"
21set "HAVE_FREEIMAGE=false"
22set "HAVE_GL2PS=false"
910970ab 23set "HAVE_VTK=false"
f60111dc 24set "HAVE_D3D=false"
910970ab 25set "CSF_OPT_INC="
26set "CSF_OPT_LIB32="
27set "CSF_OPT_LIB64="
28set "CSF_OPT_BIN32="
29set "CSF_OPT_BIN64="
30
31rem ----- Load local settings -----
e31a8e52 32if not ["%CASROOT%"] == [""] if exist "%CASROOT%\custom.bat" (
33 call "%CASROOT%\custom.bat" %1 %2 %3 %4 %5
34)
910970ab 35if exist "%~dp0custom.bat" (
36 call "%~dp0custom.bat" %1 %2 %3 %4 %5
37)
38
e31a8e52 39if not ["%CASROOT%"] == [""] if exist "%SCRIPTROOT%\%CASROOT%" set "CASROOT=%SCRIPTROOT%\%CASROOT%"
40if ["%CASROOT%"] == [""] set "CASROOT=%SCRIPTROOT%"
41
910970ab 42rem ----- Read script arguments (override local settings) -----
43if not ["%1"] == [""] set "VCVER=%1"
44if not ["%2"] == [""] set "ARCH=%2"
45if /I ["%ARCH%"] == ["win32"] set "ARCH=32"
46if /I ["%ARCH%"] == ["win64"] set "ARCH=64"
47if /I ["%3"] == ["debug"] set "CASDEB=d"
48if /I ["%3"] == ["d"] set "CASDEB=d"
316d77d9 49if /I ["%3"] == ["i"] set "CASDEB=i"
50if /I ["%3"] == ["relwithdeb"] set "CASDEB=i"
910970ab 51
52set "CSF_OPT_INC=%CSF_OPT_INC%;%CASROOT%\inc"
53set "CSF_OPT_LIB32D=%CSF_OPT_LIB32%;%CASROOT%\win32\%VCVER%\libd"
54set "CSF_OPT_LIB64D=%CSF_OPT_LIB64%;%CASROOT%\win64\%VCVER%\libd"
55set "CSF_OPT_BIN32D=%CSF_OPT_BIN32%;%CASROOT%\win32\%VCVER%\bind"
56set "CSF_OPT_BIN64D=%CSF_OPT_BIN64%;%CASROOT%\win64\%VCVER%\bind"
316d77d9 57set "CSF_OPT_LIB32I=%CSF_OPT_LIB32%;%CASROOT%\win32\%VCVER%\libi"
58set "CSF_OPT_LIB64I=%CSF_OPT_LIB64%;%CASROOT%\win64\%VCVER%\libi"
59set "CSF_OPT_BIN32I=%CSF_OPT_BIN32%;%CASROOT%\win32\%VCVER%\bini"
60set "CSF_OPT_BIN64I=%CSF_OPT_BIN64%;%CASROOT%\win64\%VCVER%\bini"
910970ab 61set "CSF_OPT_LIB32=%CSF_OPT_LIB32%;%CASROOT%\win32\%VCVER%\lib"
62set "CSF_OPT_LIB64=%CSF_OPT_LIB64%;%CASROOT%\win64\%VCVER%\lib"
63set "CSF_OPT_BIN32=%CSF_OPT_BIN32%;%CASROOT%\win32\%VCVER%\bin"
64set "CSF_OPT_BIN64=%CSF_OPT_BIN64%;%CASROOT%\win64\%VCVER%\bin"
65
66rem ----- Optional 3rd-parties should be enabled by HAVE macros -----
67set "CSF_OPT_CMPL="
68set "PRODUCTS_DEFINES="
69if ["%HAVE_TBB%"] == ["true"] set "PRODUCTS_DEFINES=%PRODUCTS_DEFINES% -DHAVE_TBB"
70if ["%HAVE_OPENCL%"] == ["true"] set "PRODUCTS_DEFINES=%PRODUCTS_DEFINES% -DHAVE_OPENCL"
71if ["%HAVE_GL2PS%"] == ["true"] set "PRODUCTS_DEFINES=%PRODUCTS_DEFINES% -DHAVE_GL2PS"
72if ["%HAVE_FREEIMAGE%"] == ["true"] set "PRODUCTS_DEFINES=%PRODUCTS_DEFINES% -DHAVE_FREEIMAGE"
73if ["%HAVE_VTK%"] == ["true"] set "PRODUCTS_DEFINES=%PRODUCTS_DEFINES% -DHAVE_VTK"
f60111dc 74if ["%HAVE_D3D%"] == ["true"] set "PRODUCTS_DEFINES=%PRODUCTS_DEFINES% -DHAVE_D3D"
910970ab 75if ["%HAVE_TBB%"] == ["true"] set "CSF_DEFINES=HAVE_TBB;%CSF_DEFINES%"
76if ["%HAVE_OPENCL%"] == ["true"] set "CSF_DEFINES=HAVE_OPENCL;%CSF_DEFINES%"
77if ["%HAVE_GL2PS%"] == ["true"] set "CSF_DEFINES=HAVE_GL2PS;%CSF_DEFINES%"
78if ["%HAVE_FREEIMAGE%"] == ["true"] set "CSF_DEFINES=HAVE_FREEIMAGE;%CSF_DEFINES%"
79if ["%HAVE_VTK%"] == ["true"] set "CSF_DEFINES=HAVE_VTK;%CSF_DEFINES%"
f60111dc 80if ["%HAVE_D3D%"] == ["true"] set "CSF_DEFINES=HAVE_D3D;%CSF_DEFINES%"
910970ab 81
82rem Eliminate VS warning
83if ["%CSF_DEFINES%"] == [""] set "CSF_DEFINES=;"
84
85rem ----- Optional 3rd-parties should be enabled by HAVE macros -----
86if not ["%PRODUCTS_DEFINES%"] == [""] set "CSF_OPT_CMPL=%CSF_OPT_CMPL% %PRODUCTS_DEFINES%"
87
88rem ----- Colect 3rd-parties additional include paths into compiler options -----
89for %%a in ("%CSF_OPT_INC:;=";"%") do (
90 set "anItem=%%~a"
91 if not ["%%~a"] == [""] call :concatCmplInc %%~a
92)
93
94rem ----- Colect 3rd-parties additional library paths (32-bit) into linker options -----
95set "OPT_LIB32="
96for %%a in ("%CSF_OPT_LIB32:;=";"%") do (
97 set "anItem=%%~a"
98 if not ["%%~a"] == [""] call :concatLib32 %%~a
99)
100
101rem ----- Colect 3rd-parties additional library paths (64-bit) into linker options -----
102set "OPT_LIB64="
103for %%a in ("%CSF_OPT_LIB64:;=";"%") do (
104 set "anItem=%%~a"
105 if not ["%%~a"] == [""] call :concatLib64 %%~a
106)
107
910970ab 108set "CSF_OPT_LNK32=%CSF_OPT_LNK32% %OPT_LIB32%"
910970ab 109set "CSF_OPT_LNK64=%CSF_OPT_LNK64% %OPT_LIB64%"
316d77d9 110set "CSF_OPT_LNK32D=%CSF_OPT_LNK32D% %OPT_LIB32%"
910970ab 111set "CSF_OPT_LNK64D=%CSF_OPT_LNK64D% %OPT_LIB64%"
316d77d9 112set "CSF_OPT_LNK32I=%CSF_OPT_LNK32I% %OPT_LIB32%"
113set "CSF_OPT_LNK64I=%CSF_OPT_LNK64I% %OPT_LIB64%"
910970ab 114
115set "CASBIN=win%ARCH%\%VCVER%"
116
117rem ----- Set path to 3rd party and OCCT libraries -----
118set "PATH=%SCRIPTROOT%\%CASBIN%\bin%CASDEB%;%PATH%"
316d77d9 119if ["%CASDEB%"] == [""] if ["%ARCH%"] == ["32"] set "PATH=%CSF_OPT_BIN32%;%PATH%"
120if ["%CASDEB%"] == [""] if ["%ARCH%"] == ["64"] set "PATH=%CSF_OPT_BIN64%;%PATH%"
121if ["%CASDEB%"] == ["d"] if ["%ARCH%"] == ["32"] set "PATH=%CSF_OPT_BIN32D%;%PATH%"
122if ["%CASDEB%"] == ["d"] if ["%ARCH%"] == ["64"] set "PATH=%CSF_OPT_BIN64D%;%PATH%"
123
124if ["%CASDEB%"] == ["i"] if ["%ARCH%"] == ["32"] set "PATH=%CSF_OPT_BIN32I%;%PATH%"
125if ["%CASDEB%"] == ["i"] if ["%ARCH%"] == ["64"] set "PATH=%CSF_OPT_BIN64I%;%PATH%"
910970ab 126
127rem ----- Set envoronment variables used by OCCT -----
128set CSF_LANGUAGE=us
129set MMGT_CLEAR=1
130set CSF_EXCEPTION_PROMPT=1
131set "CSF_SHMessage=%CASROOT%\src\SHMessage"
132set "CSF_MDTVTexturesDirectory=%CASROOT%\src\Textures"
133set "CSF_ShadersDirectory=%CASROOT%\src\Shaders"
134set "CSF_XSMessage=%CASROOT%\src\XSMessage"
135set "CSF_TObjMessage=%CASROOT%\src\TObj"
136set "CSF_StandardDefaults=%CASROOT%\src\StdResource"
137set "CSF_PluginDefaults=%CASROOT%\src\StdResource"
138set "CSF_XCAFDefaults=%CASROOT%\src\StdResource"
139set "CSF_TObjDefaults=%CASROOT%\src\StdResource"
140set "CSF_StandardLiteDefaults=%CASROOT%\src\StdResource"
141set "CSF_UnitsLexicon=%CASROOT%\src\UnitsAPI\Lexi_Expr.dat"
142set "CSF_UnitsDefinition=%CASROOT%\src\UnitsAPI\Units.dat"
143set "CSF_IGESDefaults=%CASROOT%\src\XSTEPResource"
144set "CSF_STEPDefaults=%CASROOT%\src\XSTEPResource"
145set "CSF_XmlOcafResource=%CASROOT%\src\XmlOcafResource"
146set "CSF_MIGRATION_TYPES=%CASROOT%\src\StdResource\MigrationSheet.txt"
147
148rem Draw Harness special stuff
149if exist "%CASROOT%\src\DrawResources" (
150 set "DRAWHOME=%CASROOT%\src\DrawResources"
151 set "CSF_DrawPluginDefaults=%DRAWHOME%"
152)
153if exist "%SCRIPTROOT%\src\DrawResourcesProducts" (
154 set "CSF_DrawPluginProductsDefaults=%SCRIPTROOT%\src\DrawResourcesProducts"
155)
156goto :eof
157
158:concatCmplInc
159set "CSF_OPT_CMPL=%CSF_OPT_CMPL% -I%1"
160goto :eof
161
162:concatLib32
163set "OPT_LIB32=%OPT_LIB32% /LIBPATH:%1"
164goto :eof
165
166:concatLib64
167set "OPT_LIB64=%OPT_LIB64% /LIBPATH:%1"
168goto :eof