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

Function VS2012Project

tools/targets/vs2012.py:178–283  ·  view source on GitHub ↗
(target, script, program)

Source from the content-addressed store, hash-verified

176 Filter.text='Header Files'
177
178def VS2012Project(target, script, program):
179 project_path = os.path.dirname(os.path.abspath(target))
180
181 tree = etree.parse('template_vs2012.vcxproj')
182 root = tree.getroot()
183 elem = root
184
185 out = open(target, 'w')
186 out.write('<?xml version="1.0" encoding="UTF-8"?>\r\n')
187
188 ProjectFiles = []
189
190 # add "*.c or *.h" files
191
192 VS2012_CreateFilter(script, project_path)
193 # add "*.c" files
194 for group in script:
195 VS_add_ItemGroup(elem, 'C', group['src'], project_path)
196
197 # add "*.h" files
198 VS_add_HeadFiles(program, elem, project_path)
199
200 # write head include path
201 if 'CPPPATH' in building.Env:
202 cpp_path = building.Env['CPPPATH']
203 paths = set()
204 for path in cpp_path:
205 inc = _make_path_relative(project_path, os.path.normpath(path))
206 paths.add(inc) #.replace('\\', '/')
207
208 paths = [i for i in paths]
209 paths.sort()
210 cpp_path = ';'.join(paths) + ';%(AdditionalIncludeDirectories)'
211
212 # write include path
213 for elem in tree.iter(tag='AdditionalIncludeDirectories'):
214 elem.text = cpp_path
215 break
216
217 # write cppdefinitons flags
218 if 'CPPDEFINES' in building.Env:
219 for elem in tree.iter(tag='PreprocessorDefinitions'):
220 CPPDEFINES = building.Env['CPPDEFINES']
221 definitions = []
222 if type(CPPDEFINES[0]) == type(()):
223 for item in CPPDEFINES:
224 definitions += [i for i in item]
225 definitions = ';'.join(definitions)
226 else:
227 definitions = ';'.join(building.Env['CPPDEFINES'])
228
229 definitions = definitions + ';%(PreprocessorDefinitions)'
230 elem.text = definitions
231 break
232 # write link flags
233
234 # write lib dependence (Link)
235 if 'LIBS' in building.Env:

Callers 1

GenTargetProjectFunction · 0.90

Calls 10

_make_path_relativeFunction · 0.90
xml_indentFunction · 0.90
VS2012_CreateFilterFunction · 0.85
VS_add_ItemGroupFunction · 0.85
VS_add_HeadFilesFunction · 0.85
sortMethod · 0.80
openFunction · 0.50
setFunction · 0.50
writeMethod · 0.45
joinMethod · 0.45

Tested by

no test coverage detected