support header files addition for vs script
git-svn-id: https://rt-thread.googlecode.com/svn/trunk@2461 bbd45198-f89e-11dd-88c7-29a3b14d5316
This commit is contained in:
parent
4ee9c0dc0f
commit
877d1b38b0
|
@ -308,7 +308,7 @@ def EndBuilding(target, program = None):
|
|||
IARProject('project.ewp', Projects)
|
||||
|
||||
if GetOption('target') == 'vs':
|
||||
VSProject('project.vcproj', Projects)
|
||||
VSProject('project.vcproj', Projects, program)
|
||||
|
||||
if GetOption('copy') and program != None:
|
||||
MakeCopy(program)
|
||||
|
|
23
tools/vs.py
23
tools/vs.py
|
@ -24,7 +24,20 @@ def VS_AddGroup(ProjectFiles, parent, name, files, project_path):
|
|||
File = SubElement(Filter, 'File')
|
||||
File.set('RelativePath', path.decode(fs_encoding))
|
||||
|
||||
def VSProject(target, script):
|
||||
def VS_AddHeadFilesGroup(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)
|
||||
File = SubElement(elem, 'File')
|
||||
File.set('RelativePath', path.decode(fs_encoding))
|
||||
|
||||
def VSProject(target, script, program):
|
||||
project_path = os.path.dirname(os.path.abspath(target))
|
||||
|
||||
tree = etree.parse('template.vcproj')
|
||||
|
@ -35,7 +48,7 @@ def VSProject(target, script):
|
|||
|
||||
ProjectFiles = []
|
||||
|
||||
# add group
|
||||
# add "*.c" files group
|
||||
for elem in tree.iter(tag='Filter'):
|
||||
if elem.attrib['Name'] == 'Source Files':
|
||||
#print elem.tag, elem.attrib
|
||||
|
@ -44,6 +57,12 @@ def VSProject(target, script):
|
|||
for group in script:
|
||||
group_xml = VS_AddGroup(ProjectFiles, elem, group['name'], group['src'], project_path)
|
||||
|
||||
# add "*.h" files group
|
||||
for elem in tree.iter(tag='Filter'):
|
||||
if elem.attrib['Name'] == 'Header Files':
|
||||
break
|
||||
VS_AddHeadFilesGroup(program, elem, project_path)
|
||||
|
||||
# write head include path
|
||||
if building.Env.has_key('CPPPATH'):
|
||||
cpp_path = building.Env['CPPPATH']
|
||||
|
|
Loading…
Reference in New Issue