aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJussi Pakkanen <jpakkane@gmail.com>2014-03-17 19:42:24 +0200
committerJussi Pakkanen <jpakkane@gmail.com>2014-03-17 19:42:24 +0200
commit11a12f778b521e1e1180bb9926f1900eee9ecd64 (patch)
tree124b19694b188ea583c0bc95591c1d26e68b3b7e
parent1a462a92ffccc56be67884cbdf0ab7af1f0d2bdb (diff)
downloadmeson-11a12f778b521e1e1180bb9926f1900eee9ecd64.zip
meson-11a12f778b521e1e1180bb9926f1900eee9ecd64.tar.gz
meson-11a12f778b521e1e1180bb9926f1900eee9ecd64.tar.bz2
Can generate a full vcxproj file.
-rw-r--r--vcprojtest.py48
1 files changed, 46 insertions, 2 deletions
diff --git a/vcprojtest.py b/vcprojtest.py
index b05fd85..67e294f 100644
--- a/vcprojtest.py
+++ b/vcprojtest.py
@@ -16,12 +16,14 @@
# limitations under the License.
import xml.etree.ElementTree as ET
+import xml.dom.minidom
def runtest(ofname):
buildtype = 'Debug'
platform = "Win32"
project_name = 'prog'
target_name = 'prog'
+ subsystem = 'console'
project_file_version = '10.0.30319.1'
guid = '{4A8C542D-A4C3-AC4A-A85A-E2A893CCB716}'
root = ET.Element('Project', {'DefaultTargets' : "Build",
@@ -42,7 +44,7 @@ def runtest(ofname):
p.text= platform
pname= ET.SubElement(globalgroup, 'ProjectName')
pname.text = project_name
- tree = ET.ElementTree(root)
+ ET.SubElement(root, 'Import', Project='$(VCTargetsPath)\Microsoft.Cpp.Default.props')
direlem = ET.SubElement(root, 'PropertyGroup')
fver = ET.SubElement(direlem, '_ProjectFileVersion')
fver.text = project_file_version
@@ -55,8 +57,50 @@ def runtest(ofname):
inclinc = ET.SubElement(direlem, 'LinkIncremental')
inclinc.text = 'true'
- ET.SubElement(root, 'Import', Project='$(VCTargetsPath)\Microsoft.Cpp.Default.props')
+ compiles = ET.SubElement(root, 'ItemDefinitionGroup')
+ clconf = ET.SubElement(compiles, 'ClCompile')
+ opt = ET.SubElement(clconf, 'Optimization')
+ opt.text = 'disabled'
+ preproc = ET.SubElement(clconf, 'PreprocessorDefinitions')
+ rebuild = ET.SubElement(clconf, 'MinimalRebuild')
+ rebuild.text = 'true'
+ rtlib = ET.SubElement(clconf, 'RuntimeLibrary')
+ rtlib.text = 'MultiThreadedDebugDLL'
+ funclink = ET.SubElement(clconf, 'FunctionLevelLinking')
+ funclink.text = 'true'
+ pch = ET.SubElement(clconf, 'PrecompiledHeader')
+ warnings = ET.SubElement(clconf, 'WarningLevel')
+ warnings.text = 'Level3'
+ debinfo = ET.SubElement(clconf, 'DebugInformationFormat')
+ debinfo.text = 'EditAndContinue'
+ resourcecompile = ET.SubElement(compiles, 'ResourceCompile')
+ respreproc = ET.SubElement(resourcecompile, 'PreprocessorDefinitions')
+ link = ET.SubElement(compiles, 'Link')
+ ofile = ET.SubElement(link, 'OutputFile')
+ ofile.text = '$(OutDir)prog.exe'
+ addlibdir = ET.SubElement(link, 'AdditionalLibraryDirectories')
+ addlibdir.text = '%(AdditionalLibraryDirectories)'
+ subsys = ET.SubElement(link, 'SubSystem')
+ subsys.text = subsystem
+ gendeb = ET.SubElement(link, 'GenerateDebugInformation')
+ gendeb.text = 'true'
+ pdb = ET.SubElement(link, 'ProgramDataBaseFileName')
+ pdb.text = '$(OutDir}prog.pdb'
+ entrypoint = ET.SubElement(link, 'EntryPointSymbol')
+ entrypoint.text = 'mainCRTStartup'
+ targetmachine = ET.SubElement(link, 'TargetMachine')
+ targetmachine.text = 'MachineX86'
+
+ inc_files = ET.SubElement(root, 'ItemGroup')
+ ET.SubElement(inc_files, 'CLInclude', Include='prog.h')
+ inc_src = ET.SubElement(root, 'ItemGroup')
+ ET.SubElement(inc_src, 'ClCompile', Include='prog.cpp')
+
+ tree = ET.ElementTree(root)
tree.write(ofname, encoding='utf-8', xml_declaration=True)
+ # ElementTree can not do prettyprinting so do it manually
+ doc = xml.dom.minidom.parse(ofname)
+ open(ofname, 'w').write(doc.toprettyxml())
if __name__ == '__main__':
runtest('sample.vcxproj')