summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorruki <[email protected]>2022-12-14 23:28:07 +0800
committerruki <[email protected]>2022-12-14 23:28:07 +0800
commit77399e191bb5f318d962bd1b5194afa9c3580df6 (patch)
treefa1e059757b9fabba69849ee78fdb2d7ab087fe6
parenta9f753074707e6fb71c67b28ea5f9803f1babfe8 (diff)
add xmake lib to xmake.sh
-rwxr-xr-xcore/src/xmake/xmake.sh60
-rwxr-xr-xcore/xmake.sh7
2 files changed, 64 insertions, 3 deletions
diff --git a/core/src/xmake/xmake.sh b/core/src/xmake/xmake.sh
new file mode 100755
index 000000000..7b5415ac1
--- /dev/null
+++ b/core/src/xmake/xmake.sh
@@ -0,0 +1,60 @@
+#!/bin/sh
+
+target "xmake"
+ set_kind "static"
+
+ # add deps
+ add_deps "sv" "lua_cjson" "lz4" "tbox"
+ if is_config "runtime" "luajit"; then
+ add_deps "luajit"
+ else
+ add_deps "lua"
+ fi
+
+ # add defines
+ add_defines "__tb_prefix__=\"xmake\""
+ if is_mode "debug"; then
+ add_defines "__tb_debug__" "{public}"
+ fi
+
+ # set the auto-generated config.h
+ set_configdir "${buildir}/${plat}/${arch}/${mode}"
+ add_configfiles "xmake.config.h.in"
+
+ # add includes directory
+ add_includedirs ".." "{public}"
+ add_includedirs "${buildir}/${plat}/${arch}/${mode}" "{public}"
+ add_includedirs "../xxhash"
+
+ # add the common source files
+ add_files "*.c"
+ add_files "base64/*.c"
+ add_files "bloom_filter/*.c"
+ add_files "curses/*.c"
+ add_files "fwatcher/*.c"
+ add_files "hash/*.c"
+ add_files "io/*.c"
+ add_files "libc/*.c"
+ add_files "lz4/*.c"
+ add_files "os/*.c"
+ add_files "path/*.c"
+ add_files "process/*.c"
+ add_files "readline/*.c"
+ add_files "sandbox/*.c"
+ add_files "semver/*.c"
+ add_files "string/*.c"
+ add_files "tty/*.c"
+ if is_plat "mingw"; then
+ add_files "winos/*.c"
+ fi
+
+ # enable readline
+ if has_config "readline"; then
+ add_defines "XM_CONFIG_API_HAVE_READLINE"
+ fi
+
+ # enable curses
+ if has_config "curses"; then
+ add_defines "XM_CONFIG_API_HAVE_CURSES"
+ fi
+
diff --git a/core/xmake.sh b/core/xmake.sh
index 13e14f557..7c57aa04c 100755
--- a/core/xmake.sh
+++ b/core/xmake.sh
@@ -12,6 +12,9 @@ set_languages "c99"
# add defines
add_defines "_GNU_SOURCE=1" "_FILE_OFFSET_BITS=64" "_LARGEFILE_SOURCE"
+# disable some compiler errors
+add_cxflags "-Wno-error=deprecated-declarations" "-fno-strict-aliasing" "-Wno-error=nullability-completeness" "-Wno-error=parentheses-equality"
+
# add build modes
if is_mode "debug"; then
set_symbols "debug"
@@ -31,14 +34,12 @@ option "readline"
add_links "readline"
add_cincludes "readline/readline.h"
add_cfuncs "readline"
-# add_defines("XM_CONFIG_API_HAVE_READLINE")
# the curses option
option "curses"
set_description "Enable or disable curses library"
add_links "curses"
add_cincludes "curses.h"
-# add_defines "XM_CONFIG_API_HAVE_CURSES"
option_end
# add projects
@@ -47,7 +48,7 @@ includes "src/lua-cjson"
includes "src/sv"
includes "src/lz4"
includes "src/tbox"
-#includes "src/xmake"
+includes "src/xmake"
#includes "src/demo"
#if is_config "runtime" "luajit" then
# includes "src/luajit"