From 05c9d0f733bf3092bd05062d64862523e99d2409 Mon Sep 17 00:00:00 2001 From: lixianjing Date: Thu, 21 Dec 2023 10:50:10 +0800 Subject: [PATCH] improve for custom_widgets --- awtk_config.py | 9 +++++++++ src/SConscript | 6 +++++- src/custom_widgets/README.md | 4 ++-- src/custom_widgets/download.sh | 17 +++++++++++++++++ src/custom_widgets/repos.txt | 5 +++++ 5 files changed, 38 insertions(+), 3 deletions(-) create mode 100755 src/custom_widgets/download.sh create mode 100644 src/custom_widgets/repos.txt diff --git a/awtk_config.py b/awtk_config.py index 67e598e1d5..9940053b8a 100644 --- a/awtk_config.py +++ b/awtk_config.py @@ -1,5 +1,6 @@ import os import sys +import glob import os.path sys.path.insert(0, os.path.join(os.path.abspath(os.path.dirname(__file__)), 'scripts')) @@ -275,6 +276,14 @@ joinPath(TK_3RD_ROOT, 'gtest/googletest/include'), TK_TOOLS_ROOT] + OS_CPPPATH + NANOVG_BACKEND_CPPPATH +CUSTOM_WIDGETS_SRC=glob.glob('src/custom_widgets/*/src') + \ + glob.glob('src/custom_widgets/*/src/*/src') + \ + glob.glob('src/custom_widgets/*/src/*/include') + +for iter in CUSTOM_WIDGETS_SRC: + fullpath = os.path.join(TK_ROOT, str(iter)); + CPPPATH.append(fullpath); + os.environ['LCD'] = LCD os.environ['TK_ROOT'] = TK_ROOT os.environ['CCFLAGS'] = CCFLAGS + BUILD_DEBUG_FLAG diff --git a/src/SConscript b/src/SConscript index 17cbc29fc1..68112dcc80 100644 --- a/src/SConscript +++ b/src/SConscript @@ -90,7 +90,11 @@ WIDGETS_SOURCES = Glob('widgets/*.c') env.Library(os.path.join(LIB_DIR, 'widgets'), WIDGETS_SOURCES, LIBS=[]) EXT_WIDGETS_SOURCES = Glob('ext_widgets/*.c') + Glob('ext_widgets/*/*.c') + \ - Glob('custom_widgets/*.c') + Glob('custom_widgets/*/*.c') + Glob('custom_widgets/*.c') + Glob('custom_widgets/*/*.c') \ + + Glob('custom_widgets/*/src/*.cpp') + Glob('custom_widgets/*/src/*/*.cpp') \ + + Glob('custom_widgets/*/src/*.c') + Glob('custom_widgets/*/src/*/*.c') \ + + Glob('custom_widgets/*/src/*/src/*.cpp') + env.Library(os.path.join(LIB_DIR, 'extwidgets'), EXT_WIDGETS_SOURCES, LIBS=[]) env.Library(os.path.join(LIB_DIR, 'awtk_global'), ['awtk_global.c'], LIBS=[]) diff --git a/src/custom_widgets/README.md b/src/custom_widgets/README.md index 92d1717a94..37de394568 100644 --- a/src/custom_widgets/README.md +++ b/src/custom_widgets/README.md @@ -9,9 +9,9 @@ 注意: * 仍然需要自己注册控件,包含相应的头文件。 -* 拷贝自定义控件的 src 目录下的文件和子目录到此即可。 +* 拷贝自定义控件下载到本目录。 如: ``` - cp -rf ../../../awtk-widget-vlabel/src/* . +git clone https://gitee.com/zlgopen/awtk-widget-table-view ``` diff --git a/src/custom_widgets/download.sh b/src/custom_widgets/download.sh new file mode 100755 index 0000000000..3bb1239b05 --- /dev/null +++ b/src/custom_widgets/download.sh @@ -0,0 +1,17 @@ +GITHUB=github.com +GITEE=gitee.com + +for f in $(cat repos.txt) +do + echo $f + if [ -e $f ] + then + cd $f + git pull + cd - + else + git clone https://$GITEE/zlgopen/$f + fi +done + + diff --git a/src/custom_widgets/repos.txt b/src/custom_widgets/repos.txt new file mode 100644 index 0000000000..ec49aae4db --- /dev/null +++ b/src/custom_widgets/repos.txt @@ -0,0 +1,5 @@ +awtk-widget-liquid-flow +awtk-widget-table-view +awtk-widget-html-view +awtk-widget-slidable-row +awtk-sqlite3