Add libuv

This commit is contained in:
wheremyfoodat 2023-10-30 19:01:26 +02:00
parent e900e9d614
commit 7b9012671a
5 changed files with 25 additions and 1 deletions

6
.gitmodules vendored
View file

@ -43,3 +43,9 @@
[submodule "third_party/hydra_core"]
path = third_party/hydra_core
url = https://github.com/hydra-emu/core
[submodule "third_party/luv"]
path = third_party/luv
url = https://github.com/luvit/luv
[submodule "third_party/libuv"]
path = third_party/libuv
url = https://github.com/libuv/libuv

View file

@ -245,6 +245,15 @@ set(THIRD_PARTY_SOURCE_FILES third_party/imgui/imgui.cpp
third_party/xxhash/xxhash.c
)
if(ENABLE_LUAJIT)
# Build luv and libuv for TCP Lua server usage
include_directories(third_party/luv/src)
include_directories(third_party/luv/deps/lua-compat-5.3/c-api)
include_directories(third_party/libuv/include)
set(THIRD_PARTY_SOURCE_FILES ${THIRD_PARTY_SOURCE_FILES} third_party/luv/src/luv.c)
add_subdirectory(third_party/libuv)
endif()
if(ENABLE_QT_GUI)
include_directories(third_party/duckstation)
@ -399,7 +408,7 @@ endif()
if(ENABLE_LUAJIT)
target_compile_definitions(Alber PUBLIC "PANDA3DS_ENABLE_LUA=1")
target_link_libraries(Alber PRIVATE libluajit)
target_link_libraries(Alber PRIVATE libluajit uv)
endif()
if(ENABLE_OPENGL)

View file

@ -1,6 +1,10 @@
#ifdef PANDA3DS_ENABLE_LUA
#include "lua_manager.hpp"
extern "C" {
#include "luv.h"
}
void LuaManager::initialize() {
L = luaL_newstate(); // Open Lua
@ -11,6 +15,9 @@ void LuaManager::initialize() {
}
luaL_openlibs(L);
lua_pushstring(L, "luv");
luaopen_luv(L);
lua_settable(L, LUA_GLOBALSINDEX);
initializeThunks();
initialized = true;

1
third_party/libuv vendored Submodule

@ -0,0 +1 @@
Subproject commit b8368a1441fd4ebdaaae70b67136c80b1a98be32

1
third_party/luv vendored Submodule

@ -0,0 +1 @@
Subproject commit 3e55ac4331d06aa5f43016a142aa2aaa23264105