Made pnacl to compile (nw)

This commit is contained in:
Miodrag Milanovic 2016-02-26 14:50:09 +01:00
parent 2582ce7f16
commit 3a811376d9
6 changed files with 54 additions and 14 deletions

View File

@ -81,7 +81,7 @@
#if !defined(l_getc) /* { */
#if defined(LUA_USE_POSIX)
#if defined(LUA_USE_POSIX) && !defined(__native_client__)
#define l_getc(f) getc_unlocked(f)
#define l_lockfile(f) flockfile(f)
#define l_unlockfile(f) funlockfile(f)

View File

@ -94,7 +94,8 @@
# FORCE_VERSION_COMPILE = 1
# MS BUILD = 1
# MSBUILD = 1
# USE_LIBUV = 1
ifdef PREFIX_MAKEFILE
include $(PREFIX_MAKEFILE)
@ -676,6 +677,10 @@ ifdef PLATFORM
TARGET_PARAMS += --PLATFORM='$(PLATFORM)'
endif
ifdef USE_LIBUV
PARAMS += --USE_LIBUV='$(USE_LIBUV)'
endif
#-------------------------------------------------
# All scripts
#-------------------------------------------------
@ -1024,7 +1029,7 @@ $(PROJECTDIR_MINI)/gmake-pnacl/Makefile: makefile $(SCRIPTS) $(GENIE)
ifndef NACL_SDK_ROOT
$(error NACL_SDK_ROOT is not set)
endif
$(SILENT) $(GENIE) $(PARAMS) --gcc=pnacl --gcc_version=3.7.0 --osd=osdmini --targetos=pnacl --NOASM=1 gmake
$(SILENT) $(GENIE) $(PARAMS) --gcc=pnacl --gcc_version=3.7.0 --osd=osdmini --targetos=pnacl --NOASM=1 --USE_LIBUV=0 gmake
.PHONY: pnacl
pnacl: generate $(PROJECTDIR_MINI)/gmake-pnacl/Makefile

View File

@ -387,6 +387,15 @@ newoption {
description = "Target machine platform (x86,arm,...)",
}
newoption {
trigger = "USE_LIBUV",
description = "Use libuv.",
allowed = {
{ "0", "Disabled" },
{ "1", "Enabled" },
}
}
if _OPTIONS["SHLIB"]=="1" then
LIBTYPE = "SharedLib"
else
@ -411,6 +420,10 @@ if not _OPTIONS["NOASM"] then
end
end
if not _OPTIONS["USE_LIBUV"] then
_OPTIONS["USE_LIBUV"] = "1"
end
if _OPTIONS["NOASM"]=="1" and not _OPTIONS["FORCE_DRC_C_BACKEND"] then
_OPTIONS["FORCE_DRC_C_BACKEND"] = "1"
end
@ -511,6 +524,11 @@ configuration { "gmake" }
dofile ("toolchain.lua")
if _OPTIONS["USE_LIBUV"]=="0" then
defines {
"NO_LIBUV",
}
end
if _OPTIONS["targetos"]=="windows" then
configuration { "x64" }
@ -1023,9 +1041,6 @@ configuration { "android*" }
"-Wno-tautological-constant-out-of-range-compare",
"-Wno-tautological-pointer-compare",
}
defines {
"_POSIX_BARRIERS=1",
}
archivesplit_size "20"
configuration { "pnacl" }

View File

@ -513,7 +513,7 @@ project "lualibs"
--------------------------------------------------
-- luv lua library objects
--------------------------------------------------
if _OPTIONS["USE_LIBUV"]=="1" then
project "luv"
uuid "d98ec5ca-da2a-4a50-88a2-52061ca53871"
kind "StaticLib"
@ -567,7 +567,7 @@ project "luv"
MAME_DIR .. "3rdparty/luv/src/luv.c",
MAME_DIR .. "3rdparty/luv/src/luv.h",
}
end
--------------------------------------------------
-- SQLite3 library objects
--------------------------------------------------
@ -1007,6 +1007,7 @@ end
--------------------------------------------------
-- libuv library objects
--------------------------------------------------
if _OPTIONS["USE_LIBUV"]=="1" then
project "uv"
uuid "cd2afe7f-139d-49c3-9000-fc9119f3cea0"
kind "StaticLib"
@ -1196,7 +1197,7 @@ project "uv"
"-Wshadow"
}
end
end
--------------------------------------------------
-- HTTP parser library objects
--------------------------------------------------

View File

@ -35,6 +35,14 @@ end
"EGL",
"GLESv2",
}
configuration { "pnacl" }
kind "ConsoleApp"
targetextension ".pexe"
links {
"ppapi",
"ppapi_gles2",
"pthread",
}
configuration { }
addprojectflags()
@ -153,11 +161,15 @@ end
"7z",
"lua",
"lualibs",
"luv",
"uv",
"http-parser",
}
if _OPTIONS["USE_LIBUV"]=="1" then
links {
"luv",
"uv",
"http-parser",
}
end
if _OPTIONS["with-bundled-zlib"] then
links {
"zlib",

View File

@ -19,7 +19,9 @@
#include "ui/ui.h"
#include "luaengine.h"
#include <mutex>
#if !defined(NO_LIBUV)
#include "libuv/include/uv.h"
#endif
//**************************************************************************
// LUA ENGINE
@ -49,9 +51,11 @@ lua_engine* lua_engine::luaThis = nullptr;
extern "C" {
int luaopen_lsqlite3(lua_State *L);
int luaopen_zlib(lua_State *L);
int luaopen_luv(lua_State *L);
int luaopen_lfs(lua_State *L);
#if !defined(NO_LIBUV)
int luaopen_luv(lua_State *L);
uv_loop_t* luv_loop(lua_State* L);
#endif
}
static void lstop(lua_State *L, lua_Debug *ar)
@ -1195,9 +1199,11 @@ lua_engine::lua_engine()
lua_getfield(m_lua_state, -1, "preload");
lua_remove(m_lua_state, -2); // Remove package
#if !defined(NO_LIBUV)
// Store uv module definition at preload.uv
lua_pushcfunction(m_lua_state, luaopen_luv);
lua_setfield(m_lua_state, -2, "luv");
#endif
lua_pushcfunction(m_lua_state, luaopen_zlib);
lua_setfield(m_lua_state, -2, "zlib");
@ -1661,10 +1667,11 @@ void lua_engine::periodic_check()
msg.ready = 0;
msg.done = 1;
}
#if !defined(NO_LIBUV)
auto loop = luv_loop(m_lua_state);
if (loop!=nullptr)
uv_run(loop, UV_RUN_NOWAIT);
#endif
}
//-------------------------------------------------