diff options
-rw-r--r-- | 3rdparty/lua/src/liolib.c | 2 | ||||
-rw-r--r-- | makefile | 9 | ||||
-rw-r--r-- | scripts/genie.lua | 21 | ||||
-rw-r--r-- | scripts/src/3rdparty.lua | 7 | ||||
-rw-r--r-- | scripts/src/main.lua | 18 | ||||
-rw-r--r-- | src/emu/luaengine.cpp | 11 |
6 files changed, 54 insertions, 14 deletions
diff --git a/3rdparty/lua/src/liolib.c b/3rdparty/lua/src/liolib.c index a91ba391817..bb4bcf03d90 100644 --- a/3rdparty/lua/src/liolib.c +++ b/3rdparty/lua/src/liolib.c @@ -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) @@ -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 diff --git a/scripts/genie.lua b/scripts/genie.lua index 2cf8916713f..329efb08a0a 100644 --- a/scripts/genie.lua +++ b/scripts/genie.lua @@ -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" } diff --git a/scripts/src/3rdparty.lua b/scripts/src/3rdparty.lua index cfaa171bf64..72e0d0c24f4 100644 --- a/scripts/src/3rdparty.lua +++ b/scripts/src/3rdparty.lua @@ -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 -------------------------------------------------- diff --git a/scripts/src/main.lua b/scripts/src/main.lua index ad71d0a5cb7..2a4acab17a5 100644 --- a/scripts/src/main.lua +++ b/scripts/src/main.lua @@ -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", diff --git a/src/emu/luaengine.cpp b/src/emu/luaengine.cpp index 32eccb8a85b..061305b3d9f 100644 --- a/src/emu/luaengine.cpp +++ b/src/emu/luaengine.cpp @@ -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 } //------------------------------------------------- |