07f67898 |
1 | @echo off |
2 | Setlocal EnableDelayedExpansion |
3 | |
4 | set COPYCMD=/Y |
5 | |
6 | rem %1 - vcver |
7 | rem %2 - arch |
8 | rem %3 - debug&release |
9 | rem %4 - related package name |
10 | |
07f67898 |
11 | set "installPath=package" |
12 | |
13 | set configFile=collect_binary.cfg |
14 | if exist %configFile% ( |
15 | for /f "delims=" %%x in (%configFile%) do (set "%%x") |
16 | ) |
17 | |
944cf326 |
18 | if not "%1" == "" set "cmdArg1=%1" |
19 | if not "%2" == "" set "cmdArg2=%2" |
20 | if not "%3" == "" set "cmdArg3=%3" |
21 | if not "%4" == "" set "installPath=%4" |
22 | |
07f67898 |
23 | rem if command line is empty and config file is not exist |
24 | if "%cmdArg1%" == "" goto :eofWithEcho |
25 | if "%cmdArg2%" == "" goto :eofWithEcho |
26 | if "%cmdArg3%" == "" goto :eofWithEcho |
27 | |
28 | goto :GoOn |
29 | |
30 | :eofWithEcho |
31 | echo Some arguments are empty. Please try again. For example, |
32 | echo %0 vc10 64 release installDirRelatedPath |
33 | goto :eof |
34 | |
35 | :GoOn |
36 | |
37 | echo. |
944cf326 |
38 | echo "args are: %cmdArg1% %cmdArg2% %cmdArg3% %installPath% |
07f67898 |
39 | echo. |
40 | |
07f67898 |
41 | rem Setup environment |
42 | call "%~dp0env.bat" %cmdArg1% %cmdArg2% %cmdArg3% |
43 | |
44 | if "%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 | |
56 | set "TCL_LIB_PATH=" |
57 | for %%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 | |
78 | if "%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 | |
99 | set "doNotCopyForeignFileList=" |
100 | |
101 | if 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 |
117 | xcopy "%CASROOT%\%preOCCDLLPath%\TKernel.dll" "%installPath%\lib\wnt\" |
118 | if not %errorlevel%. == 0. (set "doNotCopyForeignFileList=%doNotCopyForeignFileList%;TKernel.dll") |
119 | |
120 | xcopy "%VSDir%..\..\VC\redist\%xBit%\Microsoft.%VCVER%0.CRT\msvcp%msvcXNum%.dll" "%installPath%\lib\wnt\" |
121 | if not %errorlevel%. == 0. (set "doNotCopyForeignFileList=%doNotCopyForeignFileList%;msvcp%msvcXNum%.dll") |
122 | |
123 | xcopy "%VSDir%..\..\VC\redist\%xBit%\Microsoft.%VCVER%0.CRT\msvcr%msvcXNum%.dll" "%installPath%\lib\wnt\" |
124 | if not %errorlevel%. == 0. (set "doNotCopyForeignFileList=%doNotCopyForeignFileList%;msvcr%msvcXNum%.dll") |
125 | |
126 | if 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 | |
142 | xcopy "%~dp0%preDLLPath%\*.dll" "%installPath%\lib\wnt\" |
143 | if not %errorlevel%. == 0. (set "doNotCopyForeignFileList=bin *.dll") |
144 | |
24adf1e2 |
145 | call "%~dp0collect_binary_without_libs.bat" %installPath% |
07f67898 |
146 | |
147 | echo. |
148 | echo =========end operation=========== |
149 | if not "%doNotCopyForeignFileList%" == "" ( |
150 | echo "%doNotCopyForeignFileList% files has not been copied" |
151 | ) |
152 | echo. |