summaryrefslogtreecommitdiff
path: root/core/src/lua
diff options
context:
space:
mode:
authorruki <[email protected]>2021-09-18 09:51:33 +0800
committerruki <[email protected]>2021-09-18 09:51:33 +0800
commit6f0f25b64487a32989cb718aa50d9bc729f46d66 (patch)
tree1f4b3d523cb591aab977363fdd241ae62b46661e /core/src/lua
parenteb826246511e2afca394302aecccdf18d02a297f (diff)
build lua for windows
Diffstat (limited to 'core/src/lua')
-rw-r--r--core/src/lua/makefile4
-rw-r--r--core/src/lua/xmake.lua31
2 files changed, 35 insertions, 0 deletions
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
+