下载 Source Code 后,build 目录为链接库源码 及 编译脚本。
|所有编译脚本都是按这个方式命名:make_平台_lua版本.后缀。
重新编译原因
旧版本的xLua为 Lua 53,则继续使用 Lua 53 版本,从 GitHub 下载后,使用新的 xLua 链接库运行后报错
format mismatch in precompile chunk
因此需重新编译链接库,设置为格式兼容 LUAC_COMPATIBLE_FORMAT
Windows 平台
windows 64位lua53版本是make_win64_lua53.bat
第一步,下载安装 Android Studio
第二步,从 Android Studio 更新 Android SDK
SDK Manager -> SDK Platforms -> 勾选需要的版本,如 Android 11.0(R)
第三步,从 Android Studio 更新 Android NDK
SDK Tools -> NDK (Side by side) -> 勾选需要的版本,如 24.0
第四步,下载编译工具 CMake
第五步,下载默认 Generators 版本 Visual Studio 2017
第六步,配置Windows环境变量
第七步,修改 make_win64_lua53.bat,增加版本格式兼容参数
cmake -G "Visual Studio 15 2017 Win64" ..
改为
cmake -DLUAC_COMPATIBLE_FORMAT=ON -G "Visual Studio 15 2017 Win64" ..
cmake -DLUAC_COMPATIBLE_FORMAT=ON -G "Visual Studio 15 2017 Win64" ..
Android 平台
在 macOS 下编译 Android 链接库
make_android_lua53.sh 编译 android 平台
第一步,下载安装 Android Studio
第二步,从 Android Studio 更新 Android SDK
SDK Manager -> SDK Platforms -> 勾选需要的版本,如 Android 11.0(R)
第三步,从 Android Studio 更新 Android NDK
SDK Tools -> NDK (Side by side) -> 勾选需要的版本,如 24.0
第四步,下载编译工具 CMake
brew search cmake (搜索 cmake)
brew install cmake (安装 cmake)
cmake --version (查看 cmake 版本,表示安装成功)
第五步,设置 xcode-select 命令行工具
sudo xcode-select --switch /Applications/Xcode.app/Contents/Developer
第六步,cd 进入 xLua 工程的 build 目录
第七步,配置 build 目录 NDK 环境
1. 启动终端 Terminal,cd 进入 build 所在目录
2. 输入 touch .bash_profile,创建.bash_profile
3. 输入 open -e .bash_profile,编辑.bash_profile
4. 输入 source .bash_profile,生效.bash_profile
第八步,将 make_ios_lua53.sh 拖入控制台,运行
生成的库文件位置 plugin_lua53
iOS 平台
在 macOS 下编译 iOS 链接库,默认 Generators 为 XCode。
make_ios_lua53.sh 编译 iOS 平台
步驟類似Android