Coder Social home page Coder Social logo

chexiongsheng / build_xlua_with_libs Goto Github PK

View Code? Open in Web Editor NEW
566.0 37.0 237.0 43.35 MB

为xLua集成几个常用库,方便使用

License: MIT License

C# 3.79% PureBasic 0.01% CMake 1.45% C 63.96% C++ 7.04% HTML 14.76% Makefile 0.72% Lua 7.34% Roff 0.22% CSS 0.18% Batchfile 0.39% Shell 0.14%
xlua pbc rapidjson lpeg

build_xlua_with_libs's Introduction

xLua常用库集成

lua-protobuf

https://github.com/starwing/lua-protobuf

ps:如果需要用pbc的,可以修改编译参数指定改为用pbc,以window 64位为例,打开make_win64_lua53.bat,找到这行:

cmake -G "Visual Studio 14 2015 Win64" ..

修改为

cmake -DPBC=ON -G "Visual Studio 14 2015 Win64" ..

LuaSocket

xLua默认集成库。

RapidJson

json处理,特点是Rapid。

LPeg

模式匹配库。

FFI for lua53

基于这个项目的裁剪:https://github.com/facebookarchive/luaffifb

裁剪掉函数调用部分,这部分需要用到jit,有些系统行不同(比如ios),故裁剪掉。

如何使用

  • 自动编译下载你希望使用的版本(lua53,lua54, luajit),解压覆盖Unity工程Assets下Plugins目录,注意是覆盖,别删除后拷
  • 把LibsTestProj/Assets下的BuildInInit.cs和Resources目录放到Unity工程Assets下
  • 库的初始化看实例:LibsTestProj/Assets/Helloworld/Helloworld.cs

注意

build_xlua_with_libs's People

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

build_xlua_with_libs's Issues

编译ios的luajit版报错

用大佬的工程直接替换了Plugins/iOS/libxlua.a为build/plugin_luajit/Plugins/iOS/libxlua.a,然后导出xcode工程编译报错如下:(尝试设置xcode里的bitcode为No依然报错)
Showing All Messages
: '/Users/Documents/111/Libraries/Plugins/iOS/libxlua.a(lj_api.o)' does not contain bitcode. You must rebuild it with bitcode enabled (Xcode setting ENABLE_BITCODE), obtain an updated library from the vendor, or disable bitcode for this target. for architecture arm64

问题Plugins colliding with each other.

Plugin 'libxlua.so' is used from several locations:
Assets/Plugins/x86/libxlua.so would be copied to /libxlua.so
Assets/Plugins/x86_64/libxlua.so would be copied to /libxlua.so
Please fix plugin settings and try again.

UnityEditor.Modules.DefaultPluginImporterExtension:CheckFileCollisions(String)
UnityEditorInternal.PluginsHelper:CheckFileCollisions(BuildTarget) (at C:/buildslave/unity/build/Editor/Mono/Plugins/PluginsHelper.cs:25)
UnityEditor.HostView:OnGUI()

使用更新的插件,在build时报了上边的错误
请问大佬有什么解决方法吗?谢谢

能否更新一下插件plugin

能否更新下build下plugin_lua53里的plugin,由于没有mac 在cmke ios的库文件不是很方便,能否上传一下最新的105版本的plugin

使用Rapidjson的时候遇到了一点问题

如题,当服务端发送的json字符串中有null字段时,null会被解析成一个lua function...
例如:
{"a":{},"b":null}
这样的一个json数组,取b的时候会得到一个function,而不是nil,
虽然能尽量通过规范来约束服务端尽量不发null过来,但是还是希望从代码层面就能杜绝这种情况的产生,
请问这里可以修改一下吗?
或者简单讲一下libs的编译过程,我去尝试修改一下代码

bad argument #1 to 'encode

Image
)

我连续两次调用asset(protoc:load [[....),在第二次调用加载Person,当调用
assert(pb.encode('Person', data1))
,unity编译器会提示说找不到Person
Image

该库的 lua-protobuf 是最新版本吗?

该库的 lua-protobuf 是最新版本吗?
如果不是,我尝试 fork 该项目后,将最新的 lua-protobuf 上传至自己的仓库。通过 Actions 自动编译,这样的做法正确吗?

请问一下 mac上编译luajit后缺少函数

mac上执行编译cmake_ios_luajit.sh后在xcode上看项目缺少了很多函数,我在终端搜索error却并没有发现有错误 这个是我需要改动那里吗?我还没有添加我需要的第三
{3F1DF23D-7B4F-3148-726E-347B623148DE}
方库

使用pbc报错。

EntryPointNotFoundException: luaopen_protobuf_c
XLua.LuaDLL.Lua.LoadProtobufC (IntPtr L) (at Assets/BuildInInit.cs:49)
(wrapper native-to-managed) XLua.LuaDLL.Lua:LoadProtobufC (intptr)
XLua.LuaEnv.DoString (System.Byte[] chunk, System.String chunkName, XLua.LuaTable env) (at Assets/XLua/Src/LuaEnv.cs:270)
XLua.LuaEnv.DoString (System.String chunk, System.String chunkName, XLua.LuaTable env) (at Assets/XLua/Src/LuaEnv.cs:290)
Helloworld.Start () (at Assets/Helloworld/Helloworld.cs:32)

pbc嵌套类反序列化问题

游戏中测试发现,经过pbc反序列化的嵌套类,在decode后如果没有使用里面的数据,将会出现数据为空的情况,lua中断点发现,嵌套类还没有经过反序列化。
测试代码如下

Lua代码,示例代码注释后两行

local protobuf = require 'protobuf'
protobuf.register(CS.UnityEngine.Resources.Load('proto/UserInfo.pb').bytes)
protobuf.register(CS.UnityEngine.Resources.Load('proto/User.pb').bytes)

local userInfo = {}
userInfo.name = 'world'
userInfo.diamond = 998
userInfo.level = 100

local user = { }
user.id = 1
user.status = { 1,0,2,4}
user.pwdMd5 = 'md5'
user.regTime = '2017-03-29 12:00:00'
user.info = userInfo

--序列化
local encode = protobuf.encode('User', user)

-- 反序列化
user_decode = protobuf.decode('User', encode)

--先不获取数据,断点可发现 user_decode.info这个嵌套类未被反序列化
--assert(user.id == user_decode.id and user.info.diamond == user_decode.info.diamond)
--print('hello', user_decode.info.name)

c#代码

public class userInfo
    {
        public string name;
        public int diamond;
        public int level;
    }

    public class user
    {
        public int id;
        public int[] status;
        public string pwdMd5;
        public string regTime;
        public userInfo info;
    }
user us = LuaEnv.Global.Get<user>("user_decode");
Debug.Log(us.info.name);//null,嵌套类取不到,其他数据正常

这样的情况怎么处理呢?

fork,执行actions,android 编译报错

1 warning generated.
[ 78%] Building C object CMakeFiles/xlua.dir/lpeg/lpcap.c.o
[ 82%] Building C object CMakeFiles/xlua.dir/lpeg/lpcode.c.o
[ 86%] Building C object CMakeFiles/xlua.dir/lpeg/lpprint.c.o
[ 91%] Building C object CMakeFiles/xlua.dir/lpeg/lptree.c.o
[ 95%] Building C object CMakeFiles/xlua.dir/lpeg/lpvm.c.o
make[2]: *** No rule to make target '/home/runner/work/build_xlua_with_libs/build_xlua_with_libs/build/luajit-2.1.0b3/src/libluajit.a', needed by 'libxlua.so'. Stop.
make[1]: *** [CMakeFiles/Makefile2:83: CMakeFiles/xlua.dir/all] Error 2
make: *** [Makefile:91: all] Error 2
cp: cannot stat 'build_lj_x86/libxlua.so': No such file or directory
Error: Process completed with exit code 1.

关于命令的疑问

make_android_lua53.bat中"-DCMAKE_BUILD_TYPE=Release/Relase?",是拼写错误还是两个没区别?官网的build中是正确拼写,您的库中拼写是错误的

你好,pbc和打包以后遇见一个问题

问题是这样的:
我先用cmake打出一个build64,里面包含了pbc,然后我按照你的例子去调用luaopen_protobuf_c,他就报错说是找不到这个入口。请问我该怎么办

关于Plugins下x86和x86_64的so文件

关于Plugins下x86和x86_64文件夹中的libxlua.so文件,有两个问题想请教一下:

  • 做什么用的
  • 如何编译才能得到呢

        一直以为x86和x86_64文件夹是放PC下的dll文件的,所以很费解为什么会有so文件呢。

安卓编译失败

你好,因为项目要用pbc,所以重新编译了xlua。
但是在mac 下编译 安卓 会报错 :CMake Error at cmake/android.toolchain.cmake:739 (message):
Specified toolchain "arm-linux-androideabi-clang3.6" is missing in your NDK
or broken. Please verify that your NDK is working or select another
compiler toolchain.

win,ios,macos 都ok了。
安卓版本不能用mac编译 一定要linux吗。。

ndk 是 r10e.
使用都是 lua53 系列

非常感谢~

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.