使用visual studio2010生成lua动态链接库
程序员文章站
2022-06-17 10:53:13
...
编辑windows批处理脚本 vslua.bat
@echo off
md bin
md lib
md include
cd src
cl /c /nologo /W3 /O2 /Ob1 /Oi /Gs /MD /D_CRT_SECURE_NO_DEPRECATE l*.c
ren lua.obj lua.o
ren luac.obj luac.o
lib /OUT:lua53.lib *.obj
copy lua53.lib ..\lib\lua53.lib
del *.o *.obj *.exp *.lib *.dll *.exe
cl /c /nologo /W3 /O2 /Ob1 /Oi /Gs /MD /D_CRT_SECURE_NO_DEPRECATE /DLUA_BUILD_AS_DLL l*.c
ren lua.obj lua.o
ren luac.obj luac.o
link /DLL /IMPLIB:lua53.lib /OUT:lua53.dll *.obj
link /OUT:lua53.exe lua.o lua53.lib
link /OUT:luac53.exe luac.o *.obj
copy lua53.exp ..\bin\lua53.exp
copy lua53.lib ..\bin\lua53.lib
copy lua53.dll ..\bin\lua53.dll
copy lua53.exe ..\bin\lua53.exe
copy luac53.exe ..\bin\luac53.exe
del *.o *.obj *.exp *.lib *.dll *.exe
copy lauxlib.h ..\include\lauxlib.h
copy lua.h ..\include\lua.h
copy lua.hpp ..\include\lua.hpp
copy luaconf.h ..\include\luaconf.h
copy lualib.h ..\include\lualib.h
cd ..\
visual studio操作步骤
打开vs2010,工具-》Visual Studio命令提示,打开vs开发人员命令提示,执行脚本。
cd e:\lua-5.3.5 进入lua源码目录
dir 当前目录文件结构,包含src源码目录
vslua.bat 执行脚本
会在当前目录生成bin include lib文件夹,把文件夹拷贝到应用目录即可使用