mirror of
https://github.com/RT-Thread/rt-thread.git
synced 2025-02-28 01:17:07 +08:00
[tools][keil] 支持keil工程多个配置
由于项目中有不同需求的配置,此次提交可以通过templete模块文件来创建不同的配置,使用scons --target=mkd5来生成工程的不同配置,本提交已在基本stm32\gd32测试 Signed-off-by: tjrong2 <tjrong2@163.com>
This commit is contained in:
parent
0400fffafc
commit
6e5427e967
@ -216,6 +216,16 @@ def MDK45Project(tree, target, script):
|
|||||||
out = open(target, 'w')
|
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')
|
||||||
|
|
||||||
|
#Addtion the name of OutputDir
|
||||||
|
for targcomoOp in root.findall('.//TargetCommonOption'):
|
||||||
|
OutputDir = targcomoOp.find('OutputDirectory')
|
||||||
|
OutputName = targcomoOp.find('OutputName')
|
||||||
|
#print(OutputDir.text)
|
||||||
|
#print(OutputName.text)
|
||||||
|
OutputDir.text += OutputName.text + '\\'
|
||||||
|
#print(OutputDir.text)
|
||||||
|
|
||||||
|
for child in root.findall('.//Target'):
|
||||||
CPPPATH = []
|
CPPPATH = []
|
||||||
CPPDEFINES = []
|
CPPDEFINES = []
|
||||||
LINKFLAGS = ''
|
LINKFLAGS = ''
|
||||||
@ -223,15 +233,18 @@ def MDK45Project(tree, target, script):
|
|||||||
CCFLAGS = ''
|
CCFLAGS = ''
|
||||||
CFLAGS = ''
|
CFLAGS = ''
|
||||||
ProjectFiles = []
|
ProjectFiles = []
|
||||||
|
groups = child.find('Groups')
|
||||||
|
if groups is None:
|
||||||
|
groups = SubElement(child,'Groups')
|
||||||
|
groups.clear() # clean old groups
|
||||||
|
|
||||||
# add group
|
# add group
|
||||||
groups = tree.find('Targets/Target/Groups')
|
#groups = tree.find('Targets/Target/Groups')
|
||||||
if groups is None:
|
#if groups is None:
|
||||||
groups = SubElement(tree.find('Targets/Target'), 'Groups')
|
#groups = SubElement(tree.find('Targets/Target'), 'Groups')
|
||||||
groups.clear() # clean old groups
|
#groups.clear() # clean old groups
|
||||||
for group in script:
|
for group in script:
|
||||||
group_tree = MDK4AddGroup(ProjectFiles, groups, group['name'], group['src'], project_path, group)
|
group_tree = MDK4AddGroup(ProjectFiles, groups, group['name'], group['src'], project_path, group)
|
||||||
|
|
||||||
# get each include path
|
# get each include path
|
||||||
if 'CPPPATH' in group and group['CPPPATH']:
|
if 'CPPPATH' in group and group['CPPPATH']:
|
||||||
if CPPPATH:
|
if CPPPATH:
|
||||||
@ -289,23 +302,28 @@ def MDK45Project(tree, target, script):
|
|||||||
MDK4AddLibToGroup(ProjectFiles, group_tree, group['name'], lib_path, project_path)
|
MDK4AddLibToGroup(ProjectFiles, group_tree, group['name'], lib_path, project_path)
|
||||||
else:
|
else:
|
||||||
group_tree = MDK4AddGroupForFN(ProjectFiles, groups, group['name'], lib_path, project_path)
|
group_tree = MDK4AddGroupForFN(ProjectFiles, groups, group['name'], lib_path, project_path)
|
||||||
|
|
||||||
# write include path, definitions and link flags
|
# write include path, definitions and link flags
|
||||||
IncludePath = tree.find('Targets/Target/TargetOption/TargetArmAds/Cads/VariousControls/IncludePath')
|
IncludePath = child.find('TargetOption/TargetArmAds/Cads/VariousControls/IncludePath')
|
||||||
|
if(IncludePath.text != None):
|
||||||
|
IncludePath.text = IncludePath.text +';' + ';'.join([_make_path_relative(project_path, os.path.normpath(i)) for i in set(CPPPATH)])
|
||||||
|
else:
|
||||||
IncludePath.text = ';'.join([_make_path_relative(project_path, os.path.normpath(i)) for i in set(CPPPATH)])
|
IncludePath.text = ';'.join([_make_path_relative(project_path, os.path.normpath(i)) for i in set(CPPPATH)])
|
||||||
|
|
||||||
Define = tree.find('Targets/Target/TargetOption/TargetArmAds/Cads/VariousControls/Define')
|
Define = child.find('TargetOption/TargetArmAds/Cads/VariousControls/Define')
|
||||||
Define.text = ', '.join(set(CPPDEFINES))
|
if(Define.text != None):
|
||||||
|
Define.text = Define.text +',' + ', '.join(set(CPPDEFINES))
|
||||||
|
else:
|
||||||
|
Define.text = ','.join(set(CPPDEFINES))
|
||||||
|
|
||||||
if 'c99' in CXXFLAGS or 'c99' in CCFLAGS or 'c99' in CFLAGS:
|
if 'c99' in CXXFLAGS or 'c99' in CCFLAGS or 'c99' in CFLAGS:
|
||||||
uC99 = tree.find('Targets/Target/TargetOption/TargetArmAds/Cads/uC99')
|
uC99 = child.find('TargetOption/TargetArmAds/Cads/uC99')
|
||||||
uC99.text = '1'
|
uC99.text = '1'
|
||||||
|
|
||||||
if 'gnu' in CXXFLAGS or 'gnu' in CCFLAGS or 'gnu' in CFLAGS:
|
if 'gnu' in CXXFLAGS or 'gnu' in CCFLAGS or 'gnu' in CFLAGS:
|
||||||
uGnu = tree.find('Targets/Target/TargetOption/TargetArmAds/Cads/uGnu')
|
uGnu = child.find('TargetOption/TargetArmAds/Cads/uGnu')
|
||||||
uGnu.text = '1'
|
uGnu.text = '1'
|
||||||
|
|
||||||
Misc = tree.find('Targets/Target/TargetOption/TargetArmAds/LDads/Misc')
|
Misc = child.find('TargetOption/TargetArmAds/LDads/Misc')
|
||||||
Misc.text = LINKFLAGS
|
Misc.text = LINKFLAGS
|
||||||
|
|
||||||
xml_indent(root)
|
xml_indent(root)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user