1
0
Fork 0

Compile the entire Lua stack as C++

* Fixes #5216
This commit is contained in:
Tiger Wang 2021-06-23 13:59:01 +01:00
parent e77a4ab46d
commit ecc8ffbd80
12 changed files with 21 additions and 31 deletions

View File

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

View File

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

View File

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

View File

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

View File

@ -161,7 +161,7 @@ add_library(GeneratorTestingSupport STATIC
${GENERATING_HDRS} ${GENERATING_HDRS}
${STUBS} ${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("Stubs" FILES ${STUBS})
source_group("Generating" FILES ${GENERATING_HDRS} ${GENERATING_SRCS}) source_group("Generating" FILES ${GENERATING_HDRS} ${GENERATING_SRCS})

View File

@ -86,7 +86,7 @@ source_group("Shared" FILES ${SHARED_SRCS} ${SHARED_HDRS})
source_group("Sources" FILES ${SRCS}) source_group("Sources" FILES ${SRCS})
source_group("Data files" FILES Test.cubeset Test1.schematic) source_group("Data files" FILES Test.cubeset Test1.schematic)
add_executable(LoadablePieces ${SRCS} ${SHARED_SRCS} ${SHARED_HDRS} 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) add_test(NAME LoadablePieces-test WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR} COMMAND LoadablePieces)

View File

@ -80,7 +80,7 @@ source_group("Shared" FILES ${SHARED_SRCS} ${SHARED_HDRS})
source_group("Sources" FILES ${SRCS}) source_group("Sources" FILES ${SRCS})
source_group("Lua files" FILES Test.lua) source_group("Lua files" FILES Test.lua)
add_executable(LuaThreadStress ${SRCS} ${SHARED_SRCS} ${SHARED_HDRS} 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) add_test(NAME LuaThreadStress-test WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR} COMMAND LuaThreadStress)