aboutsummaryrefslogtreecommitdiff
path: root/make-vc.cmd
diff options
context:
space:
mode:
Diffstat (limited to 'make-vc.cmd')
-rw-r--r--make-vc.cmd274
1 files changed, 274 insertions, 0 deletions
diff --git a/make-vc.cmd b/make-vc.cmd
new file mode 100644
index 0000000..2b4a7f6
--- /dev/null
+++ b/make-vc.cmd
@@ -0,0 +1,274 @@
1@REM
2@REM make-vc.cmd to build Lanes on Visual C++ 2005/08
3@REM
4@REM Requires: Windows XP or later (cmd.exe)
5@REM Visual C++ 2005/2008 (Express)
6@REM LuaBinaries 5.1.3 or Lua for Windows 5.1.3
7@REM
8
9@setlocal
10@set LUA_PATH=src\?.lua;tests\?.lua
11
12@if not "%LUA51%"=="" (
13 @goto LUA_OK
14)
15
16@REM *** Lua for Windows >=5.1.3.14 (%LUA_DEV%) ***
17@REM
18@if exist "%LUA_DEV%\lua.exe" (
19 @set LUA51=%LUA_DEV%
20 @goto LUA_OK
21)
22
23@REM *** Lua for Windows (default path) ***
24@REM
25@if exist "%ProgramFiles%\Lua\5.1\lua.exe" (
26 @set LUA51=%ProgramFiles:~0,2%\Progra~1\Lua\5.1
27 @goto LUA_OK
28)
29
30@REM *** LuaBinaries (default path) ***
31@REM
32@if exist "%ProgramFiles%\Lua5.1\lua5.1.exe" (
33 @set LUA51=%ProgramFiles:~0,2%\Progra~1\Lua5.1
34 @goto LUA_OK
35)
36
37goto ERR_NOLUA
38:LUA_OK
39
40@REM ---
41@REM %LUA_EXE% = %LUA51%\lua[5.1].exe
42@REM %LUAC_EXE% = %LUA51%\luac[5.1].exe
43@REM %LUA_LIB% = %LUA51%[\lib]
44@REM ---
45
46@set LUA_EXE=%LUA51%\lua5.1.exe
47@if exist "%LUA_EXE%" goto LUA_EXE_OK
48@set LUA_EXE=%LUA51%\lua.exe
49@if exist "%LUA_EXE%" goto LUA_EXE_OK
50@echo "Cannot find %LUA51%\lua[5.1].exe
51@goto EXIT
52:LUA_EXE_OK
53
54@set LUAC_EXE=%LUA51%\luac5.1.exe
55@if exist "%LUAC_EXE%" goto LUAC_EXE_OK
56@set LUAC_EXE=%LUA51%\luac.exe
57@if exist "%LUAC_EXE%" goto LUAC_EXE_OK
58@echo "Cannot find %LUA51%\luac[5.1].exe
59@goto EXIT
60:LUAC_EXE_OK
61
62
63@if "%1"=="" goto BUILD
64@if "%1"=="clean" goto CLEAN
65@if "%1"=="test" goto TEST
66@if "%1"=="launchtest" goto LAUNCHTEST
67@if "%1"=="perftest" goto PERFTEST
68@if "%1"=="perftest-plain" goto PERFTEST-PLAIN
69@if "%1"=="stress" goto STRESS
70@if "%1"=="basic" goto BASIC
71@if "%1"=="fifo" goto FIFO
72@if "%1"=="keeper" goto KEEPER
73@if "%1"=="atomic" goto ATOMIC
74@if "%1"=="cyclic" goto CYCLIC
75@if "%1"=="timer" goto TIMER
76@if "%1"=="recursive" goto RECURSIVE
77@if "%1"=="fibonacci" goto FIBONACCI
78@if "%1"=="hangtest" goto HANGTEST
79@if "%1"=="require" goto REQUIRE
80
81@echo Unknown target: %1
82@echo.
83@goto EXIT
84
85:BUILD
86@REM LuaBinaries:
87@REM The current build system does not show 'lua51-lanes.dll' to
88@REM be dependent on more than 'KERNEL32.DLL'. Good.
89@REM
90@REM Lua for Windows:
91@REM Depends on KERNEL32.DLL and LUA5.1.DLL. Good?
92
93@set LUA_LIB=%LUA51%
94@if exist "%LUA_LIB%\lua5.1.lib" (
95 @echo.
96 @echo ***
97 @echo *** Using Lua from: %LUA51%
98 @echo ***
99 @echo.
100 @goto LUA_LIB_OK
101)
102
103@set LUA_LIB=%LUA51%\lib
104@if exist "%LUA_LIB%\lua5.1.lib" (
105 @echo.
106 @echo ***
107 @echo *** Using Lua from: %LUA51%
108 @echo ***
109 @echo.
110 @goto LUA_LIB_OK
111)
112@echo Cannot find %LUA51%\[lib\]lua5.1.lib
113@goto EXIT
114:LUA_LIB_OK
115
116@REM
117@REM Precompile src/.lua -> .lch
118@REM
119@REM Note: we cannot use piping in Windows since we need binary output.
120@REM
121"%LUAC_EXE%" -o delme src/keeper.lua
122"%LUA_EXE%" tools/bin2c.lua -o src/keeper.lch delme
123@del delme
124
125@if "%VCINSTALLDIR%"=="" goto ERR_NOVC
126
127@REM
128@REM Win32 (Visual C++ 2005/08 Express) build commands
129@REM
130@REM MS itself has warnings in stdlib.h (4255), winbase.h (4668), several (4820, 4826)
131@REM 4054: "type cast from function pointer to data pointer"
132@REM 4127: "conditional expression is constant"
133@REM 4711: ".. selected for automatic inline expansion"
134@REM
135@set WARN=/Wall /wd4054 /wd4127 /wd4255 /wd4668 /wd4711 /wd4820 /wd4826
136
137@REM /LDd: debug DLL
138@REM /O2 /LD: release DLL
139@REM
140@set FLAGS=/O2 /LD
141
142cl %WARN% %FLAGS% /I "%LUA51%\include" /Felua51-lanes.dll src\*.c "%LUA_LIB%\lua5.1.lib"
143@REM cl %WARN% %FLAGS% /I "%LUA51%\include" /Felua51-lanes.dll src\*.c "%LUA_LIB%\lua5.1.lib" /link /NODEFAULTLIB:libcmt
144
145@del lua51-lanes.lib
146@del lua51-lanes.exp
147@goto EXIT
148
149:CLEAN
150if exist *.dll del *.dll
151if exist delme del delme
152@goto EXIT
153
154:TEST
155@REM "make test" does not automatically build/update the dll. We're NOT a makefile. :!
156@REM
157"%LUA_EXE%" tests\basic.lua
158@IF errorlevel 1 goto EXIT
159
160"%LUA_EXE%" tests\fifo.lua
161@IF errorlevel 1 goto EXIT
162
163"%LUA_EXE%" tests\keeper.lua
164@IF errorlevel 1 goto EXIT
165
166"%LUA_EXE%" tests\fibonacci.lua
167@IF errorlevel 1 goto EXIT
168
169"%LUA_EXE%" tests\timer.lua
170@IF errorlevel 1 goto EXIT
171
172"%LUA_EXE%" tests\atomic.lua
173@IF errorlevel 1 goto EXIT
174
175"%LUA_EXE%" tests\cyclic.lua
176@IF errorlevel 1 goto EXIT
177
178"%LUA_EXE%" tests\recursive.lua
179@IF errorlevel 1 goto EXIT
180
181@goto EXIT
182
183:BASIC
184"%LUA_EXE%" tests\basic.lua
185@goto EXIT
186
187:FIFO
188"%LUA_EXE%" tests\fifo.lua
189@goto EXIT
190
191:KEEPER
192"%LUA_EXE%" tests\keeper.lua
193@goto EXIT
194
195:ATOMIC
196"%LUA_EXE%" tests\atomic.lua
197@goto EXIT
198
199:CYCLIC
200"%LUA_EXE%" tests\cyclic.lua
201@goto EXIT
202
203:TIMER
204"%LUA_EXE%" tests\timer.lua
205@goto EXIT
206
207:RECURSIVE
208"%LUA_EXE%" tests\recursive.lua
209@goto EXIT
210
211:FIBONACCI
212"%LUA_EXE%" tests\fibonacci.lua
213@goto EXIT
214
215:HANGTEST
216"%LUA_EXE%" tests\hangtest.lua
217@goto EXIT
218
219:REQUIRE
220"%LUA_EXE%" -e "require'lanes'"
221@goto EXIT
222
223REM ---
224REM NOTE: 'timeit' is a funny thing; it does _not_ work with quoted
225REM long paths, but it _does_ work without the quotes. I have no idea,
226REM how it knows the spaces in paths apart from spaces in between
227REM parameters.
228
229:LAUNCHTEST
230timeit %LUA_EXE% tests\launchtest.lua %2 %3 %4
231@goto EXIT
232
233:PERFTEST
234timeit %LUA_EXE% tests\perftest.lua %2 %3 %4
235@goto EXIT
236
237:PERFTEST-PLAIN
238timeit %LUA_EXE% tests\perftest.lua --plain %2 %3 %4
239@goto EXIT
240
241:STRESS
242"%LUA_EXE%" tests\test.lua
243"%LUA_EXE%" tests\perftest.lua 100
244"%LUA_EXE%" tests\perftest.lua 50 -prio=-1,0
245"%LUA_EXE%" tests\perftest.lua 50 -prio=0,-1
246"%LUA_EXE%" tests\perftest.lua 50 -prio=0,2
247"%LUA_EXE%" tests\perftest.lua 50 -prio=2,0
248
249@echo All seems okay!
250@goto EXIT
251
252REM ---
253:ERR_NOLUA
254@echo ***
255@echo *** Please set LUA51 to point to either LuaBinaries or
256@echo *** Lua for Windows directory.
257@echo ***
258@echo *** http://luabinaries.luaforge.net/download.html
259@echo *** lua5_1_2_Win32_dll8_lib
260@echo *** lua5_1_2_Win32_bin
261@echo ***
262@echo *** http://luaforge.net/frs/?group_id=377&release_id=1138
263@echo ***
264@echo.
265@goto EXIT
266
267:ERR_NOVC
268@echo ***
269@echo *** VCINSTALLDIR not defined; please run 'setup-vc'
270@echo ***
271@echo.
272@goto EXIT
273
274:EXIT