summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorruki <[email protected]>2022-12-18 16:38:14 +0800
committerruki <[email protected]>2022-12-18 16:38:14 +0800
commita10348c895d6591d52ac557ef4b57e3a11f8298b (patch)
treec054717a02e6b6222fd7f60aa096cea7ed7f9922
parent751c4a434fcc8786c2a120bf86ecb6a0cd40e568 (diff)
find sv
-rwxr-xr-xcore/src/xmake/xmake.sh4
-rwxr-xr-xcore/xmake.sh25
2 files changed, 26 insertions, 3 deletions
diff --git a/core/src/xmake/xmake.sh b/core/src/xmake/xmake.sh
index 1dc399c73..0a4bcb009 100755
--- a/core/src/xmake/xmake.sh
+++ b/core/src/xmake/xmake.sh
@@ -5,8 +5,8 @@ target "xmake"
set_default false
# add deps
- add_deps "sv" "tbox"
- local libs="lua_cjson lz4"
+ add_deps "tbox"
+ local libs="lua_cjson lz4 sv"
for lib in $libs; do
if has_config "$lib"; then
add_options "$lib" "{public}"
diff --git a/core/xmake.sh b/core/xmake.sh
index fadc330d8..36333a239 100755
--- a/core/xmake.sh
+++ b/core/xmake.sh
@@ -101,6 +101,27 @@ option_find_lz4() {
option_end
}
+# the sv option
+option "sv"
+ add_cfuncs "semver_tryn"
+ add_cincludes "semver.h"
+ before_check "option_find_sv"
+option_end
+
+option_find_sv() {
+ option "sv"
+ local dirs="/usr/local /usr"
+ for dir in $dirs; do
+ if test -f "${dir}/lib/libsv.a"; then
+ add_linkdirs "${dir}/lib"
+ add_includedirs "${dir}/include/sv"
+ break
+ fi
+ done
+ option_end
+}
+
+
# add projects
if ! has_config "lua"; then
if is_config "runtime" "luajit"; then
@@ -115,7 +136,9 @@ fi
if ! has_config "lz4"; then
includes "src/lz4"
fi
-includes "src/sv"
+if ! has_config "sv"; then
+ includes "src/sv"
+fi
includes "src/tbox"
includes "src/xmake"
includes "src/demo"