Luajit编译

2020/07 08 12:07

1、下载
https://luajit.org/download.html

2、找到VC编译命令行,以VS2019为例,分别位于

C:\ProgramData\Microsoft\Windows\Start Menu\Programs\Visual Studio 019\Visual Studio Tools\VC\x64 Native Tools Command Prompt for VS 2019

C:\ProgramData\Microsoft\Windows\Start Menu\Programs\Visual Studio 2019\Visual Studio Tools\VC\x86 Native Tools Command Prompt for VS 2019

其实分别调用的是:

cmd /k "d:\Program Files (x86)\Microsoft Visual Studio\2019\Community\VC\Auxiliary\Build\vcvars64.bat"

cmd /k "d:\Program Files (x86)\Microsoft Visual Studio\2019\Community\VC\Auxiliary\Build\vcvars32.bat"

3、编译64位版本,运行x64 Native Tools Command Prompt for VS 2019,进入到luajit-2.1/src目录中,查看msvcbuild.bat,里面有
@if “%1″==”static” goto :STATIC
即输入参数可以为static
执行:msvcbuild.bat static 即可编译生成 luajit.exe 64位版本,exe位于luajit-2.1目录中

4、编译32位版,则运行x86 Native Tools Command Prompt for VS 2019,再进入scr目录,再运行msvcbuild.bat static可生成luajit.exe 32位版本

msvcbuild.bat gc64 生成64位版本

luajit.exe -b input.lua output.lua
和以下是一样的
local bytecode=string.dump(loadstring(”))
io.ope(dst,”w+b”):write(bytecode)

--转载请注明: http://blog.coolcoding.cn/?p=2065

发表回复

欢迎回来 (打开)

(必填)