Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
BaiXuePrincess
rt-thread
提交
07f83757
R
rt-thread
项目概览
BaiXuePrincess
/
rt-thread
与 Fork 源项目一致
Fork自
RT-Thread / rt-thread
通知
1
Star
0
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
DevOps
流水线
流水线任务
计划
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
R
rt-thread
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
DevOps
DevOps
流水线
流水线任务
计划
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
流水线任务
提交
Issue看板
提交
07f83757
编写于
2月 07, 2014
作者:
B
bernard
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Add more feature on buildlib
上级
be2ff571
变更
1
隐藏空白更改
内联
并排
Showing
1 changed file
with
53 addition
and
4 deletion
+53
-4
tools/building.py
tools/building.py
+53
-4
未找到文件。
tools/building.py
浏览文件 @
07f83757
...
...
@@ -54,6 +54,12 @@ def PrepareBuilding(env, root_directory, has_libcpu=False, remove_components = [
env
[
'ARCOM'
]
=
'$AR --create $TARGET $SOURCES'
env
[
'LIBPREFIX'
]
=
''
env
[
'LIBSUFFIX'
]
=
'_rvds.lib'
env
[
'LIBLINKPREFIX'
]
=
''
env
[
'LIBLINKSUFFIX'
]
=
'_rvds.lib'
env
[
'LIBDIRPREFIX'
]
=
'--userlibpath '
elif
rtconfig
.
PLATFORM
==
'gcc'
:
env
[
'LIBSUFFIX'
]
=
'_gcc.a'
env
[
'LIBLINKSUFFIX'
]
=
'_gcc'
# patch for win32 spawn
if
env
[
'PLATFORM'
]
==
'win32'
and
rtconfig
.
PLATFORM
==
'gcc'
:
...
...
@@ -69,6 +75,11 @@ def PrepareBuilding(env, root_directory, has_libcpu=False, remove_components = [
# add program path
env
.
PrependENVPath
(
'PATH'
,
rtconfig
.
EXEC_PATH
)
# add library build action
act
=
SCons
.
Action
.
Action
(
BuildLibInstallAction
,
'Install compiled library... $TARGET'
)
bld
=
Builder
(
action
=
act
)
Env
.
Append
(
BUILDERS
=
{
'BuildLib'
:
bld
})
# parse rtconfig.h to get used component
PreProcessor
=
SCons
.
cpp
.
PreProcessor
()
f
=
file
(
'rtconfig.h'
,
'r'
)
...
...
@@ -127,12 +138,17 @@ def PrepareBuilding(env, root_directory, has_libcpu=False, remove_components = [
dest
=
'buildlib'
,
type
=
'string'
,
help
=
'building library of a component'
)
AddOption
(
'--cleanlib'
,
dest
=
'cleanlib'
,
action
=
'store_true'
,
default
=
False
,
help
=
'clean up the library by --buildlib'
)
# add target option
AddOption
(
'--target'
,
dest
=
'target'
,
type
=
'string'
,
help
=
'set target project: mdk'
)
help
=
'set target project: mdk
/iar/vs
'
)
#{target_name:(CROSS_TOOL, PLATFORM)}
tgt_dict
=
{
'mdk'
:(
'keil'
,
'armcc'
),
...
...
@@ -279,7 +295,7 @@ def DefineGroup(name, src, depend, **parameters):
group
=
parameters
group
[
'name'
]
=
name
group
[
'path'
]
=
GetCurrentDir
()
if
type
(
src
)
==
type
([
'src1'
,
'str2'
]):
if
type
(
src
)
==
type
([
'src1'
]):
group
[
'src'
]
=
File
(
src
)
else
:
group
[
'src'
]
=
src
...
...
@@ -292,13 +308,25 @@ def DefineGroup(name, src, depend, **parameters):
Env
.
Append
(
CPPDEFINES
=
group
[
'CPPDEFINES'
])
if
group
.
has_key
(
'LINKFLAGS'
):
Env
.
Append
(
LINKFLAGS
=
group
[
'LINKFLAGS'
])
# check whether to clean up library
if
GetOption
(
'cleanlib'
)
and
os
.
path
.
exists
(
os
.
path
.
join
(
group
[
'path'
],
GroupLibName
(
name
,
Env
))):
if
group
[
'src'
]
!=
[]:
print
'Remove library:'
,
GroupLibName
(
name
,
Env
)
do_rm_file
(
os
.
path
.
join
(
group
[
'path'
],
GroupLibName
(
name
,
Env
)))
# check whether exist group library
if
not
GetOption
(
'buildlib'
)
and
os
.
path
.
exists
(
os
.
path
.
join
(
group
[
'path'
],
GroupLibName
(
name
,
Env
))):
Env
.
Append
(
LIBS
=
[
name
])
group
[
'src'
]
=
[]
Env
.
Append
(
LIBPATH
=
[
GetCurrentDir
()])
if
group
.
has_key
(
'LIBS'
):
Env
.
Append
(
LIBS
=
group
[
'LIBS'
])
if
group
.
has_key
(
'LIBPATH'
):
Env
.
Append
(
LIBPATH
=
group
[
'LIBPATH'
])
objs
=
Env
.
Object
(
group
[
'src'
])
if
group
.
has_key
(
'LIBRARY'
):
objs
=
Env
.
Library
(
name
,
objs
)
...
...
@@ -332,6 +360,20 @@ def PreBuilding():
for
a
in
PREBUILDING
:
a
()
def
GroupLibName
(
name
,
env
):
return
env
[
'LIBPREFIX'
]
+
name
+
env
[
'LIBSUFFIX'
]
def
BuildLibInstallAction
(
target
,
source
,
env
):
lib_name
=
GetOption
(
'buildlib'
)
for
Group
in
Projects
:
if
Group
[
'name'
]
==
lib_name
:
lib_name
=
str
(
target
[
0
])
lib_name
=
GroupLibName
(
lib_name
,
env
)
dst_name
=
os
.
path
.
join
(
Group
[
'path'
],
lib_name
)
print
'Copy %s => %s'
%
(
lib_name
,
dst_name
)
do_copy_file
(
lib_name
,
dst_name
)
break
def
DoBuilding
(
target
,
objects
):
program
=
None
# check whether special buildlib option
...
...
@@ -342,13 +384,16 @@ def DoBuilding(target, objects):
if
Group
[
'name'
]
==
lib_name
:
objects
=
Env
.
Object
(
Group
[
'src'
])
program
=
Env
.
Library
(
lib_name
,
objects
)
# add library copy action
Env
.
BuildLib
(
lib_name
,
program
)
break
else
:
program
=
Env
.
Program
(
target
,
objects
)
EndBuilding
(
target
,
program
)
def
EndBuilding
(
target
,
program
=
None
):
import
rtconfig
from
keil
import
MDKProject
...
...
@@ -449,6 +494,10 @@ def GlobSubDir(sub_dir, ext_name):
dst
.
append
(
os
.
path
.
relpath
(
item
,
sub_dir
))
return
dst
def
do_rm_file
(
src
):
if
os
.
path
.
exists
(
src
):
os
.
unlink
(
src
)
def
do_copy_file
(
src
,
dst
):
import
shutil
# check source file
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录