0025744: XCode projects generator - add extraction options
[occt-wok.git] / collect_binary.bat
CommitLineData
07f67898 1@echo off
2Setlocal EnableDelayedExpansion
3
4set COPYCMD=/Y
5
6rem %1 - vcver
7rem %2 - arch
8rem %3 - debug&release
9rem %4 - related package name
10
07f67898 11set "installPath=package"
12
13set configFile=collect_binary.cfg
14if exist %configFile% (
15 for /f "delims=" %%x in (%configFile%) do (set "%%x")
16)
17
944cf326 18if not "%1" == "" set "cmdArg1=%1"
19if not "%2" == "" set "cmdArg2=%2"
20if not "%3" == "" set "cmdArg3=%3"
21if not "%4" == "" set "installPath=%4"
22
07f67898 23rem if command line is empty and config file is not exist
24if "%cmdArg1%" == "" goto :eofWithEcho
25if "%cmdArg2%" == "" goto :eofWithEcho
26if "%cmdArg3%" == "" goto :eofWithEcho
27
28goto :GoOn
29
30:eofWithEcho
31echo Some arguments are empty. Please try again. For example,
32echo %0 vc10 64 release installDirRelatedPath
33goto :eof
34
35:GoOn
36
37echo.
944cf326 38echo "args are: %cmdArg1% %cmdArg2% %cmdArg3% %installPath%
07f67898 39echo.
40
07f67898 41rem Setup environment
42call "%~dp0env.bat" %cmdArg1% %cmdArg2% %cmdArg3%
43
44if "%ARCH%" == "32" (
45 set "xBit=x86"
46) else (
944cf326 47 if "%VCVER%" == "vc9" (
07f67898 48 set "xBit=amd64"
944cf326 49 ) else if "%VCVER%" == "vc10" (
50 set "xBit=x64"
51 ) else if "%VCVER%" == "vc11" (
52 set "xBit=x64"
53 )
07f67898 54)
55
56set "TCL_LIB_PATH="
57for %%a IN (%searchLibString%) DO (
58 if not "%%a" == "" (
59 set "line=%%a"
60 if not !line!==!line:Tcl=! (
61 set "TCL_LIB_PATH=!line!"
62 goto exitfor
63 )
64
65 if not !line!==!line:TCL=! (
66 set "TCL_LIB_PATH=!line!"
67 goto exitfor
68 )
69
70 if not !line!==!line:tcl=! (
71 set "TCL_LIB_PATH=!line!"
72 goto exitfor
73 )
74 )
75)
76:exitfor
77
78if "%VCVER%" == "vc8" (
79 set "VSDir=%VS80COMNTOOLS%"
80 set "msvcXNum=80"
81
82) else if "%VCVER%" == "vc9" (
83 set "VSDir=%VS90COMNTOOLS%"
84 set "msvcXNum=90"
85
86) else if "%VCVER%" == "vc10" (
87 set "VSDir=%VS100COMNTOOLS%"
88 set "msvcXNum=100"
89
944cf326 90) else if "%VCVER%" == "vc11" (
91 set "VSDir=%VS110COMNTOOLS%"
92 set "msvcXNum=110"
93
07f67898 94) else (
95 echo Error: wrong VS identifier
96 exit /B
97)
98
99set "doNotCopyForeignFileList="
100
101if exist "%CASROOT%\win%ARCH%\%VCVER%\bin%CASDEB%" (
102 set "preOCCDLLPath=win%ARCH%\%VCVER%\bin%CASDEB%"
103) else if exist "%CASROOT%\wnt\bin%CASDEB%" (
104 echo.
105 echo "%CASROOT%\wnt\bin%CASDEB% doesn't exist."
106 echo "%CASROOT%\wnt\bin%CASDEB% folder has been chosen"
107 echo.
108 set "preOCCDLLPath=wnt\bin%CASDEB%"
109) else (
110 echo.
111 echo "OCC dll folders (%CASROOT%\win%ARCH%\%VCVER%\bin%CASDEB% and %CASROOT%\wnt\bin%CASDEB%) don't exist"
112 echo "Please enter the correct paths"
113 echo.
114 goto :eof
115)
116
07f67898 117xcopy "%CASROOT%\%preOCCDLLPath%\TKernel.dll" "%installPath%\lib\wnt\"
118if not %errorlevel%. == 0. (set "doNotCopyForeignFileList=%doNotCopyForeignFileList%;TKernel.dll")
119
120xcopy "%VSDir%..\..\VC\redist\%xBit%\Microsoft.%VCVER%0.CRT\msvcp%msvcXNum%.dll" "%installPath%\lib\wnt\"
121if not %errorlevel%. == 0. (set "doNotCopyForeignFileList=%doNotCopyForeignFileList%;msvcp%msvcXNum%.dll")
122
123xcopy "%VSDir%..\..\VC\redist\%xBit%\Microsoft.%VCVER%0.CRT\msvcr%msvcXNum%.dll" "%installPath%\lib\wnt\"
124if not %errorlevel%. == 0. (set "doNotCopyForeignFileList=%doNotCopyForeignFileList%;msvcr%msvcXNum%.dll")
125
126if exist "%~dp0win%ARCH%\%VCVER%\bin%CASDEB%" (
127 set "preDLLPath=win%ARCH%\%VCVER%\bin%CASDEB%"
128) else if exist "%~dp0wnt\bin%CASDEB%" (
129 echo.
130 echo "%~dp0win%ARCH%\%VCVER%\bin%CASDEB% doesn't exist."
131 echo "%~dp0wnt\bin%CASDEB% folder has been chosen"
132 echo.
133 set "preDLLPath=wnt\bin%CASDEB%"
134) else (
135 echo.
136 echo "WOK dll folders (%~dp0win%ARCH%\%VCVER%\bin%CASDEB% ; %~dp0wnt\bin%CASDEB%) don't exist."
137 echo "Please enter the correct paths"
138 echo.
139 goto :eof
140)
141
142xcopy "%~dp0%preDLLPath%\*.dll" "%installPath%\lib\wnt\"
143if not %errorlevel%. == 0. (set "doNotCopyForeignFileList=bin *.dll")
144
24adf1e2 145call "%~dp0collect_binary_without_libs.bat" %installPath%
07f67898 146
147echo.
148echo =========end operation===========
149if not "%doNotCopyForeignFileList%" == "" (
150 echo "%doNotCopyForeignFileList% files has not been copied"
151)
152echo.