Window下编译Lua源码:
源码下载:
http://www.lua.org/download.html
编译参考:
http://www.lua.org/manual/5.3/readme.html
编译工具: VS005
编译方法: 编写bat脚本调用cl.exe
脚本如下:
@echo off
@rem Build Lua Src 5.3 by mkLua.bat
@rem Script to build Lua under "Visual Studio .NET Command Prompt".
@rem run it from the toplevel: mkLua.bat .
@rem It creates lua53.dll, lua53.lib, lua.exe, and luac.exe in src.
@rem (contributed by Garfield)
@setlocal
@set MYCOMPILE=cl /nologo /MD /O2 /W3 /c /D_CRT_SECURE_NO_DEPRECATE
@set MYLINK=link /nologo
@set MYMT=mt /nologo
%MYCOMPILE% /DLUA_BUILD_AS_DLL l*.c
ren lua.obj lua.o
ren luac.obj luac.o
%MYLINK% /DLL /out:lua53.dll l*.obj
if exist lua53.dll.manifest^
%MYMT% -manifest lua53.dll.manifest -outputresource:lua53.dll;2
%MYLINK% /out:lua.exe lua.o lua53.lib
if exist lua.exe.manifest^
%MYMT% -manifest lua.exe.manifest -outputresource:lua.exe
%MYLINK% /out:luac.exe luac.o *.obj
if exist luac.exe.manifest^
%MYMT% -manifest luac.exe.manifest -outputresource:luac.exe
del *.obj *.manifest *.o *.exp
脚本放到源码src目录中,打开Visual Studio 2005 Command Prompt命令行,进入该目录,执行mkLua.bat后,同目录中可生成(lua53.dll, lua53.lib, lua.exe, and luac.exe),