c1_unity/Doc/集成xlua.md
2023-04-03 11:04:31 +08:00

1.2 KiB

集成xlua

xlua下载地址:https://github.com/Tencent/xLua
xlua集成三方库的示例:https://github.com/chexiongsheng/build_xlua_with_libs
使用前参考faq:https://github.com/Tencent/xLua/blob/master/Assets/XLua/Doc/faq.md
修改源码使用通用字节码:https://github.com/Tencent/xLua/blob/master/Assets/XLua/Doc/compatible_bytecode.md

主要改动:

  1. lua版本使用lua5.4.3, 需要将需要的make脚本里的LUA_VERSION=5.4.1改为LUA_VERSION=5.4.3
  2. 修改成通用字节码,需要在需要的平台的make脚本里增加-DLUAC_COMPATIBLE_FORMAT=ON参数:
mkdir -p build_osx_54 && cd build_osx_54
cmake -DLUA_VERSION=5.4.3 -GXcode ../
cd ..
cmake --build build_osx_54 --config Release
mkdir -p plugin_lua54/Plugins/xlua.bundle/Contents/MacOS/
cp build_osx_54/Release/xlua.bundle/Contents/MacOS/xlua plugin_lua54/Plugins/xlua.bundle/Contents/MacOS/xlua

改为

mkdir -p build_osx_54 && cd build_osx_54
cmake -DLUAC_COMPATIBLE_FORMAT=ON -DLUA_VERSION=5.4.3 -GXcode ../
cd ..
cmake --build build_osx_54 --config Release
mkdir -p plugin_lua54/Plugins/xlua.bundle/Contents/MacOS/
cp build_osx_54/Release/xlua.bundle/Contents/MacOS/xlua plugin_lua54/Plugins/xlua.bundle/Contents/MacOS/xlua
  1. 集成rapidjson
  2. 集成lua-protobuf