From b050da1c2a9f0b5553e0705b4d980e2575a8da68 Mon Sep 17 00:00:00 2001 From: qiuyiuestc Date: Sat, 1 Jan 2011 14:31:29 +0000 Subject: [PATCH] update ftk demo git-svn-id: https://rt-thread.googlecode.com/svn/trunk@1228 bbd45198-f89e-11dd-88c7-29a3b14d5316 --- examples/module/ftk_demo/SConscript | 50 +++++++++--------------- examples/module/ftk_demo/demo_listview.c | 2 +- examples/module/ftk_demo/demo_sprite.c | 4 +- 3 files changed, 22 insertions(+), 34 deletions(-) diff --git a/examples/module/ftk_demo/SConscript b/examples/module/ftk_demo/SConscript index e192e33916..820f180e40 100644 --- a/examples/module/ftk_demo/SConscript +++ b/examples/module/ftk_demo/SConscript @@ -1,6 +1,5 @@ -import os - Import('env') +Import('projects') Import('RTT_ROOT') Import('rtconfig') Import('TARGET') @@ -8,42 +7,31 @@ Import('TARGET') RTMLINKER = RTT_ROOT + '/tools/rtmlinker.exe ' # group definitions -CPATH = [RTT_ROOT + '/include', +group = {} +group['CCFLAGS'] = '' +group['CPPPATH'] = [RTT_ROOT + '/include', RTT_ROOT + '/examples/module', - RTT_ROOT + '/components/external/ftk/ftk/apps/common', RTT_ROOT + '/components/external/ftk/ftk/src/os/rt-thread', + RTT_ROOT + '/components/external/ftk/ftk/src/demos', + RTT_ROOT + '/components/external/ftk/ftk/apps/common', RTT_ROOT + '/components/external/ftk/ftk/src', RTT_ROOT + '/components/dfs', RTT_ROOT + '/components/dfs/include', RTT_ROOT + '/components/libc/newlib'] +group['CPPDEFINES'] = '' -src = Glob('*.c') +target = 'libftk_demos.so' +POST_ACTION = RTMLINKER + ' -l ' + TARGET + ' -o libftk_demos.mo ' + '$TARGET' -def GenerateDesktopApp(name): - xml = '\n\n\n' % (name, name, name) +# add group to project list +projects.append(group) - f = file(name + '.desktop', 'wb') - f.write(xml) - f.close +src_local = Glob('*.c') -def Demo(env, name): - if name == 'ftk_app_demo': - return - - target = name + '.so' - module_env = env.Clone(CCFLAGS = ' -DRT_THREAD -DFTK_AS_PLUGIN -mcpu=arm920t -O0 -fPIC') - module_env.Append(CPPPATH = CPATH) - module_env.Replace(LINKFLAGS = ('-z max-page-size=0x4 -shared -fPIC -e ftk_app_%s_create -nostdlib' % name)) - module_env.Program(name + '.so', [name + '.c', 'ftk_app_demo.o']) - POST_ACTION = RTMLINKER + ' -l ' + TARGET + (' -o %s.mo ' % name) + ('ftk_demo/%s.so' % name) - module_env.AddPostAction(target, POST_ACTION) - module_env.Clean(target, name + '.desktop') - GenerateDesktopApp(name) - -demo_env = env.Clone(CCFLAGS = ' -DRT_THREAD -DFTK_AS_PLUGIN -mcpu=arm920t -O0 -fPIC') -demo_env.Append(CPPPATH = CPATH) -demo_env.Object('ftk_app_demo.c') - -for item in src: - item = item.rstr() - Demo(env, item.split('.c')[0]) +env.Append(CCFLAGS = group['CCFLAGS']) +env.Append(CPPPATH = group['CPPPATH']) +env.Append(CPPDEFINES = group['CPPDEFINES']) +module_env = env.Clone(CCFLAGS = ' -DRT_THREAD -DFTK_AS_PLUGIN -mcpu=arm920t -O0 -fPIC') +module_env.Replace(LINKFLAGS = '-z max-page-size=0x4 -shared -fPIC -e 0 -nostdlib -s') +module_env.Program(target, src_local) +module_env.AddPostAction(target, POST_ACTION) diff --git a/examples/module/ftk_demo/demo_listview.c b/examples/module/ftk_demo/demo_listview.c index e76587fefd..43d1ed0628 100644 --- a/examples/module/ftk_demo/demo_listview.c +++ b/examples/module/ftk_demo/demo_listview.c @@ -37,7 +37,7 @@ static Ret button_more_clicked(void* ctx, void* obj) return RET_OK; } -Ret on_item_clicked(void* ctx, void* list) +static Ret on_item_clicked(void* ctx, void* list) { FtkListItemInfo* info = NULL; FtkListModel* model = ftk_list_view_get_model(list); diff --git a/examples/module/ftk_demo/demo_sprite.c b/examples/module/ftk_demo/demo_sprite.c index 1c1ee551c5..2888e33a15 100644 --- a/examples/module/ftk_demo/demo_sprite.c +++ b/examples/module/ftk_demo/demo_sprite.c @@ -6,14 +6,14 @@ static Ret button_quit_clicked(void* ctx, void* obj) return RET_OK; } -Ret on_move(void* ctx, void* obj) +static Ret on_move(void* ctx, void* obj) { ftk_logd("%s: %d %d\n", __func__, ftk_sprite_get_x(obj), ftk_sprite_get_y(obj)); return RET_OK; } -Ret move_cursor(void* ctx, void* obj) +static Ret move_cursor(void* ctx, void* obj) { FtkEvent* event = obj;