summaryrefslogtreecommitdiff
path: root/core
diff options
context:
space:
mode:
Diffstat (limited to 'core')
-rwxr-xr-xcore/src/lua-cjson/xmake.sh4
-rwxr-xr-xcore/src/xmake/xmake.sh9
-rwxr-xr-xcore/xmake.sh16
3 files changed, 27 insertions, 2 deletions
diff --git a/core/src/lua-cjson/xmake.sh b/core/src/lua-cjson/xmake.sh
index 42e767218..134173051 100755
--- a/core/src/lua-cjson/xmake.sh
+++ b/core/src/lua-cjson/xmake.sh
@@ -4,7 +4,9 @@ target "lua_cjson"
set_kind "static"
set_default false
set_warnings "all"
- if has_config "lua"; then
+ if is_config "runtime" "luajit" && has_config "luajit"; then
+ add_options "luajit" "{public}"
+ elif has_config "lua"; then
add_options "lua" "{public}"
else
add_deps "lua"
diff --git a/core/src/xmake/xmake.sh b/core/src/xmake/xmake.sh
index 2fc04b8e4..93ca26cfc 100755
--- a/core/src/xmake/xmake.sh
+++ b/core/src/xmake/xmake.sh
@@ -6,7 +6,7 @@ target "xmake"
# add deps
add_deps "sv" "lz4" "tbox"
- local libs="lua_cjson lua"
+ local libs="lua_cjson"
for lib in $libs; do
if has_config "$lib"; then
add_options "$lib" "{public}"
@@ -14,6 +14,13 @@ target "xmake"
add_deps "$lib"
fi
done
+ if is_config "runtime" "luajit" && has_config "luajit"; then
+ add_options "luajit" "{public}"
+ elif has_config "lua"; then
+ add_options "lua" "{public}"
+ else
+ add_deps "lua"
+ fi
# add defines
add_defines "__tb_prefix__=\"xmake\""
diff --git a/core/xmake.sh b/core/xmake.sh
index 1528d3400..9b1640ecc 100755
--- a/core/xmake.sh
+++ b/core/xmake.sh
@@ -67,6 +67,22 @@ option_find_lua() {
option_end
}
+# the lua option
+option "luajit"
+ add_cfuncs "lua_pushstring"
+ add_cincludes "lua.h" "lualib.h" "lauxlib.h"
+ add_defines "USE_LUAJIT"
+ before_check "option_find_luajit"
+option_end
+
+option_find_luajit() {
+ option "luajit"
+ add_cflags `pkg-config --cflags luajit 2>/dev/null`
+ add_ldflags `pkg-config --libs luajit 2>/dev/null`
+ option_end
+}
+
+
# add projects
if ! has_config "lua"; then
if is_config "runtime" "luajit"; then