Switch to a fork of LuaJIT that supports android;

This commit is contained in:
bjorn 2019-05-21 00:26:04 -07:00
parent 3804a1c0ee
commit 5b1e281d4c
4 changed files with 12 additions and 15 deletions

6
.gitmodules vendored
View File

@ -7,9 +7,6 @@
[submodule "deps/lua"]
path = deps/lua
url = https://github.com/LuaDist/lua
[submodule "deps/luajit"]
path = deps/luajit
url = https://github.com/LuaDist/luajit
[submodule "deps/msdfgen"]
path = deps/msdfgen
url = https://github.com/bjornbytes/msdfgen
@ -25,3 +22,6 @@
[submodule "deps/physfs"]
path = deps/physfs
url = https://github.com/Didstopia/physfs.git
[submodule "deps/luajit"]
path = deps/luajit
url = https://github.com/WohlSoft/LuaJIT

View File

@ -70,7 +70,6 @@ elseif(ANDROID)
set(LOVR_USE_OCULUS OFF)
set(LOVR_USE_DESKTOP_HEADSET OFF)
set(LOVR_USE_OCULUS_MOBILE ON)
set(LOVR_USE_LUAJIT OFF) # Until buildvm re-invoke works
set(LOVR_BUILD_SHARED ON) # Android has only "activities"
elseif(UNIX)
if(APPLE)
@ -149,7 +148,7 @@ if(NOT (EMSCRIPTEN OR ANDROID))
endif()
# Lua
if(LOVR_USE_LUAJIT AND NOT (EMSCRIPTEN OR ANDROID))
if(LOVR_USE_LUAJIT AND NOT EMSCRIPTEN)
if (APPLE)
set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -pagezero_size 10000 -image_base 100000000")
endif()
@ -160,11 +159,7 @@ if(LOVR_USE_LUAJIT AND NOT (EMSCRIPTEN OR ANDROID))
else()
add_subdirectory(deps/luajit luajit)
include_directories(deps/luajit/src ${CMAKE_BINARY_DIR}/luajit)
set(LOVR_LUA liblua)
endif()
set_target_properties(luajit minilua liblua PROPERTIES EXCLUDE_FROM_ALL 1)
if(WIN32)
set_target_properties(wluajit PROPERTIES EXCLUDE_FROM_ALL 1)
set(LOVR_LUA libluajit)
endif()
else()
if(EMSCRIPTEN)
@ -358,6 +353,10 @@ target_link_libraries(lovr
${LOVR_EMSCRIPTEN_FLAGS}
)
if(LOVR_USE_LUAJIT)
target_compile_definitions(lovr PUBLIC -DLOVR_USE_LUAJIT)
endif()
if(LOVR_ENABLE_AUDIO)
add_definitions(-DLOVR_ENABLE_AUDIO)
target_sources(lovr PRIVATE

2
deps/luajit vendored

@ -1 +1 @@
Subproject commit 6c4a18258631ff01f963e9a1e64df57d7a453fd6
Subproject commit 753f680cab42c63607a2ec0560705f9f8d3ace7d

View File

@ -1308,12 +1308,11 @@ static int json_decode(lua_State *l)
/* ===== INITIALISATION ===== */
#if !defined(LUA_VERSION_NUM) || LUA_VERSION_NUM < 502
/* Compatibility for Lua 5.1.
*
* luaL_setfuncs() is used to create a module table where the functions have
* json_config_t as their first upvalue. Code borrowed from Lua 5.2 source. */
static void luaL_setfuncs (lua_State *l, const luaL_Reg *reg, int nup)
static void json_luaL_setfuncs (lua_State *l, const luaL_Reg *reg, int nup)
{
int i;
@ -1326,7 +1325,6 @@ static void luaL_setfuncs (lua_State *l, const luaL_Reg *reg, int nup)
}
lua_pop(l, nup); /* remove upvalues */
}
#endif
/* Call target function in protected mode with all supplied args.
* Assumes target function only returns a single non-nil value.
@ -1381,7 +1379,7 @@ static int lua_cjson_new(lua_State *l)
/* Register functions with config data as upvalue */
json_create_config(l);
luaL_setfuncs(l, reg, 1);
json_luaL_setfuncs(l, reg, 1);
/* Set cjson.null */
lua_pushlightuserdata(l, NULL);