summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorruki <[email protected]>2021-06-29 00:22:45 +0800
committerruki <[email protected]>2021-06-29 00:22:45 +0800
commit4ebd2c47cf301f7d21ccdb5f8354bc01929b0dc1 (patch)
treec2d02477b8aee8c3441bc8f36e571830cc0acfa5
parentdfafd3cf0e433ddf6322474ae6133d59b2b67a14 (diff)
seperate tbox
-rw-r--r--core/detect/tbox.c10
-rw-r--r--core/makefile1
-rw-r--r--core/src/demo/makefile5
-rw-r--r--core/src/tbox/makefile5
4 files changed, 20 insertions, 1 deletions
diff --git a/core/detect/tbox.c b/core/detect/tbox.c
new file mode 100644
index 000000000..dfec3eb1e
--- /dev/null
+++ b/core/detect/tbox.c
@@ -0,0 +1,10 @@
+#include <tbox/tbox.h>
+
+int main()
+{
+ if (tb_init(tb_null, tb_null))
+ {
+ tb_trace_i("hello tbox!");
+ tb_exit();
+ }
+}
diff --git a/core/makefile b/core/makefile
index a5e59f39c..47893a3bc 100644
--- a/core/makefile
+++ b/core/makefile
@@ -277,6 +277,7 @@ base_LIBPATH :=
base_LIBNAMES :=
base_LIBNAMES += $(shell if { cat detect/curses.c | $(CC) -xc - -lcurses -ltinfo -o /dev/null 2>/dev/null; }; then echo curses tinfo; fi )
base_LIBNAMES += $(shell if { cat detect/readline.c | $(CC) -xc - -lreadline -o /dev/null 2>/dev/null; }; then echo readline; fi )
+base_LIBNAMES += $(shell if { cat detect/tbox.c | $(CC) -xc - -ltbox -o /dev/null 2>/dev/null; }; then echo tbox; fi )
ifneq ($(TERMUX_ARCH),) # on termux/ci?
base_LIBNAMES += m dl
else
diff --git a/core/src/demo/makefile b/core/src/demo/makefile
index d49606341..b01fa0ded 100644
--- a/core/src/demo/makefile
+++ b/core/src/demo/makefile
@@ -13,8 +13,11 @@ demo_C_FILES += xmake
# packages
demo_PKGS-$(BASE) += base
+# debug suffix
+tbox_DTYPE := $(if $(findstring tbox,$(base_LIBNAMES)),,$(DTYPE))
+
# others
-demo_LIBS += xmake$(DTYPE) lcurses$(DTYPE) tbox$(DTYPE) luajit$(DTYPE) sv$(DTYPE) lua-cjson$(DTYPE) $(BASE_LIBS)
+demo_LIBS += xmake$(DTYPE) lcurses$(DTYPE) tbox$(tbox_DTYPE) luajit$(DTYPE) sv$(DTYPE) lua-cjson$(DTYPE) $(BASE_LIBS)
demo_INC_DIRS += ../ ../tbox/tbox/src ../tbox/inc/$(PLAT) ../luajit/luajit/src ../sv/sv/include
demo_LIB_DIRS += ../xmake ../tbox ../luajit ../sv ../lcurses ../lua-cjson
demo_CXFLAGS += -D__tb_prefix__=\"xmake\"
diff --git a/core/src/tbox/makefile b/core/src/tbox/makefile
index 1de99cd28..f24303eb1 100644
--- a/core/src/tbox/makefile
+++ b/core/src/tbox/makefile
@@ -302,6 +302,11 @@ tbox_INC_DIRS += \
tbox/src \
inc/$(PLAT)
+# use system tbox library?
+tbox_C_FILES := $(if $(findstring tbox,$(base_LIBNAMES)),,$(tbox_C_FILES))
+tbox_M_FILES := $(if $(findstring tbox,$(base_LIBNAMES)),,$(tbox_M_FILES))
+tbox_INC_FILES := $(if $(findstring tbox,$(base_LIBNAMES)),,$(tbox_INC_FILES))
+
# suffix
include $(PRO_DIR)/suffix.mak