summaryrefslogtreecommitdiff
path: root/core/src
diff options
context:
space:
mode:
authorruki <[email protected]>2022-05-08 16:47:17 +0800
committerruki <[email protected]>2022-05-08 16:47:17 +0800
commit27cc34ff877909993cc5de57b7ac7cff6a13b771 (patch)
tree977227044c79e3984f222f229f9a503305de4805 /core/src
parent97bdd6ab5753cf929e6d21a6d5a1ff33c145891b (diff)
add xmake.lua for lz4
Diffstat (limited to 'core/src')
-rw-r--r--core/src/demo/makefile5
-rw-r--r--core/src/lz4/makefile2
-rw-r--r--core/src/lz4/xmake.lua21
-rw-r--r--core/src/xmake/xmake.lua2
4 files changed, 29 insertions, 1 deletions
diff --git a/core/src/demo/makefile b/core/src/demo/makefile
index 6c4aad363..2a7ef787e 100644
--- a/core/src/demo/makefile
+++ b/core/src/demo/makefile
@@ -46,6 +46,11 @@ lua-cjson_LIBS := $(if $(findstring cjson,$(base_LIBNAMES)),,lua-cjson$(DTY
demo_LIBS += $(lua-cjson_LIBS)
demo_LIB_DIRS += ../lua-cjson
+# lz4
+lz4_DTYPE := $(if $(findstring lz4,$(base_LIBNAMES)),,$(DTYPE))
+demo_LIBS += lz4$(lz4_DTYPE)
+demo_LIB_DIRS += ../lz4
+
demo_LIBS += $(BASE_LIBS)
include $(PRO_DIR)/suffix.mak
diff --git a/core/src/lz4/makefile b/core/src/lz4/makefile
index ee5c1c770..660c7382c 100644
--- a/core/src/lz4/makefile
+++ b/core/src/lz4/makefile
@@ -17,6 +17,8 @@ lz4_C_FILES += \
lz4/lib/lz4hc \
lz4/lib/xxhash
+lz4_CFLAGS += -DXXH_NAMESPACE=LZ4_
+
# use given system library?
lz4_C_FILES := $(if $(findstring lz4,$(base_LIBNAMES)),,$(lz4_C_FILES))
lz4_ASM_FILES := $(if $(findstring lz4,$(base_LIBNAMES)),,$(lz4_ASM_FILES))
diff --git a/core/src/lz4/xmake.lua b/core/src/lz4/xmake.lua
new file mode 100644
index 000000000..6cdcaabf2
--- /dev/null
+++ b/core/src/lz4/xmake.lua
@@ -0,0 +1,21 @@
+target("lz4")
+ 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("lz4/lib/(*.h)", {prefixdir = "lz4"})
+
+ -- add include directories
+ add_includedirs("lz4", {public = true})
+
+ -- add the common source files
+ add_files("lz4/lib/*.c|lz4file.c")
+
+ -- add defines
+ add_defines("XXH_NAMESPACE=LZ4_")
+
diff --git a/core/src/xmake/xmake.lua b/core/src/xmake/xmake.lua
index 0b0693c9b..7c6d5c569 100644
--- a/core/src/xmake/xmake.lua
+++ b/core/src/xmake/xmake.lua
@@ -7,7 +7,7 @@ target("xmake")
if has_config("curses") or has_config("pdcurses") then
add_deps("lcurses")
end
- add_deps("sv", "lua-cjson", "tbox")
+ add_deps("sv", "lua-cjson", "lz4", "tbox")
add_deps(get_config("runtime"))
-- add defines