|
@@ -33,7 +33,7 @@ from utils import _make_path_relative
|
|
|
from utils import xml_indent
|
|
|
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.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.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):
|
|
|
building.source_ext = []
|
|
|
building.source_ext = ["h"]
|
|
@@ -79,7 +89,19 @@ def VSProject(target, script, program):
|
|
|
break
|
|
|
|
|
|
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
|
|
|
for elem in tree.iter(tag='Filter'):
|