72c37458 |
1 | @echo off |
2 | |
3 | rem Helper script to configure environment for building with genproj tool. |
4 | rem Running it requires that Tcl should be in the PATH |
5 | |
6 | SET "OLD_PATH=%PATH%" |
7 | |
8 | rem create env.bat if it does not exist yet |
d6cda17a |
9 | if not exist "%~dp0env.bat" ( |
72c37458 |
10 | type "%~dp0adm\templates\env.bat" | findstr /i /v "__CASROOT__" > "%~dp0env.bat" |
11 | ) |
d6cda17a |
12 | call "%~dp0env.bat" |
72c37458 |
13 | |
14 | rem find Tcl |
15 | set "TCL_EXEC=tclsh.exe" |
16 | for %%X in (%TCL_EXEC%) do (set TCL_FOUND=%%~$PATH:X) |
17 | |
18 | set "TCL_EXEC2=tclsh86.exe" |
19 | if not defined TCL_FOUND ( |
20 | for %%X in (%TCL_EXEC2%) do ( |
21 | set TCL_FOUND=%%~$PATH:X |
22 | set TCL_EXEC=%TCL_EXEC2% |
23 | ) |
24 | ) |
25 | |
26 | rem Prompt the user to specify location of Tcl if not found in PATH |
27 | if not defined TCL_FOUND ( |
28 | set /P TCL_PATH=This script requires Tcl, but tclsh.exe cannot be found in PATH.^ |
29 | |
30 | Please enter path to folder containing tclsh.exe^ |
31 | |
32 | ^: |
33 | rem NOTE: KEEP LINE AFTER "set" ABOVE EMPTY ! |
34 | ) |
35 | |
36 | if exist %TCL_PATH%\tclsh.exe ( |
37 | set "TCL_FOUND=%TCL_PATH%\tclsh.exe" |
38 | ) else if exist %TCL_PATH%\tclsh86.exe ( |
39 | set "TCL_FOUND=%TCL_PATH%\tclsh86.exe" |
40 | ) else ( |
41 | set "TCL_EXEC=%TCL_PATH%\tclsh.exe" |
42 | ) |
43 | |
44 | rem Initialize custom.bat if it does not exist yet |
45 | rem if not exist %%dp0custom.bat ( |
46 | rem echo set "PATH=%%PATH%%;%TCL_PATH%" >%~dp0custom.bat |
47 | rem ) |
48 | |
49 | rem fail if Tcl is not found |
50 | if not defined TCL_FOUND ( |
51 | echo Error: "%TCL_EXEC%" is not found. Please update PATH variable ^(use custom.bat^) |
52 | goto :eof |
53 | ) |
54 | |
d6cda17a |
55 | rem run GUI tool |
4b3541c6 |
56 | "%TCL_FOUND%" %~dp0adm/genconf.tcl |
72c37458 |
57 | |
58 | SET "PATH=%OLD_PATH%" |