Let's generating love.

pull/15/head
Jussi Pakkanen 11 years ago
parent c980334946
commit 1a462a92ff
  1. 29
      vcprojtest.py

@ -20,17 +20,42 @@ import xml.etree.ElementTree as ET
def runtest(ofname): def runtest(ofname):
buildtype = 'Debug' buildtype = 'Debug'
platform = "Win32" platform = "Win32"
project_name = 'prog'
target_name = 'prog'
project_file_version = '10.0.30319.1'
guid = '{4A8C542D-A4C3-AC4A-A85A-E2A893CCB716}'
root = ET.Element('Project', {'DefaultTargets' : "Build", root = ET.Element('Project', {'DefaultTargets' : "Build",
'ToolsVersion' : '4.0', 'ToolsVersion' : '4.0',
'xmlns' : 'http://schemas.microsoft.com/developer/msbuild/2003'}) 'xmlns' : 'http://schemas.microsoft.com/developer/msbuild/2003'})
confitems = ET.Element('ItemGroup', {'Label' : 'ProjectConfigurations'}) confitems = ET.SubElement(root, 'ItemGroup', {'Label' : 'ProjectConfigurations'})
prjconf = ET.SubElement(confitems, 'ProjectConfiguration', {'Include' : 'Debug|Win32'}) prjconf = ET.SubElement(confitems, 'ProjectConfiguration', {'Include' : 'Debug|Win32'})
p = ET.SubElement(prjconf, 'Configuration') p = ET.SubElement(prjconf, 'Configuration')
p.text= buildtype p.text= buildtype
pl = ET.SubElement(prjconf, 'Platform') pl = ET.SubElement(prjconf, 'Platform')
pl.text = platform pl.text = platform
root.append(confitems) globalgroup = ET.SubElement(root, 'PropertyGroups', Label='Globals')
guidelem = ET.SubElement(globalgroup, 'ProjectGUID')
guidelem.text = guid
kw = ET.SubElement(globalgroup, 'Keyword')
kw.text = 'Win32Proj'
p = ET.SubElement(globalgroup, 'Platform')
p.text= platform
pname= ET.SubElement(globalgroup, 'ProjectName')
pname.text = project_name
tree = ET.ElementTree(root) tree = ET.ElementTree(root)
direlem = ET.SubElement(root, 'PropertyGroup')
fver = ET.SubElement(direlem, '_ProjectFileVersion')
fver.text = project_file_version
outdir = ET.SubElement(direlem, 'OutDir')
outdir.text = './'
intdir = ET.SubElement(direlem, 'IntDir')
intdir.text = 'obj'
tname = ET.SubElement(direlem, 'TargetName')
tname.text = target_name
inclinc = ET.SubElement(direlem, 'LinkIncremental')
inclinc.text = 'true'
ET.SubElement(root, 'Import', Project='$(VCTargetsPath)\Microsoft.Cpp.Default.props')
tree.write(ofname, encoding='utf-8', xml_declaration=True) tree.write(ofname, encoding='utf-8', xml_declaration=True)
if __name__ == '__main__': if __name__ == '__main__':

Loading…
Cancel
Save