source: snovis/trunk/obuild/DOS/build_dll_snovis.bat @ 276

Last change on this file since 276 was 276, checked in by barrand, 17 years ago
  • Property svn:executable set to *
File size: 9.2 KB
Line 
1@ECHO OFF
2SETLOCAL
3
4REM #
5REM # File produced by the obuild tool version 1.0
6REM # for the package snovis with version v1r1.
7REM #
8
9REM #////////////////////////////////////////////////
10REM # Usage :
11REM #   DOS> CD some_path\pack\version\obuild
12REM #   DOS> DOS\build_snovis
13REM #
14REM #////////////////////////////////////////////////
15
16REM #////////////////////////////////////////////////
17REM #/// Get path of this file :
18REM #////////////////////////////////////////////////
19SET obuild_snovis_path=%~dp0
20REM # Remove ending \obuild\DOS\
21SET obuild_snovis_path=%obuild_snovis_path:~0,-12%
22
23REM #////////////////////////////////////////////////
24REM #/// Treat arguments :
25REM #////////////////////////////////////////////////
26
27SET obuild_verbose=no
28SET obuild_debug=no
29SET obuild_optimize=yes
30SET obuild_set_x=no
31
32:next_arg
33IF "%1%" == "" GOTO end_args
34
35IF NOT "%1%" == "-v" GOTO end_if_v
36  SET obuild_verbose=yes
37  SHIFT
38  GOTO next_arg
39:end_if_v
40
41IF NOT "%1%" == "-g" GOTO end_if_g
42  SET obuild_debug=yes
43  SHIFT
44  GOTO next_arg
45:end_if_g
46
47IF NOT "%1%" == "-x" GOTO end_if_x
48  SET obuild_set_x=yes
49  SHIFT
50  GOTO next_arg
51:end_if_x
52
53:end_args
54
55REM #////////////////////////////////////////////////
56REM #/// End arguments.
57REM #////////////////////////////////////////////////
58
59IF %obuild_set_x% == yes ECHO ON
60
61IF %obuild_debug% == yes SET obuild_optimize=no
62
63IF "%OBUILD_PLATFORM%" == "" (
64  IF "%OS%" == "" ECHO Environment variable OS not found. & GOTO obuild_return
65  SET obuild_platform=%OS%
66) ELSE (
67  SET obuild_platform=%OBUILD_PLATFORM%
68)
69
70IF "%obuild_platform%" == "" (
71  ECHO obuild_platform variable not defined.
72  GOTO obuild_return
73)
74
75IF "%OBUILD_DIR_BIN%" == "" (
76  SET obuild_dir_bin=bin_obuild
77) ELSE (
78  SET obuild_dir_bin=%OBUILD_DIR_BIN%
79)
80
81IF "%obuild_dir_bin%" == "" (
82  ECHO obuild_dir_bin variable not defined.
83  GOTO obuild_return
84)
85
86IF NOT EXIST "%obuild_snovis_path%\%obuild_dir_bin%" MKDIR "%obuild_snovis_path%\%obuild_dir_bin%"
87
88IF NOT EXIST "%obuild_snovis_path%\%obuild_dir_bin%" MKDIR "%obuild_snovis_path%\%obuild_dir_bin%"
89IF NOT EXIST "%obuild_snovis_path%\%obuild_dir_bin%\obuild_platform.exe" (
90  cl.exe /nologo /DWIN32 /MD /O2 /W3  /GX /GR /Fe"%obuild_snovis_path%\%obuild_dir_bin%\obuild_platform.exe" "%obuild_snovis_path%\obuild\cpp\obuild_platform.cpp" 1> NUL
91  IF EXIST obuild_platform.obj DEL obuild_platform.obj
92)
93
94FOR /F "usebackq delims=;" %%d IN (`cd`) DO SET obuild_pwd_snovis_0=%%d
95cd "%obuild_snovis_path%\%obuild_dir_bin%"
96IF NOT EXIST .\obuild_platform.exe  ECHO Program obuild_platform.exe not found.  && GOTO obuild_return
97FOR /F "usebackq" %%j IN (`.\obuild_platform.exe  %obuild_platform% Windows_NT`) DO SET obuild_platform_result=%%j
98cd "%obuild_pwd_snovis_0%"
99SET obuild_pwd_snovis_0=
100IF NOT %obuild_platform_result% == yes GOTO end_if_platform_0
101SET obuild_cxx_command=cl.exe
102:end_if_platform_0
103SET obuild_platform_result=
104IF "%obuild_cxx_command%" == ""  ECHO Variable obuild_cxx_command not defined.  && GOTO obuild_return
105
106FOR /F "usebackq delims=;" %%d IN (`cd`) DO SET obuild_pwd_snovis_0=%%d
107cd "%obuild_snovis_path%\%obuild_dir_bin%"
108IF NOT EXIST .\obuild_platform.exe  ECHO Program obuild_platform.exe not found.  && GOTO obuild_return
109FOR /F "usebackq" %%j IN (`.\obuild_platform.exe  %obuild_platform% Windows_NT`) DO SET obuild_platform_result=%%j
110cd "%obuild_pwd_snovis_0%"
111SET obuild_pwd_snovis_0=
112IF NOT %obuild_platform_result% == yes GOTO end_if_platform_1
113SET obuild_cxx_optimize=/O2
114:end_if_platform_1
115SET obuild_platform_result=
116
117FOR /F "usebackq delims=;" %%d IN (`cd`) DO SET obuild_pwd_snovis_0=%%d
118cd "%obuild_snovis_path%\%obuild_dir_bin%"
119IF NOT EXIST .\obuild_platform.exe  ECHO Program obuild_platform.exe not found.  && GOTO obuild_return
120FOR /F "usebackq" %%j IN (`.\obuild_platform.exe  %obuild_platform% Windows_NT`) DO SET obuild_platform_result=%%j
121cd "%obuild_pwd_snovis_0%"
122SET obuild_pwd_snovis_0=
123IF NOT %obuild_platform_result% == yes GOTO end_if_platform_2
124SET obuild_cxx_debug=/ZI /Od
125:end_if_platform_2
126SET obuild_platform_result=
127
128FOR /F "usebackq delims=;" %%d IN (`cd`) DO SET obuild_pwd_snovis_0=%%d
129cd "%obuild_snovis_path%\%obuild_dir_bin%"
130IF NOT EXIST .\obuild_platform.exe  ECHO Program obuild_platform.exe not found.  && GOTO obuild_return
131FOR /F "usebackq" %%j IN (`.\obuild_platform.exe  %obuild_platform% Windows_NT`) DO SET obuild_platform_result=%%j
132cd "%obuild_pwd_snovis_0%"
133SET obuild_pwd_snovis_0=
134IF NOT %obuild_platform_result% == yes GOTO end_if_platform_3
135SET obuild_cxx_options=/nologo /DWIN32 /MD /GX /GR /W3
136:end_if_platform_3
137SET obuild_platform_result=
138
139IF NOT %obuild_debug% == yes GOTO else_if_db_build_dll_snovis_sh_4
140  SET obuild_cxx_debug_local=%obuild_cxx_debug%
141  GOTO end_if_db_build_dll_snovis_sh_4
142:else_if_db_build_dll_snovis_sh_4
143  SET obuild_cxx_debug_local=
144:end_if_db_build_dll_snovis_sh_4
145
146IF NOT %obuild_optimize% == yes GOTO else_if_opt_build_dll_snovis_sh_5
147  SET obuild_cxx_optimize_local=%obuild_cxx_optimize%
148  GOTO end_if_opt_build_dll_snovis_sh_5
149:else_if_opt_build_dll_snovis_sh_5
150  SET obuild_cxx_optimize_local=
151:end_if_opt_build_dll_snovis_sh_5
152
153
154
155SET obuild_cxx_includes=/I"%obuild_snovis_path%"
156SET obuild_cxx_includes=%obuild_cxx_includes% /I"%obuild_snovis_path%\source"
157
158IF EXIST "%obuild_snovis_path%\%obuild_dir_bin%\dll_snovis" RMDIR /S /Q "%obuild_snovis_path%\%obuild_dir_bin%\dll_snovis"
159IF NOT EXIST "%obuild_snovis_path%\%obuild_dir_bin%\dll_snovis" MKDIR "%obuild_snovis_path%\%obuild_dir_bin%\dll_snovis"
160
161@IF %obuild_verbose% == yes @ECHO ON
162cd "%obuild_snovis_path%\%obuild_dir_bin%"
163%obuild_cxx_command% /c %obuild_cxx_debug_local% %obuild_cxx_optimize_local% %obuild_cxx_options% %obuild_cxx_macros% %obuild_cxx_includes% /Fo.\dll_snovis\Callbacks.obj  /Tp"..\source\Callbacks.cxx" 1> cl_exe_error
164@IF ERRORLEVEL 1 @TYPE cl_exe_error && @GOTO obuild_return
165@IF NOT ERRORLEVEL 1 @DEL cl_exe_error
166cd "%obuild_snovis_path%\obuild"
167
168cd "%obuild_snovis_path%\%obuild_dir_bin%"
169%obuild_cxx_command% /c %obuild_cxx_debug_local% %obuild_cxx_optimize_local% %obuild_cxx_options% %obuild_cxx_macros% %obuild_cxx_includes% /Fo.\dll_snovis\InventorCallbacks.obj  /Tp"..\source\InventorCallbacks.cxx" 1> cl_exe_error
170@IF ERRORLEVEL 1 @TYPE cl_exe_error && @GOTO obuild_return
171@IF NOT ERRORLEVEL 1 @DEL cl_exe_error
172cd "%obuild_snovis_path%\obuild"
173
174cd "%obuild_snovis_path%\%obuild_dir_bin%"
175%obuild_cxx_command% /c %obuild_cxx_debug_local% %obuild_cxx_optimize_local% %obuild_cxx_options% %obuild_cxx_macros% %obuild_cxx_includes% /Fo.\dll_snovis\Layouts.obj  /Tp"..\source\Layouts.cxx" 1> cl_exe_error
176@IF ERRORLEVEL 1 @TYPE cl_exe_error && @GOTO obuild_return
177@IF NOT ERRORLEVEL 1 @DEL cl_exe_error
178cd "%obuild_snovis_path%\obuild"
179
180@IF %obuild_verbose% == yes @ECHO OFF
181
182SET obuild_linked_libraries=-L${Geant4_home}/lib -lG4physicslists
183FOR /F "usebackq delims=;" %%d IN (`cd`) DO SET obuild_pwd_snovis_0=%%d
184cd "%obuild_snovis_path%\%obuild_dir_bin%"
185IF NOT EXIST .\obuild_platform.exe  ECHO Program obuild_platform.exe not found.  && GOTO obuild_return
186FOR /F "usebackq" %%j IN (`.\obuild_platform.exe  %obuild_platform% Windows_NT`) DO SET obuild_platform_result=%%j
187cd "%obuild_pwd_snovis_0%"
188SET obuild_pwd_snovis_0=
189IF NOT %obuild_platform_result% == yes GOTO end_if_platform_12
190SET obuild_linked_libraries=%obuild_linked_libraries% glu32.lib opengl32.lib gdi32.lib user32.lib
191:end_if_platform_12
192SET obuild_platform_result=
193
194FOR /F "usebackq delims=;" %%d IN (`cd`) DO SET obuild_pwd_snovis_0=%%d
195cd "%obuild_snovis_path%\%obuild_dir_bin%"
196IF EXIST .\dll_snovis\tmp_objs DEL .\dll_snovis\tmp_objs
197FOR %%f IN (.\dll_snovis\*.obj) DO ECHO %%f >> .\dll_snovis\tmp_objs
198
199REM # Create the archive library snovis :
200@IF %obuild_verbose% == yes @ECHO ON
201lib.exe /nologo /machine:ix86 /out:.\dll_snovis\snovis.arc @.\dll_snovis\tmp_objs
202@IF ERRORLEVEL 1 @GOTO obuild_return
203@IF %obuild_verbose% == yes @ECHO OFF
204
205REM # Build the obuild_windef.exe utility program :
206cl.exe /nologo /DWIN32 /MD /O2 /W3 /Feobuild_windef.exe "%obuild_snovis_path%\obuild\cpp\obuild_windef.c" 1> NUL
207IF EXIST obuild_windef.obj DEL obuild_windef.obj
208
209REM # Building the .def file :
210@IF %obuild_verbose% == yes @ECHO ON
211dumpbin.exe /symbols /out:.\dll_snovis\tmp .\dll_snovis\snovis.arc 1> dumpbin_exe_error .\dll_snovis\snovis.arc
212@IF ERRORLEVEL 1 @TYPE dumpbin_exe_error && @GOTO obuild_return
213@IF NOT ERRORLEVEL 1 @DEL dumpbin_exe_error
214@IF %obuild_verbose% == yes @ECHO OFF
215.\obuild_windef.exe snovis < .\dll_snovis\tmp > .\dll_snovis\snovis.def
216REM # Building the linking library :
217REM # It produces a .exp file.
218@IF %obuild_verbose% == yes @ECHO ON
219lib.exe /nologo /machine:ix86 /out:.\dll_snovis\snovis.lib /def:.\dll_snovis\snovis.def 1> lib_exe_error
220@IF ERRORLEVEL 1 @TYPE lib_exe_error && @GOTO obuild_return
221@IF NOT ERRORLEVEL 1 @DEL lib_exe_error
222@IF %obuild_verbose% == yes @ECHO OFF
223
224REM # Building the DLL :
225IF EXIST .\snovis.dll DEL .\snovis.dll
226@IF %obuild_verbose% == yes @ECHO ON
227link.exe /nologo /dll /out:.\snovis.dll .\dll_snovis\snovis.exp .\dll_snovis\snovis.arc %obuild_linked_libraries%
228@IF %obuild_verbose% == yes @ECHO OFF
229
230cd "%obuild_pwd_snovis_0%"
231SET obuild_pwd_snovis_0=
232REM # Some cleanup :
233IF EXIST "%obuild_snovis_path%\%obuild_dir_bin%\dll_snovis\tmp_objs" DEL "%obuild_snovis_path%\%obuild_dir_bin%\dll_snovis\tmp_objs"
234IF EXIST "%obuild_snovis_path%\%obuild_dir_bin%\snovis.exp" DEL "%obuild_snovis_path%\%obuild_dir_bin%\snovis.exp"
235
236:obuild_return
237ENDLOCAL
238@ECHO ON
Note: See TracBrowser for help on using the repository browser.