MCPcopy Create free account
hub / github.com/RT-Thread/rt-thread / VSProject

Function VSProject

tools/targets/vs.py:90–189  ·  view source on GitHub ↗
(target, script, program)

Source from the content-addressed store, hash-verified

88 File.set('RelativePath', path)
89
90def VSProject(target, script, program):
91 project_path = os.path.dirname(os.path.abspath(target))
92
93 tree = etree.parse('template_vs2005.vcproj')
94 root = tree.getroot()
95
96 out = open(target, 'w')
97 out.write('<?xml version="1.0" encoding="UTF-8"?>\r\n')
98
99 ProjectFiles = []
100
101 # add "*.c" files group
102 for elem in tree.iter(tag='Filter'):
103 if elem.attrib['Name'] == 'Source Files':
104 #print elem.tag, elem.attrib
105 break
106
107 for group in script:
108 libs = []
109 if 'LIBS' in group and group['LIBS']:
110 for item in group['LIBS']:
111 lib_path = ''
112 for path_item in group['LIBPATH']:
113 full_path = os.path.join(path_item, item + '.lib')
114 if os.path.isfile(full_path): # has this library
115 lib_path = full_path
116
117 if lib_path != '':
118 libs.append(lib_path)
119
120 group_xml = VS_AddGroup(ProjectFiles, elem, group['name'], group['src'], libs, project_path)
121
122 # add "*.h" files group
123 for elem in tree.iter(tag='Filter'):
124 if elem.attrib['Name'] == 'Header Files':
125 break
126 VS_AddHeadFilesGroup(program, elem, project_path)
127
128 # write head include path
129 if 'CPPPATH' in building.Env:
130 cpp_path = building.Env['CPPPATH']
131 paths = set()
132 for path in cpp_path:
133 inc = _make_path_relative(project_path, os.path.normpath(path))
134 paths.add(inc) #.replace('\\', '/')
135
136 paths = [i for i in paths]
137 paths.sort()
138 cpp_path = ';'.join(paths)
139
140 # write include path, definitions
141 for elem in tree.iter(tag='Tool'):
142 if elem.attrib['Name'] == 'VCCLCompilerTool':
143 #print elem.tag, elem.attrib
144 break
145 elem.set('AdditionalIncludeDirectories', cpp_path)
146
147 # write cppdefinitons flags

Callers 1

GenTargetProjectFunction · 0.90

Calls 9

_make_path_relativeFunction · 0.90
xml_indentFunction · 0.90
VS_AddGroupFunction · 0.85
VS_AddHeadFilesGroupFunction · 0.85
sortMethod · 0.80
openFunction · 0.50
setFunction · 0.50
writeMethod · 0.45
joinMethod · 0.45

Tested by

no test coverage detected