1
0
Fork 0

Compile the entire Lua stack as C++

* Fixes #5216
master
Tiger Wang 1 year ago
parent e77a4ab46d
commit ecc8ffbd80
  1. 7
      SetFlags.cmake
  2. 2
      lib/SQLiteCpp
  3. 2
      lib/lua
  4. 2
      lib/luaexpat
  5. 2
      lib/sqlite
  6. 2
      lib/tolua++
  7. 19
      src/Bindings/LuaState.cpp
  8. 5
      src/Bindings/LuaState.h
  9. 5
      src/Bindings/PluginLua.cpp
  10. 2
      tests/Generating/CMakeLists.txt
  11. 2
      tests/LoadablePieces/CMakeLists.txt
  12. 2
      tests/LuaThreadStress/CMakeLists.txt

@ -88,6 +88,11 @@ function(set_global_flags)
# Make build use Unicode:
add_compile_definitions(UNICODE _UNICODE)
# Turn off CRT warnings:
add_compile_definitions(_CRT_SECURE_NO_WARNINGS)
return ()
endif()
# Allow for a forced 32-bit build under 64-bit OS:
@ -99,7 +104,7 @@ function(set_global_flags)
# https://en.wikipedia.org/wiki/Uname
# https://gcc.gnu.org/onlinedocs/gcc/index.html
# Have the compiler generate code specifically targeted at the current machine on Linux:
if(UNIX AND NOT NO_NATIVE_OPTIMIZATION AND NOT CMAKE_CROSSCOMPILING)
if(NOT NO_NATIVE_OPTIMIZATION AND NOT CMAKE_CROSSCOMPILING)
string(TOLOWER ${CMAKE_SYSTEM_PROCESSOR} SYSTEM_PROCESSOR)
if (SYSTEM_PROCESSOR MATCHES "^(i386|i686|x86|amd64|mips)")
message(STATUS "Optimising for this machine (march=native)")

@ -1 +1 @@
Subproject commit a25ffb56ab1bae0f416ac5dfbddd4188ea3c1a9c
Subproject commit b1f67393fdac05d7d05b7f1232de688e82a7e98f

@ -1 +1 @@
Subproject commit 935fe9113295e049baa8ab0163e2dfec0393a8dd
Subproject commit f543fd79318bf31c81141a07662eb71896a1d938

@ -1 +1 @@
Subproject commit 368e2927fcd227bf0af91b3e4b92e740196425cd
Subproject commit d1986776c6c3d209a8410bd5928facf157dc42bd

@ -1 +1 @@
Subproject commit 4435d7e4297220228174385302d430f1fdf3d090
Subproject commit 9aeab26b00c0bf4c1c3d0afd61acaf08eaf949d3

@ -1 +1 @@
Subproject commit 4d24aa316898964c23896fbb7419bdaa23638c26
Subproject commit 26e85c404baf1d2e5eb4a21660d1f37176d7ab33

@ -6,10 +6,7 @@
#include "Globals.h"
#include "LuaState.h"
extern "C"
{
#include "lua/src/lualib.h"
}
#include "lua/src/lualib.h"
#undef TOLUA_TEMPLATE_BIND
#include "tolua++/include/tolua++.h"
@ -34,17 +31,11 @@ extern "C"
// fwd: "SQLite/lsqlite3.c"
extern "C"
{
int luaopen_lsqlite3(lua_State * L);
}
// fwd: "SQLite/lsqlite3.cpp"
int luaopen_lsqlite3(lua_State * L);
// fwd: "LuaExpat/lxplib.c":
extern "C"
{
int luaopen_lxp(lua_State * L);
}
// fwd: "LuaExpat/lxplib.cpp":
int luaopen_lxp(lua_State * L);

@ -30,10 +30,7 @@ stays valid but doesn't call into Lua code anymore, returning false for "failure
#pragma once
extern "C"
{
#include "lua/src/lauxlib.h"
}
#include "lua/src/lauxlib.h"
#include "../Defines.h"
#include "../FunctionRef.h"

@ -18,10 +18,7 @@
#include "../Root.h"
#include "../WebAdmin.h"
extern "C"
{
#include "lua/src/lauxlib.h"
}
#include "lua/src/lauxlib.h"
#undef TOLUA_TEMPLATE_BIND
#include "tolua++/include/tolua++.h"

@ -161,7 +161,7 @@ add_library(GeneratorTestingSupport STATIC
${GENERATING_HDRS}
${STUBS}
)
target_link_libraries(GeneratorTestingSupport fmt::fmt jsoncpp_static tolualib libdeflate)
target_link_libraries(GeneratorTestingSupport fmt::fmt jsoncpp_static libdeflate lsqlite luaexpat tolualib)
source_group("Stubs" FILES ${STUBS})
source_group("Generating" FILES ${GENERATING_HDRS} ${GENERATING_SRCS})

@ -86,7 +86,7 @@ source_group("Shared" FILES ${SHARED_SRCS} ${SHARED_HDRS})
source_group("Sources" FILES ${SRCS})
source_group("Data files" FILES Test.cubeset Test1.schematic)
add_executable(LoadablePieces ${SRCS} ${SHARED_SRCS} ${SHARED_HDRS} Test.cubeset Test1.schematic)
target_link_libraries(LoadablePieces tolualib zlib)
target_link_libraries(LoadablePieces libdeflate tolualib)
add_test(NAME LoadablePieces-test WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR} COMMAND LoadablePieces)

@ -80,7 +80,7 @@ source_group("Shared" FILES ${SHARED_SRCS} ${SHARED_HDRS})
source_group("Sources" FILES ${SRCS})
source_group("Lua files" FILES Test.lua)
add_executable(LuaThreadStress ${SRCS} ${SHARED_SRCS} ${SHARED_HDRS} Test.lua)
target_link_libraries(LuaThreadStress fmt::fmt Threads::Threads tolualib libdeflate)
target_link_libraries(LuaThreadStress fmt::fmt libdeflate lsqlite luaexpat Threads::Threads tolualib)
add_test(NAME LuaThreadStress-test WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR} COMMAND LuaThreadStress)

Loading…
Cancel
Save