Подключен LuaJit2.1
This commit is contained in:
@@ -70,9 +70,10 @@ set(BOOST_IOSTREAMS_ENABLE_ZLIB ON)
|
|||||||
set(BOOST_INCLUDE_LIBRARIES asio thread json iostreams)
|
set(BOOST_INCLUDE_LIBRARIES asio thread json iostreams)
|
||||||
FetchContent_Declare(
|
FetchContent_Declare(
|
||||||
Boost
|
Boost
|
||||||
URL https://github.com/boostorg/boost/releases/download/boost-1.87.0/boost-1.87.0-cmake.7z
|
GIT_REPOSITORY https://github.com/boostorg/boost.git
|
||||||
USES_TERMINAL_DOWNLOAD TRUE
|
GIT_TAG boost-1.87.0
|
||||||
DOWNLOAD_NO_EXTRACT FALSE
|
GIT_PROGRESS true
|
||||||
|
USES_TERMINAL_DOWNLOAD true
|
||||||
)
|
)
|
||||||
FetchContent_MakeAvailable(Boost)
|
FetchContent_MakeAvailable(Boost)
|
||||||
target_link_libraries(luavox_common INTERFACE Boost::asio Boost::thread Boost::json Boost::iostreams)
|
target_link_libraries(luavox_common INTERFACE Boost::asio Boost::thread Boost::json Boost::iostreams)
|
||||||
@@ -81,6 +82,28 @@ target_link_libraries(luavox_common INTERFACE Boost::asio Boost::thread Boost::j
|
|||||||
# find_package(glm REQUIRED)
|
# find_package(glm REQUIRED)
|
||||||
# target_include_directories(${PROJECT_NAME} PUBLIC ${GLM_INCLUDE_DIR})
|
# target_include_directories(${PROJECT_NAME} PUBLIC ${GLM_INCLUDE_DIR})
|
||||||
# target_link_libraries(${PROJECT_NAME} PUBLIC ${GLM_LIBRARY})
|
# target_link_libraries(${PROJECT_NAME} PUBLIC ${GLM_LIBRARY})
|
||||||
|
FetchContent_Declare(
|
||||||
|
luajit
|
||||||
|
GIT_REPOSITORY https://luajit.org/git/luajit.git
|
||||||
|
GIT_TAG v2.1
|
||||||
|
GIT_PROGRESS true
|
||||||
|
USES_TERMINAL_DOWNLOAD true
|
||||||
|
)
|
||||||
|
FetchContent_MakeAvailable(luajit)
|
||||||
|
|
||||||
|
FetchContent_Declare(
|
||||||
|
lua_cmake
|
||||||
|
GIT_REPOSITORY https://github.com/zhaozg/luajit-cmake.git
|
||||||
|
GIT_TAG 300c0b3f472be2be158f5b2e6385579ba5c6c0f9
|
||||||
|
GIT_PROGRESS true
|
||||||
|
USES_TERMINAL_DOWNLOAD true
|
||||||
|
)
|
||||||
|
set(LUAJIT_DIR ${luajit_SOURCE_DIR})
|
||||||
|
FetchContent_MakeAvailable(lua_cmake)
|
||||||
|
|
||||||
|
target_link_libraries(luavox_common INTERFACE luajit::lib luajit::header)
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
FetchContent_Declare(
|
FetchContent_Declare(
|
||||||
glm
|
glm
|
||||||
|
|||||||
@@ -25,9 +25,21 @@
|
|||||||
#include "glm/gtc/noise.hpp"
|
#include "glm/gtc/noise.hpp"
|
||||||
#include <fstream>
|
#include <fstream>
|
||||||
|
|
||||||
|
extern "C" {
|
||||||
|
#include "lauxlib.h"
|
||||||
|
#include "lua.h"
|
||||||
|
}
|
||||||
|
|
||||||
namespace js = boost::json;
|
namespace js = boost::json;
|
||||||
|
|
||||||
|
int luaPanic(lua_State *L)
|
||||||
|
{
|
||||||
|
size_t length;
|
||||||
|
const char *str = luaL_checklstring(L, -1, &length);
|
||||||
|
MAKE_ERROR("LUA PANIC: unprotected error in call to Lua API (" << std::string_view(str, length) << ")");
|
||||||
|
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
namespace LV::Server {
|
namespace LV::Server {
|
||||||
|
|
||||||
@@ -53,6 +65,13 @@ GameServer::GameServer(asio::io_context &ioc, fs::path worldPath)
|
|||||||
for(size_t iter = 0; iter < BackingAsyncLua.Threads.size(); iter++) {
|
for(size_t iter = 0; iter < BackingAsyncLua.Threads.size(); iter++) {
|
||||||
BackingAsyncLua.Threads[iter] = std::thread(&BackingAsyncLua_t::run, &BackingAsyncLua, iter);
|
BackingAsyncLua.Threads[iter] = std::thread(&BackingAsyncLua_t::run, &BackingAsyncLua, iter);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Тест луа
|
||||||
|
|
||||||
|
|
||||||
|
lua_State *m_luastack = luaL_newstate();
|
||||||
|
lua_atpanic(m_luastack, &luaPanic);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
GameServer::~GameServer() {
|
GameServer::~GameServer() {
|
||||||
|
|||||||
Reference in New Issue
Block a user