refactor(Lua)!: Use LuaJIT.
This commit is contained in:
parent
6af80e936d
commit
960b2a7083
@ -2,7 +2,7 @@ cmake_minimum_required(VERSION 3.20)
|
||||
|
||||
set(CMAKE_MSVC_RUNTIME_LIBRARY "MultiThreaded$<$<CONFIG:Debug>:Debug>")
|
||||
|
||||
project(YimMenu CXX ASM_MASM)
|
||||
project(YimMenu C CXX)
|
||||
|
||||
if (NOT MSVC)
|
||||
message(FATAL_ERROR "Unsupported compiler used '${CMAKE_CXX_COMPILER_ID}', YimMenu only supports MSVC.")
|
||||
@ -60,10 +60,12 @@ target_include_directories(YimMenu PRIVATE
|
||||
"${imgui_SOURCE_DIR}"
|
||||
"${minhook_SOURCE_DIR}/src/hde"
|
||||
"${asmjit_SOURCE_DIR}/src"
|
||||
"${luajit_SOURCE_DIR}/src"
|
||||
"${luajit_BINARY_DIR}/src"
|
||||
)
|
||||
|
||||
target_precompile_headers(YimMenu PRIVATE "${SRC_DIR}/common.hpp")
|
||||
target_link_libraries(YimMenu PRIVATE pugixml minhook AsyncLogger dbghelp imgui cpr lua_static asmjit::asmjit)
|
||||
target_link_libraries(YimMenu PRIVATE pugixml minhook AsyncLogger dbghelp imgui cpr libluajit asmjit::asmjit)
|
||||
|
||||
# Warnings as errors
|
||||
set_property(TARGET YimMenu PROPERTY COMPILE_WARNING_AS_ERROR ON)
|
||||
|
@ -1,12 +1,15 @@
|
||||
include(FetchContent)
|
||||
|
||||
message("Lua")
|
||||
message("LuaJIT")
|
||||
|
||||
set(LUAJIT_BUILD_TOOL OFF)
|
||||
|
||||
FetchContent_Declare(
|
||||
Lua
|
||||
GIT_REPOSITORY https://github.com/walterschell/Lua.git
|
||||
GIT_TAG a2e0125df529894f5e25d7d477b2df4e37690e0f
|
||||
luajit
|
||||
GIT_REPOSITORY https://github.com/WohlSoft/LuaJIT.git
|
||||
GIT_TAG 27878965958986687f8caaf8a2b6b73bc5df85e0
|
||||
GIT_PROGRESS TRUE
|
||||
)
|
||||
FetchContent_MakeAvailable(Lua)
|
||||
|
||||
set_property(TARGET lua_static PROPERTY CXX_STANDARD 23)
|
||||
add_compile_definitions("_CRT_SECURE_NO_WARNINGS")
|
||||
FetchContent_MakeAvailable(luajit)
|
||||
|
@ -103,6 +103,10 @@ namespace big
|
||||
sol::lib::table,
|
||||
sol::lib::bit32,
|
||||
sol::lib::io,
|
||||
#if SOL_IS_ON(SOL_USE_LUAJIT)
|
||||
sol::lib::ffi,
|
||||
sol::lib::jit,
|
||||
#endif
|
||||
sol::lib::utf8
|
||||
);
|
||||
// clang-format on
|
||||
@ -283,8 +287,13 @@ namespace big
|
||||
|
||||
// 1 2 3 4
|
||||
// {searcher_preload, searcher_Lua, searcher_C, searcher_Croot, NULL};
|
||||
#if SOL_LUA_VERSION_I_ < 502
|
||||
m_state["package"]["loaders"][3] = not_supported_lua_function("package.loaders C");
|
||||
m_state["package"]["loaders"][4] = not_supported_lua_function("package.loaders Croot");
|
||||
#else
|
||||
m_state["package"]["searchers"][3] = not_supported_lua_function("package.searcher C");
|
||||
m_state["package"]["searchers"][4] = not_supported_lua_function("package.searcher Croot");
|
||||
#endif
|
||||
|
||||
set_folder_for_lua_require(scripts_folder);
|
||||
}
|
||||
|
Reference in New Issue
Block a user