mirror of
https://github.com/RT-Thread/rt-thread.git
synced 2026-09-27 15:24:11 +08:00
[Tools] Add group libs support in vs project.
This commit is contained in:
+24
-2
@@ -33,7 +33,7 @@ from utils import _make_path_relative
|
|||||||
from utils import xml_indent
|
from utils import xml_indent
|
||||||
fs_encoding = sys.getfilesystemencoding()
|
fs_encoding = sys.getfilesystemencoding()
|
||||||
|
|
||||||
def VS_AddGroup(ProjectFiles, parent, name, files, project_path):
|
def VS_AddGroup(ProjectFiles, parent, name, files, libs, project_path):
|
||||||
Filter = SubElement(parent, 'Filter')
|
Filter = SubElement(parent, 'Filter')
|
||||||
Filter.set('Name', name) #set group name to group
|
Filter.set('Name', name) #set group name to group
|
||||||
|
|
||||||
@@ -48,6 +48,16 @@ def VS_AddGroup(ProjectFiles, parent, name, files, project_path):
|
|||||||
File = SubElement(Filter, 'File')
|
File = SubElement(Filter, 'File')
|
||||||
File.set('RelativePath', path.decode(fs_encoding))
|
File.set('RelativePath', path.decode(fs_encoding))
|
||||||
|
|
||||||
|
for lib in libs:
|
||||||
|
name = os.path.basename(lib)
|
||||||
|
path = os.path.dirname(lib)
|
||||||
|
|
||||||
|
path = _make_path_relative(project_path, path)
|
||||||
|
path = os.path.join(path, name)
|
||||||
|
|
||||||
|
File = SubElement(Filter, 'File')
|
||||||
|
File.set('RelativePath', path.decode(fs_encoding))
|
||||||
|
|
||||||
def VS_AddHeadFilesGroup(program, elem, project_path):
|
def VS_AddHeadFilesGroup(program, elem, project_path):
|
||||||
building.source_ext = []
|
building.source_ext = []
|
||||||
building.source_ext = ["h"]
|
building.source_ext = ["h"]
|
||||||
@@ -79,7 +89,19 @@ def VSProject(target, script, program):
|
|||||||
break
|
break
|
||||||
|
|
||||||
for group in script:
|
for group in script:
|
||||||
group_xml = VS_AddGroup(ProjectFiles, elem, group['name'], group['src'], project_path)
|
libs = []
|
||||||
|
if group.has_key('LIBS') and group['LIBS']:
|
||||||
|
for item in group['LIBS']:
|
||||||
|
lib_path = ''
|
||||||
|
for path_item in group['LIBPATH']:
|
||||||
|
full_path = os.path.join(path_item, item + '.lib')
|
||||||
|
if os.path.isfile(full_path): # has this library
|
||||||
|
lib_path = full_path
|
||||||
|
|
||||||
|
if lib_path != '':
|
||||||
|
libs.append(lib_path)
|
||||||
|
|
||||||
|
group_xml = VS_AddGroup(ProjectFiles, elem, group['name'], group['src'], libs, project_path)
|
||||||
|
|
||||||
# add "*.h" files group
|
# add "*.h" files group
|
||||||
for elem in tree.iter(tag='Filter'):
|
for elem in tree.iter(tag='Filter'):
|
||||||
|
|||||||
Reference in New Issue
Block a user