Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
BaiXuePrincess
rt-thread
提交
d687cfb2
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,发现更多精彩内容 >>
提交
d687cfb2
编写于
11月 10, 2018
作者:
B
Bernard Xiong
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
[Tools] Change building script for Py3
上级
b69baa96
变更
15
隐藏空白更改
内联
并排
Showing
15 changed file
with
150 addition
and
87 deletion
+150
-87
tools/building.py
tools/building.py
+22
-5
tools/cdk.py
tools/cdk.py
+5
-5
tools/codeblocks.py
tools/codeblocks.py
+4
-4
tools/gcc.py
tools/gcc.py
+10
-9
tools/genconf.py
tools/genconf.py
+2
-2
tools/iar.py
tools/iar.py
+12
-11
tools/keil.py
tools/keil.py
+17
-17
tools/menuconfig.py
tools/menuconfig.py
+5
-5
tools/package.py
tools/package.py
+5
-5
tools/sconsui.py
tools/sconsui.py
+3
-3
tools/ua.py
tools/ua.py
+2
-2
tools/utils.py
tools/utils.py
+47
-3
tools/vs.py
tools/vs.py
+6
-6
tools/vs2012.py
tools/vs2012.py
+4
-4
tools/wizard.py
tools/wizard.py
+6
-6
未找到文件。
tools/building.py
浏览文件 @
d687cfb2
...
@@ -27,6 +27,7 @@
...
@@ -27,6 +27,7 @@
import
os
import
os
import
sys
import
sys
import
string
import
string
import
utils
from
SCons.Script
import
*
from
SCons.Script
import
*
from
utils
import
_make_path_relative
from
utils
import
_make_path_relative
...
@@ -233,7 +234,7 @@ def PrepareBuilding(env, root_directory, has_libcpu=False, remove_components = [
...
@@ -233,7 +234,7 @@ def PrepareBuilding(env, root_directory, has_libcpu=False, remove_components = [
rtconfig
.
CROSS_TOOL
,
rtconfig
.
PLATFORM
=
tgt_dict
[
tgt_name
]
rtconfig
.
CROSS_TOOL
,
rtconfig
.
PLATFORM
=
tgt_dict
[
tgt_name
]
# replace the 'RTT_CC' to 'CROSS_TOOL'
# replace the 'RTT_CC' to 'CROSS_TOOL'
os
.
environ
[
'RTT_CC'
]
=
rtconfig
.
CROSS_TOOL
os
.
environ
[
'RTT_CC'
]
=
rtconfig
.
CROSS_TOOL
reload
(
rtconfig
)
utils
.
ReloadModule
(
rtconfig
)
except
KeyError
:
except
KeyError
:
print
(
'Unknow target: '
+
tgt_name
+
'. Avaible targets: '
+
', '
.
join
(
tgt_dict
.
keys
()))
print
(
'Unknow target: '
+
tgt_name
+
'. Avaible targets: '
+
', '
.
join
(
tgt_dict
.
keys
()))
sys
.
exit
(
1
)
sys
.
exit
(
1
)
...
@@ -246,7 +247,7 @@ def PrepareBuilding(env, root_directory, has_libcpu=False, remove_components = [
...
@@ -246,7 +247,7 @@ def PrepareBuilding(env, root_directory, has_libcpu=False, remove_components = [
if
'RTT_EXEC_PATH'
in
os
.
environ
:
if
'RTT_EXEC_PATH'
in
os
.
environ
:
# del the 'RTT_EXEC_PATH' and using the 'EXEC_PATH' setting on rtconfig.py
# del the 'RTT_EXEC_PATH' and using the 'EXEC_PATH' setting on rtconfig.py
del
os
.
environ
[
'RTT_EXEC_PATH'
]
del
os
.
environ
[
'RTT_EXEC_PATH'
]
reload
(
rtconfig
)
utils
.
ReloadModule
(
rtconfig
)
# add compability with Keil MDK 4.6 which changes the directory of armcc.exe
# add compability with Keil MDK 4.6 which changes the directory of armcc.exe
if
rtconfig
.
PLATFORM
==
'armcc'
:
if
rtconfig
.
PLATFORM
==
'armcc'
:
...
@@ -407,7 +408,7 @@ def PrepareModuleBuilding(env, root_directory, bsp_directory):
...
@@ -407,7 +408,7 @@ def PrepareModuleBuilding(env, root_directory, bsp_directory):
# parse bsp rtconfig.h to get used component
# parse bsp rtconfig.h to get used component
PreProcessor
=
PatchedPreProcessor
()
PreProcessor
=
PatchedPreProcessor
()
f
=
file
(
bsp_directory
+
'/rtconfig.h'
,
'r'
)
f
=
open
(
bsp_directory
+
'/rtconfig.h'
,
'r'
)
contents
=
f
.
read
()
contents
=
f
.
read
()
f
.
close
()
f
.
close
()
PreProcessor
.
process_contents
(
contents
)
PreProcessor
.
process_contents
(
contents
)
...
@@ -458,7 +459,7 @@ def LocalOptions(config_filename):
...
@@ -458,7 +459,7 @@ def LocalOptions(config_filename):
# parse wiced_config.h to get used component
# parse wiced_config.h to get used component
PreProcessor
=
SCons
.
cpp
.
PreProcessor
()
PreProcessor
=
SCons
.
cpp
.
PreProcessor
()
f
=
file
(
config_filename
,
'r'
)
f
=
open
(
config_filename
,
'r'
)
contents
=
f
.
read
()
contents
=
f
.
read
()
f
.
close
()
f
.
close
()
...
@@ -573,6 +574,10 @@ def DefineGroup(name, src, depend, **parameters):
...
@@ -573,6 +574,10 @@ def DefineGroup(name, src, depend, **parameters):
if
'CCFLAGS'
in
group
:
if
'CCFLAGS'
in
group
:
Env
.
AppendUnique
(
CCFLAGS
=
group
[
'CCFLAGS'
])
Env
.
AppendUnique
(
CCFLAGS
=
group
[
'CCFLAGS'
])
if
'CPPPATH'
in
group
:
if
'CPPPATH'
in
group
:
paths
=
[]
for
item
in
group
[
'CPPPATH'
]:
paths
.
append
(
os
.
path
.
abspath
(
item
))
group
[
'CPPPATH'
]
=
paths
Env
.
AppendUnique
(
CPPPATH
=
group
[
'CPPPATH'
])
Env
.
AppendUnique
(
CPPPATH
=
group
[
'CPPPATH'
])
if
'CPPDEFINES'
in
group
:
if
'CPPDEFINES'
in
group
:
Env
.
AppendUnique
(
CPPDEFINES
=
group
[
'CPPDEFINES'
])
Env
.
AppendUnique
(
CPPDEFINES
=
group
[
'CPPDEFINES'
])
...
@@ -580,6 +585,18 @@ def DefineGroup(name, src, depend, **parameters):
...
@@ -580,6 +585,18 @@ def DefineGroup(name, src, depend, **parameters):
Env
.
AppendUnique
(
LINKFLAGS
=
group
[
'LINKFLAGS'
])
Env
.
AppendUnique
(
LINKFLAGS
=
group
[
'LINKFLAGS'
])
if
'ASFLAGS'
in
group
:
if
'ASFLAGS'
in
group
:
Env
.
AppendUnique
(
ASFLAGS
=
group
[
'ASFLAGS'
])
Env
.
AppendUnique
(
ASFLAGS
=
group
[
'ASFLAGS'
])
if
'LOCAL_CPPPATH'
in
group
:
paths
=
[]
for
item
in
group
[
'LOCAL_CPPPATH'
]:
paths
.
append
(
os
.
path
.
abspath
(
item
))
group
[
'LOCAL_CPPPATH'
]
=
paths
import
rtconfig
if
rtconfig
.
PLATFORM
==
'gcc'
:
if
'CCFLAGS'
in
group
:
group
[
'CCFLAGS'
]
=
utils
.
GCCC99Patch
(
group
[
'CCFLAGS'
])
if
'LOCAL_CCFLAGS'
in
group
:
group
[
'LOCAL_CCFLAGS'
]
=
utils
.
GCCC99Patch
(
group
[
'LOCAL_CCFLAGS'
])
# check whether to clean up library
# check whether to clean up library
if
GetOption
(
'cleanlib'
)
and
os
.
path
.
exists
(
os
.
path
.
join
(
group
[
'path'
],
GroupLibFullName
(
name
,
Env
))):
if
GetOption
(
'cleanlib'
)
and
os
.
path
.
exists
(
os
.
path
.
join
(
group
[
'path'
],
GroupLibFullName
(
name
,
Env
))):
...
@@ -863,7 +880,7 @@ def GetVersion():
...
@@ -863,7 +880,7 @@ def GetVersion():
# parse rtdef.h to get RT-Thread version
# parse rtdef.h to get RT-Thread version
prepcessor
=
PatchedPreProcessor
()
prepcessor
=
PatchedPreProcessor
()
f
=
file
(
rtdef
,
'r'
)
f
=
open
(
rtdef
,
'r'
)
contents
=
f
.
read
()
contents
=
f
.
read
()
f
.
close
()
f
.
close
()
prepcessor
.
process_contents
(
contents
)
prepcessor
.
process_contents
(
contents
)
...
...
tools/cdk.py
浏览文件 @
d687cfb2
...
@@ -56,7 +56,7 @@ def _CDKProject(tree, target, script):
...
@@ -56,7 +56,7 @@ def _CDKProject(tree, target, script):
project_path
=
os
.
path
.
dirname
(
os
.
path
.
abspath
(
target
))
project_path
=
os
.
path
.
dirname
(
os
.
path
.
abspath
(
target
))
root
=
tree
.
getroot
()
root
=
tree
.
getroot
()
out
=
file
(
target
,
'wb
'
)
out
=
open
(
target
,
'w
'
)
out
.
write
(
'<?xml version="1.0" encoding="UTF-8"?>
\n
'
)
out
.
write
(
'<?xml version="1.0" encoding="UTF-8"?>
\n
'
)
CPPPATH
=
[]
CPPPATH
=
[]
...
@@ -73,28 +73,28 @@ def _CDKProject(tree, target, script):
...
@@ -73,28 +73,28 @@ def _CDKProject(tree, target, script):
group_tree
=
SDKAddGroup
(
ProjectFiles
,
root
,
group
[
'name'
],
group
[
'src'
],
project_path
)
group_tree
=
SDKAddGroup
(
ProjectFiles
,
root
,
group
[
'name'
],
group
[
'src'
],
project_path
)
# get each include path
# get each include path
if
group
.
has_key
(
'CPPPATH'
)
and
group
[
'CPPPATH'
]:
if
'CPPPATH'
in
group
and
group
[
'CPPPATH'
]:
if
CPPPATH
:
if
CPPPATH
:
CPPPATH
+=
group
[
'CPPPATH'
]
CPPPATH
+=
group
[
'CPPPATH'
]
else
:
else
:
CPPPATH
+=
group
[
'CPPPATH'
]
CPPPATH
+=
group
[
'CPPPATH'
]
# get each group's definitions
# get each group's definitions
if
group
.
has_key
(
'CPPDEFINES'
)
and
group
[
'CPPDEFINES'
]:
if
'CPPDEFINES'
in
group
and
group
[
'CPPDEFINES'
]:
if
CPPDEFINES
:
if
CPPDEFINES
:
CPPDEFINES
+=
group
[
'CPPDEFINES'
]
CPPDEFINES
+=
group
[
'CPPDEFINES'
]
else
:
else
:
CPPDEFINES
+=
group
[
'CPPDEFINES'
]
CPPDEFINES
+=
group
[
'CPPDEFINES'
]
# get each group's cc flags
# get each group's cc flags
if
group
.
has_key
(
'CCFLAGS'
)
and
group
[
'CCFLAGS'
]:
if
'CCFLAGS'
in
group
and
group
[
'CCFLAGS'
]:
if
CCFLAGS
:
if
CCFLAGS
:
CCFLAGS
+=
' '
+
group
[
'CCFLAGS'
]
CCFLAGS
+=
' '
+
group
[
'CCFLAGS'
]
else
:
else
:
CCFLAGS
+=
group
[
'CCFLAGS'
]
CCFLAGS
+=
group
[
'CCFLAGS'
]
# get each group's link flags
# get each group's link flags
if
group
.
has_key
(
'LINKFLAGS'
)
and
group
[
'LINKFLAGS'
]:
if
'LINKFLAGS'
in
group
and
group
[
'LINKFLAGS'
]:
if
LINKFLAGS
:
if
LINKFLAGS
:
LINKFLAGS
+=
' '
+
group
[
'LINKFLAGS'
]
LINKFLAGS
+=
' '
+
group
[
'LINKFLAGS'
]
else
:
else
:
...
...
tools/codeblocks.py
浏览文件 @
d687cfb2
...
@@ -73,7 +73,7 @@ def CBProject(target, script, program):
...
@@ -73,7 +73,7 @@ def CBProject(target, script, program):
root
=
tree
.
getroot
()
root
=
tree
.
getroot
()
out
=
file
(
target
,
'wb
'
)
out
=
open
(
target
,
'w
'
)
out
.
write
(
'<?xml version="1.0" encoding="UTF-8" standalone="yes" ?>
\n
'
)
out
.
write
(
'<?xml version="1.0" encoding="UTF-8" standalone="yes" ?>
\n
'
)
ProjectFiles
=
[]
ProjectFiles
=
[]
...
@@ -90,7 +90,7 @@ def CBProject(target, script, program):
...
@@ -90,7 +90,7 @@ def CBProject(target, script, program):
# SECTION 2.
# SECTION 2.
# write head include path
# write head include path
if
building
.
Env
.
has_key
(
'CPPPATH'
)
:
if
'CPPPATH'
in
building
.
Env
:
cpp_path
=
building
.
Env
[
'CPPPATH'
]
cpp_path
=
building
.
Env
[
'CPPPATH'
]
paths
=
set
()
paths
=
set
()
for
path
in
cpp_path
:
for
path
in
cpp_path
:
...
@@ -114,7 +114,7 @@ def CBProject(target, script, program):
...
@@ -114,7 +114,7 @@ def CBProject(target, script, program):
# write link flags
# write link flags
'''
'''
# write lib dependence
# write lib dependence
if
building.Env.has_key('LIBS')
:
if
'LIBS' in building.Env
:
for elem in tree.iter(tag='Tool'):
for elem in tree.iter(tag='Tool'):
if elem.attrib['Name'] == 'VCLinkerTool':
if elem.attrib['Name'] == 'VCLinkerTool':
break
break
...
@@ -123,7 +123,7 @@ def CBProject(target, script, program):
...
@@ -123,7 +123,7 @@ def CBProject(target, script, program):
elem.set('AdditionalDependencies', libs)
elem.set('AdditionalDependencies', libs)
# write lib include path
# write lib include path
if
building.Env.has_key('LIBPATH')
:
if
'LIBPATH' in building.Env
:
lib_path = building.Env['LIBPATH']
lib_path = building.Env['LIBPATH']
paths = set()
paths = set()
for path in lib_path:
for path in lib_path:
...
...
tools/gcc.py
浏览文件 @
d687cfb2
...
@@ -105,26 +105,27 @@ def GCCResult(rtconfig, str):
...
@@ -105,26 +105,27 @@ def GCCResult(rtconfig, str):
posix_thread
=
0
posix_thread
=
0
for
line
in
stdout
.
split
(
b
'
\n
'
):
for
line
in
stdout
.
split
(
b
'
\n
'
):
if
re
.
search
(
b
'fd_set'
,
line
):
line
=
line
.
decode
()
if
re
.
search
(
'fd_set'
,
line
):
have_fdset
=
1
have_fdset
=
1
# check for sigal
# check for sigal
if
re
.
search
(
b
'struct[
\t
]+sigaction'
,
line
):
if
re
.
search
(
'struct[
\t
]+sigaction'
,
line
):
have_sigaction
=
1
have_sigaction
=
1
if
re
.
search
(
b
'struct[
\t
]+sigevent'
,
line
):
if
re
.
search
(
'struct[
\t
]+sigevent'
,
line
):
have_sigevent
=
1
have_sigevent
=
1
if
re
.
search
(
b
'siginfo_t'
,
line
):
if
re
.
search
(
'siginfo_t'
,
line
):
have_siginfo
=
1
have_siginfo
=
1
if
re
.
search
(
b
'union[
\t
]+sigval'
,
line
):
if
re
.
search
(
'union[
\t
]+sigval'
,
line
):
have_sigval
=
1
have_sigval
=
1
if
re
.
search
(
b
'char\* version'
,
line
):
if
re
.
search
(
'char\* version'
,
line
):
version
=
re
.
search
(
b
r
'\"([^"]+)\"'
,
line
).
groups
()[
0
]
version
=
re
.
search
(
r
'\"([^"]+)\"'
,
line
).
groups
()[
0
]
if
re
.
findall
(
b
'iso_c_visible = [\d]+'
,
line
):
if
re
.
findall
(
'iso_c_visible = [\d]+'
,
line
):
stdc
=
re
.
findall
(
'[\d]+'
,
line
)[
0
]
stdc
=
re
.
findall
(
'[\d]+'
,
line
)[
0
]
if
re
.
findall
(
b
'pthread_create'
,
line
):
if
re
.
findall
(
'pthread_create'
,
line
):
posix_thread
=
1
posix_thread
=
1
if
have_fdset
:
if
have_fdset
:
...
...
tools/genconf.py
浏览文件 @
d687cfb2
...
@@ -6,7 +6,7 @@ def genconfig() :
...
@@ -6,7 +6,7 @@ def genconfig() :
PreProcessor
=
SCons
.
cpp
.
PreProcessor
()
PreProcessor
=
SCons
.
cpp
.
PreProcessor
()
try
:
try
:
f
=
file
(
'rtconfig.h'
,
'r'
)
f
=
open
(
'rtconfig.h'
,
'r'
)
contents
=
f
.
read
()
contents
=
f
.
read
()
f
.
close
()
f
.
close
()
except
:
except
:
...
@@ -16,7 +16,7 @@ def genconfig() :
...
@@ -16,7 +16,7 @@ def genconfig() :
options
=
PreProcessor
.
cpp_namespace
options
=
PreProcessor
.
cpp_namespace
try
:
try
:
f
=
file
(
'.config'
,
'w'
)
f
=
open
(
'.config'
,
'w'
)
for
(
opt
,
value
)
in
options
.
items
():
for
(
opt
,
value
)
in
options
.
items
():
if
type
(
value
)
==
type
(
1
):
if
type
(
value
)
==
type
(
1
):
f
.
write
(
"CONFIG_%s=%d
\n
"
%
(
opt
,
value
))
f
.
write
(
"CONFIG_%s=%d
\n
"
%
(
opt
,
value
))
...
...
tools/iar.py
浏览文件 @
d687cfb2
...
@@ -25,6 +25,7 @@
...
@@ -25,6 +25,7 @@
import
os
import
os
import
sys
import
sys
import
string
import
string
import
utils
import
xml.etree.ElementTree
as
etree
import
xml.etree.ElementTree
as
etree
from
xml.etree.ElementTree
import
SubElement
from
xml.etree.ElementTree
import
SubElement
...
@@ -62,14 +63,14 @@ def IARAddGroup(parent, name, files, project_path):
...
@@ -62,14 +63,14 @@ def IARAddGroup(parent, name, files, project_path):
file_name
=
SubElement
(
file
,
'name'
)
file_name
=
SubElement
(
file
,
'name'
)
if
os
.
path
.
isabs
(
path
):
if
os
.
path
.
isabs
(
path
):
file_name
.
text
=
path
.
decode
(
fs_encoding
)
file_name
.
text
=
path
# path
.decode(fs_encoding)
else
:
else
:
file_name
.
text
=
(
'$PROJ_DIR$
\\
'
+
path
).
decode
(
fs_encoding
)
file_name
.
text
=
'$PROJ_DIR$
\\
'
+
path
#
('$PROJ_DIR$\\' + path).decode(fs_encoding)
def
IARWorkspace
(
target
):
def
IARWorkspace
(
target
):
# make an workspace
# make an workspace
workspace
=
target
.
replace
(
'.ewp'
,
'.eww'
)
workspace
=
target
.
replace
(
'.ewp'
,
'.eww'
)
out
=
file
(
workspace
,
'wb
'
)
out
=
open
(
workspace
,
'w
'
)
xml
=
iar_workspace
%
target
xml
=
iar_workspace
%
target
out
.
write
(
xml
)
out
.
write
(
xml
)
out
.
close
()
out
.
close
()
...
@@ -80,7 +81,7 @@ def IARProject(target, script):
...
@@ -80,7 +81,7 @@ def IARProject(target, script):
tree
=
etree
.
parse
(
'template.ewp'
)
tree
=
etree
.
parse
(
'template.ewp'
)
root
=
tree
.
getroot
()
root
=
tree
.
getroot
()
out
=
file
(
target
,
'wb
'
)
out
=
open
(
target
,
'w
'
)
CPPPATH
=
[]
CPPPATH
=
[]
CPPDEFINES
=
[]
CPPDEFINES
=
[]
...
@@ -105,18 +106,18 @@ def IARProject(target, script):
...
@@ -105,18 +106,18 @@ def IARProject(target, script):
IARAddGroup
(
root
,
group
[
'name'
],
group
[
'src'
],
project_path
)
IARAddGroup
(
root
,
group
[
'name'
],
group
[
'src'
],
project_path
)
# get each include path
# get each include path
if
group
.
has_key
(
'CPPPATH'
)
and
group
[
'CPPPATH'
]:
if
'CPPPATH'
in
group
and
group
[
'CPPPATH'
]:
CPPPATH
+=
group
[
'CPPPATH'
]
CPPPATH
+=
group
[
'CPPPATH'
]
# get each group's definitions
# get each group's definitions
if
group
.
has_key
(
'CPPDEFINES'
)
and
group
[
'CPPDEFINES'
]:
if
'CPPDEFINES'
in
group
and
group
[
'CPPDEFINES'
]:
CPPDEFINES
+=
group
[
'CPPDEFINES'
]
CPPDEFINES
+=
group
[
'CPPDEFINES'
]
# get each group's link flags
# get each group's link flags
if
group
.
has_key
(
'LINKFLAGS'
)
and
group
[
'LINKFLAGS'
]:
if
'LINKFLAGS'
in
group
and
group
[
'LINKFLAGS'
]:
LINKFLAGS
+=
group
[
'LINKFLAGS'
]
LINKFLAGS
+=
group
[
'LINKFLAGS'
]
if
group
.
has_key
(
'LIBS'
)
and
group
[
'LIBS'
]:
if
'LIBS'
in
group
and
group
[
'LIBS'
]:
for
item
in
group
[
'LIBS'
]:
for
item
in
group
[
'LIBS'
]:
lib_path
=
searchLib
(
group
)
lib_path
=
searchLib
(
group
)
if
lib_path
!=
''
:
if
lib_path
!=
''
:
...
@@ -161,7 +162,7 @@ def IARProject(target, script):
...
@@ -161,7 +162,7 @@ def IARProject(target, script):
state
.
text
=
path
state
.
text
=
path
xml_indent
(
root
)
xml_indent
(
root
)
out
.
write
(
etree
.
tostring
(
root
,
encoding
=
'utf-8'
))
out
.
write
(
etree
.
tostring
(
root
,
encoding
=
'utf-8'
)
.
decode
()
)
out
.
close
()
out
.
close
()
IARWorkspace
(
target
)
IARWorkspace
(
target
)
...
@@ -176,14 +177,14 @@ def IARVersion():
...
@@ -176,14 +177,14 @@ def IARVersion():
# backup environ
# backup environ
old_environ
=
os
.
environ
old_environ
=
os
.
environ
os
.
environ
[
'RTT_CC'
]
=
'iar'
os
.
environ
[
'RTT_CC'
]
=
'iar'
reload
(
rtconfig
)
utils
.
ReloadModule
(
rtconfig
)
# get iar path
# get iar path
path
=
rtconfig
.
EXEC_PATH
path
=
rtconfig
.
EXEC_PATH
# restore environ
# restore environ
os
.
environ
=
old_environ
os
.
environ
=
old_environ
reload
(
rtconfig
)
utils
.
ReloadModule
(
rtconfig
)
return
path
return
path
...
...
tools/keil.py
浏览文件 @
d687cfb2
...
@@ -159,12 +159,12 @@ def MDK4AddGroup(ProjectFiles, parent, name, files, project_path):
...
@@ -159,12 +159,12 @@ def MDK4AddGroup(ProjectFiles, parent, name, files, project_path):
if
ProjectFiles
.
count
(
obj_name
):
if
ProjectFiles
.
count
(
obj_name
):
name
=
basename
+
'_'
+
name
name
=
basename
+
'_'
+
name
ProjectFiles
.
append
(
obj_name
)
ProjectFiles
.
append
(
obj_name
)
file_name
.
text
=
name
.
decode
(
fs_encoding
)
file_name
.
text
=
name
# name
.decode(fs_encoding)
file_type
=
SubElement
(
file
,
'FileType'
)
file_type
=
SubElement
(
file
,
'FileType'
)
file_type
.
text
=
'%d'
%
_get_filetype
(
name
)
file_type
.
text
=
'%d'
%
_get_filetype
(
name
)
file_path
=
SubElement
(
file
,
'FilePath'
)
file_path
=
SubElement
(
file
,
'FilePath'
)
file_path
.
text
=
path
.
decode
(
fs_encoding
)
file_path
.
text
=
path
# path
.decode(fs_encoding)
return
group
return
group
...
@@ -173,7 +173,7 @@ def MDK45Project(tree, target, script):
...
@@ -173,7 +173,7 @@ def MDK45Project(tree, target, script):
project_path
=
os
.
path
.
dirname
(
os
.
path
.
abspath
(
target
))
project_path
=
os
.
path
.
dirname
(
os
.
path
.
abspath
(
target
))
root
=
tree
.
getroot
()
root
=
tree
.
getroot
()
out
=
file
(
target
,
'wb
'
)
out
=
open
(
target
,
'w
'
)
out
.
write
(
'<?xml version="1.0" encoding="UTF-8" standalone="no" ?>
\n
'
)
out
.
write
(
'<?xml version="1.0" encoding="UTF-8" standalone="no" ?>
\n
'
)
CPPPATH
=
[]
CPPPATH
=
[]
...
@@ -191,51 +191,51 @@ def MDK45Project(tree, target, script):
...
@@ -191,51 +191,51 @@ def MDK45Project(tree, target, script):
group_tree
=
MDK4AddGroup
(
ProjectFiles
,
groups
,
group
[
'name'
],
group
[
'src'
],
project_path
)
group_tree
=
MDK4AddGroup
(
ProjectFiles
,
groups
,
group
[
'name'
],
group
[
'src'
],
project_path
)
# for local CPPPATH/CPPDEFINES
# for local CPPPATH/CPPDEFINES
if
(
group_tree
!=
None
)
and
(
group
.
has_key
(
'LOCAL_CPPPATH'
)
or
group
.
has_key
(
'LOCAL_CCFLAGS'
)
or
group
.
has_key
(
'LOCAL_CPPDEFINES'
)
):
if
(
group_tree
!=
None
)
and
(
'LOCAL_CPPPATH'
in
group
or
'LOCAL_CCFLAGS'
in
group
or
'LOCAL_CPPDEFINES'
in
group
):
GroupOption
=
SubElement
(
group_tree
,
'GroupOption'
)
GroupOption
=
SubElement
(
group_tree
,
'GroupOption'
)
GroupArmAds
=
SubElement
(
GroupOption
,
'GroupArmAds'
)
GroupArmAds
=
SubElement
(
GroupOption
,
'GroupArmAds'
)
Cads
=
SubElement
(
GroupArmAds
,
'Cads'
)
Cads
=
SubElement
(
GroupArmAds
,
'Cads'
)
VariousControls
=
SubElement
(
Cads
,
'VariousControls'
)
VariousControls
=
SubElement
(
Cads
,
'VariousControls'
)
MiscControls
=
SubElement
(
VariousControls
,
'MiscControls'
)
MiscControls
=
SubElement
(
VariousControls
,
'MiscControls'
)
if
group
.
has_key
(
'LOCAL_CCFLAGS'
)
:
if
'LOCAL_CCFLAGS'
in
group
:
MiscControls
.
text
=
group
[
'LOCAL_CCFLAGS'
]
MiscControls
.
text
=
group
[
'LOCAL_CCFLAGS'
]
else
:
else
:
MiscControls
.
text
=
' '
MiscControls
.
text
=
' '
Define
=
SubElement
(
VariousControls
,
'Define'
)
Define
=
SubElement
(
VariousControls
,
'Define'
)
if
group
.
has_key
(
'LOCAL_CPPDEFINES'
)
:
if
'LOCAL_CPPDEFINES'
in
group
:
Define
.
text
=
', '
.
join
(
set
(
group
[
'LOCAL_CPPDEFINES'
]))
Define
.
text
=
', '
.
join
(
set
(
group
[
'LOCAL_CPPDEFINES'
]))
else
:
else
:
Define
.
text
=
' '
Define
.
text
=
' '
Undefine
=
SubElement
(
VariousControls
,
'Undefine'
)
Undefine
=
SubElement
(
VariousControls
,
'Undefine'
)
Undefine
.
text
=
' '
Undefine
.
text
=
' '
IncludePath
=
SubElement
(
VariousControls
,
'IncludePath'
)
IncludePath
=
SubElement
(
VariousControls
,
'IncludePath'
)
if
group
.
has_key
(
'LOCAL_CPPPATH'
)
:
if
'LOCAL_CPPPATH'
in
group
:
IncludePath
.
text
=
';'
.
join
([
_make_path_relative
(
project_path
,
os
.
path
.
normpath
(
i
))
for
i
in
group
[
'LOCAL_CPPPATH'
]])
IncludePath
.
text
=
';'
.
join
([
_make_path_relative
(
project_path
,
os
.
path
.
normpath
(
i
))
for
i
in
group
[
'LOCAL_CPPPATH'
]])
else
:
else
:
IncludePath
.
text
=
' '
IncludePath
.
text
=
' '
# get each include path
# get each include path
if
group
.
has_key
(
'CPPPATH'
)
and
group
[
'CPPPATH'
]:
if
'CPPPATH'
in
group
and
group
[
'CPPPATH'
]:
if
CPPPATH
:
if
CPPPATH
:
CPPPATH
+=
group
[
'CPPPATH'
]
CPPPATH
+=
group
[
'CPPPATH'
]
else
:
else
:
CPPPATH
+=
group
[
'CPPPATH'
]
CPPPATH
+=
group
[
'CPPPATH'
]
# get each group's definitions
# get each group's definitions
if
group
.
has_key
(
'CPPDEFINES'
)
and
group
[
'CPPDEFINES'
]:
if
'CPPDEFINES'
in
group
and
group
[
'CPPDEFINES'
]:
if
CPPDEFINES
:
if
CPPDEFINES
:
CPPDEFINES
+=
group
[
'CPPDEFINES'
]
CPPDEFINES
+=
group
[
'CPPDEFINES'
]
else
:
else
:
CPPDEFINES
=
group
[
'CPPDEFINES'
]
CPPDEFINES
=
group
[
'CPPDEFINES'
]
# get each group's link flags
# get each group's link flags
if
group
.
has_key
(
'LINKFLAGS'
)
and
group
[
'LINKFLAGS'
]:
if
'LINKFLAGS'
in
group
and
group
[
'LINKFLAGS'
]:
if
LINKFLAGS
:
if
LINKFLAGS
:
LINKFLAGS
+=
' '
+
group
[
'LINKFLAGS'
]
LINKFLAGS
+=
' '
+
group
[
'LINKFLAGS'
]
else
:
else
:
LINKFLAGS
+=
group
[
'LINKFLAGS'
]
LINKFLAGS
+=
group
[
'LINKFLAGS'
]
if
group
.
has_key
(
'LIBS'
)
and
group
[
'LIBS'
]:
if
'LIBS'
in
group
and
group
[
'LIBS'
]:
for
item
in
group
[
'LIBS'
]:
for
item
in
group
[
'LIBS'
]:
lib_path
=
''
lib_path
=
''
for
path_item
in
group
[
'LIBPATH'
]:
for
path_item
in
group
[
'LIBPATH'
]:
...
@@ -260,7 +260,7 @@ def MDK45Project(tree, target, script):
...
@@ -260,7 +260,7 @@ def MDK45Project(tree, target, script):
Misc
.
text
=
LINKFLAGS
Misc
.
text
=
LINKFLAGS
xml_indent
(
root
)
xml_indent
(
root
)
out
.
write
(
etree
.
tostring
(
root
,
encoding
=
'utf-8'
))
out
.
write
(
etree
.
tostring
(
root
,
encoding
=
'utf-8'
)
.
decode
()
)
out
.
close
()
out
.
close
()
def
MDK4Project
(
target
,
script
):
def
MDK4Project
(
target
,
script
):
...
@@ -294,10 +294,10 @@ def MDK5Project(target, script):
...
@@ -294,10 +294,10 @@ def MDK5Project(target, script):
shutil
.
copy2
(
'template.uvoptx'
,
'project.uvoptx'
)
shutil
.
copy2
(
'template.uvoptx'
,
'project.uvoptx'
)
def
MDKProject
(
target
,
script
):
def
MDKProject
(
target
,
script
):
template
=
file
(
'template.Uv2'
,
"rb
"
)
template
=
open
(
'template.Uv2'
,
"r
"
)
lines
=
template
.
readlines
()
lines
=
template
.
readlines
()
project
=
file
(
target
,
"wb
"
)
project
=
open
(
target
,
"w
"
)
project_path
=
os
.
path
.
dirname
(
os
.
path
.
abspath
(
target
))
project_path
=
os
.
path
.
dirname
(
os
.
path
.
abspath
(
target
))
line_index
=
5
line_index
=
5
...
@@ -323,21 +323,21 @@ def MDKProject(target, script):
...
@@ -323,21 +323,21 @@ def MDKProject(target, script):
# print group['name']
# print group['name']
# get each include path
# get each include path
if
group
.
has_key
(
'CPPPATH'
)
and
group
[
'CPPPATH'
]:
if
'CPPPATH'
in
group
and
group
[
'CPPPATH'
]:
if
CPPPATH
:
if
CPPPATH
:
CPPPATH
+=
group
[
'CPPPATH'
]
CPPPATH
+=
group
[
'CPPPATH'
]
else
:
else
:
CPPPATH
+=
group
[
'CPPPATH'
]
CPPPATH
+=
group
[
'CPPPATH'
]
# get each group's definitions
# get each group's definitions
if
group
.
has_key
(
'CPPDEFINES'
)
and
group
[
'CPPDEFINES'
]:
if
'CPPDEFINES'
in
group
and
group
[
'CPPDEFINES'
]:
if
CPPDEFINES
:
if
CPPDEFINES
:
CPPDEFINES
+=
group
[
'CPPDEFINES'
]
CPPDEFINES
+=
group
[
'CPPDEFINES'
]
else
:
else
:
CPPDEFINES
=
group
[
'CPPDEFINES'
]
CPPDEFINES
=
group
[
'CPPDEFINES'
]
# get each group's link flags
# get each group's link flags
if
group
.
has_key
(
'LINKFLAGS'
)
and
group
[
'LINKFLAGS'
]:
if
'LINKFLAGS'
in
group
and
group
[
'LINKFLAGS'
]:
if
LINKFLAGS
:
if
LINKFLAGS
:
LINKFLAGS
+=
' '
+
group
[
'LINKFLAGS'
]
LINKFLAGS
+=
' '
+
group
[
'LINKFLAGS'
]
else
:
else
:
...
...
tools/menuconfig.py
浏览文件 @
d687cfb2
...
@@ -30,12 +30,12 @@ import shutil
...
@@ -30,12 +30,12 @@ import shutil
def
mk_rtconfig
(
filename
):
def
mk_rtconfig
(
filename
):
try
:
try
:
config
=
file
(
filename
)
config
=
open
(
filename
,
'r'
)
except
:
except
:
print
(
'open config:%s failed'
%
filename
)
print
(
'open config:%s failed'
%
filename
)
return
return
rtconfig
=
file
(
'rtconfig.h'
,
'wb
'
)
rtconfig
=
open
(
'rtconfig.h'
,
'w
'
)
rtconfig
.
write
(
'#ifndef RT_CONFIG_H__
\n
'
)
rtconfig
.
write
(
'#ifndef RT_CONFIG_H__
\n
'
)
rtconfig
.
write
(
'#define RT_CONFIG_H__
\n\n
'
)
rtconfig
.
write
(
'#define RT_CONFIG_H__
\n\n
'
)
...
@@ -131,7 +131,7 @@ def touch_env():
...
@@ -131,7 +131,7 @@ def touch_env():
os
.
mkdir
(
os
.
path
.
join
(
env_dir
,
'local_pkgs'
))
os
.
mkdir
(
os
.
path
.
join
(
env_dir
,
'local_pkgs'
))
os
.
mkdir
(
os
.
path
.
join
(
env_dir
,
'packages'
))
os
.
mkdir
(
os
.
path
.
join
(
env_dir
,
'packages'
))
os
.
mkdir
(
os
.
path
.
join
(
env_dir
,
'tools'
))
os
.
mkdir
(
os
.
path
.
join
(
env_dir
,
'tools'
))
kconfig
=
file
(
os
.
path
.
join
(
env_dir
,
'packages'
,
'Kconfig'
),
'wb
'
)
kconfig
=
open
(
os
.
path
.
join
(
env_dir
,
'packages'
,
'Kconfig'
),
'w
'
)
kconfig
.
close
()
kconfig
.
close
()
if
not
os
.
path
.
exists
(
os
.
path
.
join
(
env_dir
,
'packages'
,
'packages'
)):
if
not
os
.
path
.
exists
(
os
.
path
.
join
(
env_dir
,
'packages'
,
'packages'
)):
...
@@ -150,7 +150,7 @@ def touch_env():
...
@@ -150,7 +150,7 @@ def touch_env():
"********************************************************************************
\n
"
)
"********************************************************************************
\n
"
)
help_info
()
help_info
()
else
:
else
:
kconfig
=
file
(
os
.
path
.
join
(
env_dir
,
'packages'
,
'Kconfig'
),
'wb
'
)
kconfig
=
open
(
os
.
path
.
join
(
env_dir
,
'packages'
,
'Kconfig'
),
'w
'
)
kconfig
.
write
(
'source "$PKGS_DIR/packages/Kconfig"'
)
kconfig
.
write
(
'source "$PKGS_DIR/packages/Kconfig"'
)
kconfig
.
close
()
kconfig
.
close
()
except
:
except
:
...
@@ -189,7 +189,7 @@ def touch_env():
...
@@ -189,7 +189,7 @@ def touch_env():
help_info
()
help_info
()
if
sys
.
platform
!=
'win32'
:
if
sys
.
platform
!=
'win32'
:
env_sh
=
file
(
os
.
path
.
join
(
env_dir
,
'env.sh'
),
'w'
)
env_sh
=
open
(
os
.
path
.
join
(
env_dir
,
'env.sh'
),
'w'
)
env_sh
.
write
(
'export PATH=~/.env/tools/scripts:$PATH'
)
env_sh
.
write
(
'export PATH=~/.env/tools/scripts:$PATH'
)
else
:
else
:
if
os
.
path
.
exists
(
os
.
path
.
join
(
env_dir
,
'tools'
,
'scripts'
)):
if
os
.
path
.
exists
(
os
.
path
.
join
(
env_dir
,
'tools'
,
'scripts'
)):
...
...
tools/package.py
浏览文件 @
d687cfb2
...
@@ -28,7 +28,7 @@ from building import *
...
@@ -28,7 +28,7 @@ from building import *
def
ExtendPackageVar
(
package
,
var
):
def
ExtendPackageVar
(
package
,
var
):
v
=
[]
v
=
[]
if
not
package
.
has_key
(
var
)
:
if
var
not
in
package
:
return
v
return
v
for
item
in
package
[
var
]:
for
item
in
package
[
var
]:
...
@@ -38,7 +38,7 @@ def ExtendPackageVar(package, var):
...
@@ -38,7 +38,7 @@ def ExtendPackageVar(package, var):
def
BuildPackage
(
package
):
def
BuildPackage
(
package
):
import
json
import
json
f
=
file
(
package
)
f
=
open
(
package
)
package_json
=
f
.
read
()
package_json
=
f
.
read
()
# get package.json path
# get package.json path
...
@@ -47,20 +47,20 @@ def BuildPackage(package):
...
@@ -47,20 +47,20 @@ def BuildPackage(package):
package
=
json
.
loads
(
package_json
)
package
=
json
.
loads
(
package_json
)
# check package name
# check package name
if
not
package
.
has_key
(
'name'
)
:
if
'name'
not
in
package
:
return
[]
return
[]
# get depends
# get depends
depend
=
ExtendPackageVar
(
package
,
'depends'
)
depend
=
ExtendPackageVar
(
package
,
'depends'
)
src
=
[]
src
=
[]
if
package
.
has_key
(
'source_files'
)
:
if
'source_files'
in
package
:
for
src_file
in
package
[
'source_files'
]:
for
src_file
in
package
[
'source_files'
]:
src_file
=
os
.
path
.
join
(
cwd
,
src_file
)
src_file
=
os
.
path
.
join
(
cwd
,
src_file
)
src
+=
Glob
(
src_file
)
src
+=
Glob
(
src_file
)
CPPPATH
=
[]
CPPPATH
=
[]
if
package
.
has_key
(
'CPPPATH'
)
:
if
'CPPPATH'
in
package
:
for
path
in
package
[
'CPPPATH'
]:
for
path
in
package
[
'CPPPATH'
]:
if
path
.
startswith
(
'/'
)
and
os
.
path
.
isdir
(
path
):
if
path
.
startswith
(
'/'
)
and
os
.
path
.
isdir
(
path
):
CPPPATH
=
CPPPATH
+
[
path
]
CPPPATH
=
CPPPATH
+
[
path
]
...
...
tools/sconsui.py
浏览文件 @
d687cfb2
...
@@ -198,7 +198,7 @@ class SconsUI():
...
@@ -198,7 +198,7 @@ class SconsUI():
setting_path
=
os
.
path
.
join
(
home
,
'.rtt_scons'
)
setting_path
=
os
.
path
.
join
(
home
,
'.rtt_scons'
)
if
os
.
path
.
exists
(
setting_path
):
if
os
.
path
.
exists
(
setting_path
):
setting
=
file
(
os
.
path
.
join
(
home
,
'.rtt_scons'
))
setting
=
open
(
os
.
path
.
join
(
home
,
'.rtt_scons'
))
for
line
in
setting
:
for
line
in
setting
:
line
=
line
.
replace
(
'
\n
'
,
''
)
line
=
line
.
replace
(
'
\n
'
,
''
)
line
=
line
.
replace
(
'
\r
'
,
''
)
line
=
line
.
replace
(
'
\r
'
,
''
)
...
@@ -215,7 +215,7 @@ class SconsUI():
...
@@ -215,7 +215,7 @@ class SconsUI():
setting
.
close
()
setting
.
close
()
# set RT-Thread Root Directory according environ
# set RT-Thread Root Directory according environ
if
os
.
environ
.
has_key
(
'RTT_ROOT'
)
:
if
'RTT_ROOT'
in
os
.
environ
:
self
.
RTTRoot
.
set_path
(
os
.
environ
[
'RTT_ROOT'
])
self
.
RTTRoot
.
set_path
(
os
.
environ
[
'RTT_ROOT'
])
if
self
.
RTTRoot
.
get_path
()
==
''
:
if
self
.
RTTRoot
.
get_path
()
==
''
:
...
@@ -268,7 +268,7 @@ class SconsUI():
...
@@ -268,7 +268,7 @@ class SconsUI():
else
:
else
:
home
=
os
.
environ
[
'HOME'
]
home
=
os
.
environ
[
'HOME'
]
setting
=
file
(
os
.
path
.
join
(
home
,
'.rtt_scons'
),
'wb
+'
)
setting
=
open
(
os
.
path
.
join
(
home
,
'.rtt_scons'
),
'w
+'
)
# current comiler
# current comiler
# line = '%s=%s\n' % ('compiler', self.compilers.get()))
# line = '%s=%s\n' % ('compiler', self.compilers.get()))
line
=
'%s=%s
\n
'
%
(
'compiler'
,
'iar'
)
line
=
'%s=%s
\n
'
%
(
'compiler'
,
'iar'
)
...
...
tools/ua.py
浏览文件 @
d687cfb2
...
@@ -52,11 +52,11 @@ def PrepareUA(project, RTT_ROOT, BSP_ROOT):
...
@@ -52,11 +52,11 @@ def PrepareUA(project, RTT_ROOT, BSP_ROOT):
for
group
in
project
:
for
group
in
project
:
# get each include path
# get each include path
if
group
.
has_key
(
'CPPPATH'
)
and
group
[
'CPPPATH'
]:
if
'CPPPATH'
in
group
and
group
[
'CPPPATH'
]:
CPPPATH
+=
group
[
'CPPPATH'
]
CPPPATH
+=
group
[
'CPPPATH'
]
# get each group's definitions
# get each group's definitions
if
group
.
has_key
(
'CPPDEFINES'
)
and
group
[
'CPPDEFINES'
]:
if
'CPPDEFINES'
in
group
and
group
[
'CPPDEFINES'
]:
CPPDEFINES
+=
group
[
'CPPDEFINES'
]
CPPDEFINES
+=
group
[
'CPPDEFINES'
]
if
len
(
CPPPATH
):
if
len
(
CPPPATH
):
...
...
tools/utils.py
浏览文件 @
d687cfb2
...
@@ -183,14 +183,14 @@ def ProjectInfo(env):
...
@@ -183,14 +183,14 @@ def ProjectInfo(env):
for
group
in
project
:
for
group
in
project
:
# get each files
# get each files
if
group
.
has_key
(
'src'
)
and
group
[
'src'
]:
if
'src'
in
group
and
group
[
'src'
]:
FILES
+=
group
[
'src'
]
FILES
+=
group
[
'src'
]
# get each include path
# get each include path
if
group
.
has_key
(
'CPPPATH'
)
and
group
[
'CPPPATH'
]:
if
'CPPPATH'
in
group
and
group
[
'CPPPATH'
]:
CPPPATH
+=
group
[
'CPPPATH'
]
CPPPATH
+=
group
[
'CPPPATH'
]
if
env
.
has_key
(
'CPPDEFINES'
)
:
if
'CPPDEFINES'
in
env
:
CPPDEFINES
=
env
[
'CPPDEFINES'
]
CPPDEFINES
=
env
[
'CPPDEFINES'
]
CPPDEFINES
=
ListMap
(
CPPDEFINES
)
CPPDEFINES
=
ListMap
(
CPPDEFINES
)
...
@@ -243,3 +243,47 @@ def ProjectInfo(env):
...
@@ -243,3 +243,47 @@ def ProjectInfo(env):
proj
[
'CPPDEFINES'
]
=
CPPDEFINES
proj
[
'CPPDEFINES'
]
=
CPPDEFINES
return
proj
return
proj
def
VersionCmp
(
ver1
,
ver2
):
la
=
ver1
.
split
(
'.'
)
lb
=
ver2
.
split
(
'.'
)
f
=
0
if
len
(
la
)
>
len
(
lb
):
f
=
len
(
la
)
else
:
f
=
len
(
lb
)
for
i
in
range
(
f
):
try
:
if
int
(
la
[
i
])
>
int
(
lb
[
i
]):
return
1
elif
int
(
la
[
i
])
==
int
(
lb
[
i
]):
continue
else
:
return
-
1
except
IndexError
as
e
:
if
len
(
la
)
>
len
(
lb
):
return
1
else
:
return
-
1
return
0
def
GCCC99Patch
(
cflags
):
import
building
gcc_version
=
building
.
GetDepend
(
'GCC_VERSION'
)
if
gcc_version
:
gcc_version
=
gcc_version
.
replace
(
'"'
,
''
)
if
VersionCmp
(
gcc_version
,
"4.8.0"
):
# remove -std=c99 after GCC 4.8.x
cflags
=
cflags
.
replace
(
'-std=c99'
,
''
)
return
cflags
def
ReloadModule
(
module
):
import
sys
if
sys
.
version_info
.
major
>=
3
:
import
importlib
importlib
.
reload
(
module
)
else
:
reload
(
module
)
return
tools/vs.py
浏览文件 @
d687cfb2
...
@@ -78,7 +78,7 @@ def VSProject(target, script, program):
...
@@ -78,7 +78,7 @@ def VSProject(target, script, program):
tree
=
etree
.
parse
(
'template_vs2005.vcproj'
)
tree
=
etree
.
parse
(
'template_vs2005.vcproj'
)
root
=
tree
.
getroot
()
root
=
tree
.
getroot
()
out
=
file
(
target
,
'wb
'
)
out
=
open
(
target
,
'w
'
)
out
.
write
(
'<?xml version="1.0" encoding="UTF-8"?>
\r\n
'
)
out
.
write
(
'<?xml version="1.0" encoding="UTF-8"?>
\r\n
'
)
ProjectFiles
=
[]
ProjectFiles
=
[]
...
@@ -91,7 +91,7 @@ def VSProject(target, script, program):
...
@@ -91,7 +91,7 @@ def VSProject(target, script, program):
for
group
in
script
:
for
group
in
script
:
libs
=
[]
libs
=
[]
if
group
.
has_key
(
'LIBS'
)
and
group
[
'LIBS'
]:
if
'LIBS'
in
group
and
group
[
'LIBS'
]:
for
item
in
group
[
'LIBS'
]:
for
item
in
group
[
'LIBS'
]:
lib_path
=
''
lib_path
=
''
for
path_item
in
group
[
'LIBPATH'
]:
for
path_item
in
group
[
'LIBPATH'
]:
...
@@ -111,7 +111,7 @@ def VSProject(target, script, program):
...
@@ -111,7 +111,7 @@ def VSProject(target, script, program):
VS_AddHeadFilesGroup
(
program
,
elem
,
project_path
)
VS_AddHeadFilesGroup
(
program
,
elem
,
project_path
)
# write head include path
# write head include path
if
building
.
Env
.
has_key
(
'CPPPATH'
)
:
if
'CPPPATH'
in
building
.
Env
:
cpp_path
=
building
.
Env
[
'CPPPATH'
]
cpp_path
=
building
.
Env
[
'CPPPATH'
]
paths
=
set
()
paths
=
set
()
for
path
in
cpp_path
:
for
path
in
cpp_path
:
...
@@ -130,7 +130,7 @@ def VSProject(target, script, program):
...
@@ -130,7 +130,7 @@ def VSProject(target, script, program):
elem
.
set
(
'AdditionalIncludeDirectories'
,
cpp_path
)
elem
.
set
(
'AdditionalIncludeDirectories'
,
cpp_path
)
# write cppdefinitons flags
# write cppdefinitons flags
if
building
.
Env
.
has_key
(
'CPPDEFINES'
)
:
if
'CPPDEFINES'
in
building
.
Env
:
CPPDEFINES
=
building
.
Env
[
'CPPDEFINES'
]
CPPDEFINES
=
building
.
Env
[
'CPPDEFINES'
]
definitions
=
[]
definitions
=
[]
if
type
(
CPPDEFINES
[
0
])
==
type
(()):
if
type
(
CPPDEFINES
[
0
])
==
type
(()):
...
@@ -143,7 +143,7 @@ def VSProject(target, script, program):
...
@@ -143,7 +143,7 @@ def VSProject(target, script, program):
# write link flags
# write link flags
# write lib dependence
# write lib dependence
if
building
.
Env
.
has_key
(
'LIBS'
)
:
if
'LIBS'
in
building
.
Env
:
for
elem
in
tree
.
iter
(
tag
=
'Tool'
):
for
elem
in
tree
.
iter
(
tag
=
'Tool'
):
if
elem
.
attrib
[
'Name'
]
==
'VCLinkerTool'
:
if
elem
.
attrib
[
'Name'
]
==
'VCLinkerTool'
:
break
break
...
@@ -152,7 +152,7 @@ def VSProject(target, script, program):
...
@@ -152,7 +152,7 @@ def VSProject(target, script, program):
elem
.
set
(
'AdditionalDependencies'
,
libs
)
elem
.
set
(
'AdditionalDependencies'
,
libs
)
# write lib include path
# write lib include path
if
building
.
Env
.
has_key
(
'LIBPATH'
)
:
if
'LIBPATH'
in
building
.
Env
:
lib_path
=
building
.
Env
[
'LIBPATH'
]
lib_path
=
building
.
Env
[
'LIBPATH'
]
paths
=
set
()
paths
=
set
()
for
path
in
lib_path
:
for
path
in
lib_path
:
...
...
tools/vs2012.py
浏览文件 @
d687cfb2
...
@@ -168,7 +168,7 @@ def VS2012Project(target, script, program):
...
@@ -168,7 +168,7 @@ def VS2012Project(target, script, program):
VS_add_HeadFiles
(
program
,
elem
,
project_path
)
VS_add_HeadFiles
(
program
,
elem
,
project_path
)
# write head include path
# write head include path
if
building
.
Env
.
has_key
(
'CPPPATH'
)
:
if
'CPPPATH'
in
building
.
Env
:
cpp_path
=
building
.
Env
[
'CPPPATH'
]
cpp_path
=
building
.
Env
[
'CPPPATH'
]
paths
=
set
()
paths
=
set
()
for
path
in
cpp_path
:
for
path
in
cpp_path
:
...
@@ -185,7 +185,7 @@ def VS2012Project(target, script, program):
...
@@ -185,7 +185,7 @@ def VS2012Project(target, script, program):
break
break
# write cppdefinitons flags
# write cppdefinitons flags
if
building
.
Env
.
has_key
(
'CPPDEFINES'
)
:
if
'CPPDEFINES'
in
building
.
Env
:
for
elem
in
tree
.
iter
(
tag
=
'PreprocessorDefinitions'
):
for
elem
in
tree
.
iter
(
tag
=
'PreprocessorDefinitions'
):
definitions
=
';'
.
join
(
building
.
Env
[
'CPPDEFINES'
])
+
';%(PreprocessorDefinitions)'
definitions
=
';'
.
join
(
building
.
Env
[
'CPPDEFINES'
])
+
';%(PreprocessorDefinitions)'
elem
.
text
=
definitions
elem
.
text
=
definitions
...
@@ -193,7 +193,7 @@ def VS2012Project(target, script, program):
...
@@ -193,7 +193,7 @@ def VS2012Project(target, script, program):
# write link flags
# write link flags
# write lib dependence (Link)
# write lib dependence (Link)
if
building
.
Env
.
has_key
(
'LIBS'
)
:
if
'LIBS'
in
building
.
Env
:
for
elem
in
tree
.
iter
(
tag
=
'AdditionalDependencies'
):
for
elem
in
tree
.
iter
(
tag
=
'AdditionalDependencies'
):
libs_with_extention
=
[
i
+
'.lib'
for
i
in
building
.
Env
[
'LIBS'
]]
libs_with_extention
=
[
i
+
'.lib'
for
i
in
building
.
Env
[
'LIBS'
]]
libs
=
';'
.
join
(
libs_with_extention
)
+
';%(AdditionalDependencies)'
libs
=
';'
.
join
(
libs_with_extention
)
+
';%(AdditionalDependencies)'
...
@@ -201,7 +201,7 @@ def VS2012Project(target, script, program):
...
@@ -201,7 +201,7 @@ def VS2012Project(target, script, program):
break
break
# write lib include path
# write lib include path
if
building
.
Env
.
has_key
(
'LIBPATH'
)
:
if
'LIBPATH'
in
building
.
Env
:
lib_path
=
building
.
Env
[
'LIBPATH'
]
lib_path
=
building
.
Env
[
'LIBPATH'
]
paths
=
set
()
paths
=
set
()
for
path
in
lib_path
:
for
path
in
lib_path
:
...
...
tools/wizard.py
浏览文件 @
d687cfb2
...
@@ -66,19 +66,19 @@ Return('objs')
...
@@ -66,19 +66,19 @@ Return('objs')
'''
'''
def
usage
():
def
usage
():
print
'wizard --component name'
print
(
'wizard --component name'
)
print
'wizard --bridge'
print
(
'wizard --bridge'
)
def
gen_component
(
name
):
def
gen_component
(
name
):
print
'generate SConscript for '
+
name
print
(
'generate SConscript for '
+
name
)
text
=
SConscript_com
.
replace
(
'COMPONENT_NAME'
,
name
)
text
=
SConscript_com
.
replace
(
'COMPONENT_NAME'
,
name
)
f
=
file
(
'SConscript'
,
'w'
)
f
=
open
(
'SConscript'
,
'w'
)
f
.
write
(
text
)
f
.
write
(
text
)
f
.
close
()
f
.
close
()
def
gen_bridge
():
def
gen_bridge
():
print
'generate SConscript for bridge'
print
(
'generate SConscript for bridge'
)
f
=
file
(
'SConscript'
,
'w'
)
f
=
open
(
'SConscript'
,
'w'
)
f
.
write
(
SConscript_bridge
)
f
.
write
(
SConscript_bridge
)
f
.
close
()
f
.
close
()
...
...
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录