diff options
| author | ruki <[email protected]> | 2021-09-18 09:51:33 +0800 |
|---|---|---|
| committer | ruki <[email protected]> | 2021-09-18 09:51:33 +0800 |
| commit | 6f0f25b64487a32989cb718aa50d9bc729f46d66 (patch) | |
| tree | 1f4b3d523cb591aab977363fdd241ae62b46661e /core/src | |
| parent | eb826246511e2afca394302aecccdf18d02a297f (diff) | |
build lua for windows
Diffstat (limited to 'core/src')
| -rw-r--r-- | core/src/lcurses/xmake.lua | 2 | ||||
| -rw-r--r-- | core/src/lua-cjson/xmake.lua | 2 | ||||
| -rw-r--r-- | core/src/lua/makefile | 4 | ||||
| -rw-r--r-- | core/src/lua/xmake.lua | 31 | ||||
| -rw-r--r-- | core/src/luajit/xmake.lua | 5 | ||||
| -rw-r--r-- | core/src/xmake/sandbox/interactive.c | 5 | ||||
| -rw-r--r-- | core/src/xmake/xmake.lua | 3 |
7 files changed, 46 insertions, 6 deletions
diff --git a/core/src/lcurses/xmake.lua b/core/src/lcurses/xmake.lua index f80117f10..5ee8a26c6 100644 --- a/core/src/lcurses/xmake.lua +++ b/core/src/lcurses/xmake.lua @@ -1,6 +1,6 @@ target("lcurses") set_kind("static") - add_deps("luajit") + add_deps(get_config("backend")) if is_plat("windows") and has_config("pdcurses") then add_deps("pdcurses") add_defines("XM_CONFIG_API_HAVE_CURSES", {public = true}) diff --git a/core/src/lua-cjson/xmake.lua b/core/src/lua-cjson/xmake.lua index d2eec99f0..d3b12ded1 100644 --- a/core/src/lua-cjson/xmake.lua +++ b/core/src/lua-cjson/xmake.lua @@ -1,7 +1,7 @@ target("lua-cjson") set_kind("static") set_warnings("all") - add_deps("luajit") + add_deps(get_config("backend")) if is_plat("windows") then set_languages("c89") end diff --git a/core/src/lua/makefile b/core/src/lua/makefile index f66181209..85e8725cf 100644 --- a/core/src/lua/makefile +++ b/core/src/lua/makefile @@ -66,6 +66,10 @@ lua_CFLAGS := -std=c99 -DLUA_COMPAT_5_1 -DLUA_COMPAT_5_2 \ -Wno-error=string-plus-int ifdef iswin lua_CFLAGS += -DLUA_USE_WINDOWS +endif + +ifeq ($(PLAT),macosx) +lua_CFLAGS += -DLUA_USE_MACOSX else lua_CFLAGS += -DLUA_USE_LINUX endif diff --git a/core/src/lua/xmake.lua b/core/src/lua/xmake.lua new file mode 100644 index 000000000..4f209b693 --- /dev/null +++ b/core/src/lua/xmake.lua @@ -0,0 +1,31 @@ +target("lua") + if not is_config("lua") then + set_default(false) + end + set_kind("static") + set_warnings("all") + + -- disable c99(/TP) for windows + if is_plat("windows") then + set_languages("c89") + end + + -- add header files + add_headerfiles("lua/(*.h)", {prefixdir = "lua"}) + + -- add include directories + add_includedirs("lua", {public = true}) + + -- add the common source files + add_files("lua/*.c|lua.c") + + -- add defines + add_defines("LUA_COMPAT_5_1", "LUA_COMPAT_5_2", {public = true}) + if is_plat("windows") then + add_defines("LUA_USE_WINDOWS") + elseif is_plat("macosx", "iphoneos") then + add_defines("LUA_USE_MACOSX") + else + add_defines("LUA_USE_LINUX") + end + diff --git a/core/src/luajit/xmake.lua b/core/src/luajit/xmake.lua index cfee1f76e..f6f351394 100644 --- a/core/src/luajit/xmake.lua +++ b/core/src/luajit/xmake.lua @@ -23,6 +23,9 @@ local autogendir = path.join("autogen", plat, jit and "jit" or "nojit", arch) -- add target target("luajit") + if not is_config("luajit") then + set_default(false) + end -- make as a static library set_kind("static") @@ -52,6 +55,8 @@ target("luajit") add_files(autogendir .. "/*.S") end + add_defines("USE_LUAJIT", {interface = true}) + -- disable jit compiler? if not jit then add_defines("LUAJIT_DISABLE_JIT") diff --git a/core/src/xmake/sandbox/interactive.c b/core/src/xmake/sandbox/interactive.c index 29855aec6..023759448 100644 --- a/core/src/xmake/sandbox/interactive.c +++ b/core/src/xmake/sandbox/interactive.c @@ -73,6 +73,7 @@ static tb_void_t xm_sandbox_report(lua_State *lua) } } +#ifdef USE_LUAJIT // the traceback function static tb_int_t xm_sandbox_traceback(lua_State *lua) { @@ -122,6 +123,7 @@ static tb_int_t xm_sandbox_docall(lua_State* lua, tb_int_t narg, tb_int_t clear) // ok? return status; } +#endif // this line is incomplete? static tb_int_t xm_sandbox_incomplete(lua_State *lua, tb_int_t status) @@ -327,9 +329,6 @@ tb_int_t xm_sandbox_interactive(lua_State* lua) * stack: arg1(top) scriptfunc -> ... */ status = xm_sandbox_docall(lua, 0, 0); -#else - // TODO - (void)xm_sandbox_docall; #endif } diff --git a/core/src/xmake/xmake.lua b/core/src/xmake/xmake.lua index 7a604301a..c954db65b 100644 --- a/core/src/xmake/xmake.lua +++ b/core/src/xmake/xmake.lua @@ -7,7 +7,8 @@ target("xmake") if has_config("curses") or has_config("pdcurses") then add_deps("lcurses") end - add_deps("sv", "luajit", "lua-cjson", "tbox") + add_deps("sv", "lua-cjson", "tbox") + add_deps(get_config("backend")) -- add defines add_defines("__tb_prefix__=\"xmake\"") |
