Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
BaiXuePrincess
rt-thread
提交
4e7247e0
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看板
体验新版 GitCode,发现更多精彩内容 >>
提交
4e7247e0
编写于
2月 21, 2013
作者:
B
Bernard Xiong
浏览文件
操作
浏览文件
下载
差异文件
Merge pull request #31 from aozima/pulls
Pulls
上级
a5df8c9d
6b52390a
变更
2
隐藏空白更改
内联
并排
Showing
2 changed file
with
114 addition
and
1 deletion
+114
-1
tools/building.py
tools/building.py
+6
-1
tools/codeblocks.py
tools/codeblocks.py
+108
-0
未找到文件。
tools/building.py
浏览文件 @
4e7247e0
...
...
@@ -99,7 +99,8 @@ def PrepareBuilding(env, root_directory, has_libcpu=False, remove_components = [
tgt_dict
=
{
'mdk'
:(
'keil'
,
'armcc'
),
'mdk4'
:(
'keil'
,
'armcc'
),
'iar'
:(
'iar'
,
'iar'
),
'vs'
:(
'msvc'
,
'cl'
)}
'vs'
:(
'msvc'
,
'cl'
),
'cb'
:(
'keil'
,
'armcc'
)}
tgt_name
=
GetOption
(
'target'
)
if
tgt_name
:
SetOption
(
'no_exec'
,
1
)
...
...
@@ -305,6 +306,7 @@ def EndBuilding(target, program = None):
from
keil
import
MDK4Project
from
iar
import
IARProject
from
vs
import
VSProject
from
codeblocks
import
CBProject
Env
.
AddPostAction
(
target
,
rtconfig
.
POST_ACTION
)
...
...
@@ -328,6 +330,9 @@ def EndBuilding(target, program = None):
if
GetOption
(
'target'
)
==
'vs'
:
VSProject
(
'project.vcproj'
,
Projects
,
program
)
if
GetOption
(
'target'
)
==
'cb'
:
CBProject
(
'project.cbp'
,
Projects
,
program
)
if
GetOption
(
'copy'
)
and
program
!=
None
:
MakeCopy
(
program
)
if
GetOption
(
'copy-header'
)
and
program
!=
None
:
...
...
tools/codeblocks.py
0 → 100644
浏览文件 @
4e7247e0
import
os
import
sys
import
string
import
building
import
xml.etree.ElementTree
as
etree
from
xml.etree.ElementTree
import
SubElement
from
utils
import
_make_path_relative
from
utils
import
xml_indent
fs_encoding
=
sys
.
getfilesystemencoding
()
def
CB_AddHeadFiles
(
program
,
elem
,
project_path
):
building
.
source_ext
=
[]
building
.
source_ext
=
[
"h"
]
for
item
in
program
:
building
.
walk_children
(
item
)
building
.
source_list
.
sort
()
# print building.source_list
for
f
in
building
.
source_list
:
path
=
_make_path_relative
(
project_path
,
f
)
Unit
=
SubElement
(
elem
,
'Unit'
)
Unit
.
set
(
'filename'
,
path
.
decode
(
fs_encoding
))
def
CB_AddCFiles
(
ProjectFiles
,
parent
,
gname
,
files
,
project_path
):
for
f
in
files
:
fn
=
f
.
rfile
()
name
=
fn
.
name
path
=
os
.
path
.
dirname
(
fn
.
abspath
)
path
=
_make_path_relative
(
project_path
,
path
)
path
=
os
.
path
.
join
(
path
,
name
)
Unit
=
SubElement
(
parent
,
'Unit'
)
Unit
.
set
(
'filename'
,
path
.
decode
(
fs_encoding
))
Option
=
SubElement
(
Unit
,
'Option'
)
Option
.
set
(
'compilerVar'
,
"CC"
)
def
CBProject
(
target
,
script
,
program
):
project_path
=
os
.
path
.
dirname
(
os
.
path
.
abspath
(
target
))
tree
=
etree
.
parse
(
'template.cbp'
)
root
=
tree
.
getroot
()
out
=
file
(
target
,
'wb'
)
out
.
write
(
'<?xml version="1.0" encoding="UTF-8" standalone="yes" ?>
\n
'
)
ProjectFiles
=
[]
# SECTION 1. add "*.c|*.h" files group
for
elem
in
tree
.
iter
(
tag
=
'Project'
):
# print elem.tag, elem.attrib
break
# add c files
for
group
in
script
:
group_xml
=
CB_AddCFiles
(
ProjectFiles
,
elem
,
group
[
'name'
],
group
[
'src'
],
project_path
)
# add h files
CB_AddHeadFiles
(
program
,
elem
,
project_path
)
# SECTION 2.
# write head include path
if
building
.
Env
.
has_key
(
'CPPPATH'
):
cpp_path
=
building
.
Env
[
'CPPPATH'
]
paths
=
set
()
for
path
in
cpp_path
:
inc
=
_make_path_relative
(
project_path
,
os
.
path
.
normpath
(
path
))
paths
.
add
(
inc
)
#.replace('\\', '/')
paths
=
[
i
for
i
in
paths
]
paths
.
sort
()
# write include path, definitions
for
elem
in
tree
.
iter
(
tag
=
'Compiler'
):
break
for
path
in
paths
:
Add
=
SubElement
(
elem
,
'Add'
)
Add
.
set
(
'directory'
,
path
)
for
macro
in
building
.
Env
[
'CPPDEFINES'
]:
Add
=
SubElement
(
elem
,
'Add'
)
Add
.
set
(
'option'
,
"-D"
+
macro
)
# write link flags
'''
# write lib dependence
if building.Env.has_key('LIBS'):
for elem in tree.iter(tag='Tool'):
if elem.attrib['Name'] == 'VCLinkerTool':
break
libs_with_extention = [i+'.lib' for i in building.Env['LIBS']]
libs = ' '.join(libs_with_extention)
elem.set('AdditionalDependencies', libs)
# write lib include path
if building.Env.has_key('LIBPATH'):
lib_path = building.Env['LIBPATH']
paths = set()
for path in lib_path:
inc = _make_path_relative(project_path, os.path.normpath(path))
paths.add(inc) #.replace('
\\
', '/')
paths = [i for i in paths]
paths.sort()
lib_paths = ';'.join(paths)
elem.set('AdditionalLibraryDirectories', lib_paths)
'''
xml_indent
(
root
)
out
.
write
(
etree
.
tostring
(
root
,
encoding
=
'utf-8'
))
out
.
close
()
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录