| 1 |
@if not defined INCLUDE goto :FAIL |
| 2 |
|
| 3 |
@setlocal |
| 4 |
|
| 5 |
@if "%1"=="debug-5.1" goto :DEBUG_5_1 |
| 6 |
|
| 7 |
rem These should not have quotes |
| 8 |
@set LUA_INCLUDE=Z:\c\lua-5.2.0\src |
| 9 |
@set LUA_LIB=Z:\c\lua-5.2.0\lua5.2.lib |
| 10 |
@set LUA_EXE=Z:\c\lua-5.2.0\lua.exe |
| 11 |
rem This the name of the dll that can be handed to LoadLibrary. This should not have a path. |
| 12 |
@set LUA_DLL=lua5.2.dll |
| 13 |
@goto :DEBUG |
| 14 |
|
| 15 |
:DEBUG_5_1 |
| 16 |
@set LUA_INCLUDE=Z:\c\lua-5.1.4\src |
| 17 |
@set LUA_LIB=Z:\c\lua-5.1.4\lua5.1.lib |
| 18 |
@set LUA_EXE=Z:\c\lua-5.1.4\lua.exe |
| 19 |
@set LUA_DLL=lua5.1.dll |
| 20 |
|
| 21 |
:DEBUG |
| 22 |
@set DO_CL=cl.exe /nologo /c /MDd /FC /Zi /Od /W3 /WX /D_CRT_SECURE_NO_DEPRECATE /DLUA_FFI_BUILD_AS_DLL /I"msvc" |
| 23 |
@set DO_LINK=link /nologo /debug |
| 24 |
@set DO_MT=mt /nologo |
| 25 |
|
| 26 |
@if "%1"=="debug" goto :COMPILE |
| 27 |
@if "%1"=="debug-5.1" goto :COMPILE |
| 28 |
@if "%1"=="test" goto :COMPILE |
| 29 |
@if "%1"=="clean" goto :CLEAN |
| 30 |
@if "%1"=="release" goto :RELEASE |
| 31 |
@if "%1"=="test-release" goto :RELEASE |
| 32 |
|
| 33 |
:RELEASE |
| 34 |
@set DO_CL=cl.exe /nologo /c /MD /Ox /W3 /Zi /WX /D_CRT_SECURE_NO_DEPRECATE /DLUA_FFI_BUILD_AS_DLL /I"msvc" |
| 35 |
@set DO_LINK=link.exe /nologo /debug |
| 36 |
@set DO_MT=mt.exe /nologo |
| 37 |
@goto :COMPILE |
| 38 |
|
| 39 |
:COMPILE |
| 40 |
"%LUA_EXE%" dynasm\dynasm.lua -LNE -D X32WIN -o call_x86.h call_x86.dasc |
| 41 |
"%LUA_EXE%" dynasm\dynasm.lua -LNE -D X64 -o call_x64.h call_x86.dasc |
| 42 |
"%LUA_EXE%" dynasm\dynasm.lua -LNE -D X64 -D X64WIN -o call_x64win.h call_x86.dasc |
| 43 |
"%LUA_EXE%" dynasm\dynasm.lua -LNE -o call_arm.h call_arm.dasc |
| 44 |
%DO_CL% /I"." /I"%LUA_INCLUDE%" /DLUA_DLL_NAME="%LUA_DLL%" call.c ctype.c ffi.c parser.c |
| 45 |
%DO_LINK% /DLL /OUT:ffi.dll "%LUA_LIB%" *.obj |
| 46 |
if exist ffi.dll.manifest^ |
| 47 |
%DO_MT% -manifest ffi.dll.manifest -outputresource:"ffi.dll;2" |
| 48 |
|
| 49 |
%DO_CL% /Gd test.c /Fo"test_cdecl.obj" |
| 50 |
%DO_CL% /Gz test.c /Fo"test_stdcall.obj" |
| 51 |
%DO_CL% /Gr test.c /Fo"test_fastcall.obj" |
| 52 |
%DO_LINK% /DLL /OUT:test_cdecl.dll test_cdecl.obj |
| 53 |
%DO_LINK% /DLL /OUT:test_stdcall.dll test_stdcall.obj |
| 54 |
%DO_LINK% /DLL /OUT:test_fastcall.dll test_fastcall.obj |
| 55 |
if exist test_cdecl.dll.manifest^ |
| 56 |
%DO_MT% -manifest test_cdecl.dll.manifest -outputresource:"test_cdecl.dll;2" |
| 57 |
if exist test_stdcall.dll.manifest^ |
| 58 |
%DO_MT% -manifest test_stdcall.dll.manifest -outputresource:"test_stdcall.dll;2" |
| 59 |
if exist test_fastcall.dll.manifest^ |
| 60 |
%DO_MT% -manifest test_fastcall.dll.manifest -outputresource:"test_fastcall.dll;2" |
| 61 |
|
| 62 |
@if "%1"=="test" "%LUA_EXE%" test.lua |
| 63 |
@if "%1"=="test-5.2" "%LUA_EXE%" test.lua |
| 64 |
@if "%1"=="test-release" "%LUA_EXE%" test.lua |
| 65 |
@goto :CLEAN_OBJ |
| 66 |
|
| 67 |
:CLEAN |
| 68 |
del *.dll |
| 69 |
:CLEAN_OBJ |
| 70 |
del *.obj *.manifest |
| 71 |
@goto :END |
| 72 |
|
| 73 |
:FAIL |
| 74 |
@echo You must open a "Visual Studio .NET Command Prompt" to run this script |
| 75 |
:END |
| 76 |
|