diff --git a/data/windows/genproj.py b/data/windows/genproj.py index 9048c476..6e1f71a7 100644 --- a/data/windows/genproj.py +++ b/data/windows/genproj.py @@ -1,34 +1,93 @@ from lxml import etree -import os, shutil +import os, string, shutil, uuid -doc = etree.parse('data/windows/mitsuba.vcproj.template') +doc2008 = etree.parse('data/windows/mitsuba-msvc2008.vcproj.template') +doc2010 = etree.parse('data/windows/mitsuba-msvc2010.vcxproj.template') +doc2010_filters = etree.parse('data/windows/mitsuba-msvc2010.vcxproj.filters.template') -headers = etree.ETXPath('/VisualStudioProject/Files/Filter[@Name="Header Files"]')(doc)[0] -sources = etree.ETXPath('/VisualStudioProject/Files/Filter[@Name="Source Files"]')(doc)[0] +headers2008 = etree.XPath('/VisualStudioProject/Files/Filter[@Name="Header Files"]')(doc2008)[0] +sources2008 = etree.XPath('/VisualStudioProject/Files/Filter[@Name="Source Files"]')(doc2008)[0] +ns = {'n' : 'http://schemas.microsoft.com/developer/msbuild/2003'} +headers2010 = etree.XPath('/n:Project/n:ItemGroup[@Label="Header Files"]', namespaces = ns)(doc2010)[0] +sources2010 = etree.XPath('/n:Project/n:ItemGroup[@Label="Source Files"]', namespaces = ns)(doc2010)[0] +headers2010_filters = etree.XPath('/n:Project/n:ItemGroup[@Label="Header Files"]', namespaces = ns)(doc2010_filters)[0] +sources2010_filters = etree.XPath('/n:Project/n:ItemGroup[@Label="Source Files"]', namespaces = ns)(doc2010_filters)[0] +filters2010 = etree.XPath('/n:Project/n:ItemGroup[@Label="Filters"]', namespaces = ns)(doc2010_filters)[0] -def traverse(dirname, base): +def traverse(dirname, prefix, base2008): for file in [file for file in os.listdir(dirname) if not file in ['.', '..']]: filename = os.path.join(dirname, file) if os.path.isdir(filename): - if filename == '.\\include\\mitsuba': - traverse(filename, base) - else: - node = etree.SubElement(base, 'Filter') - node.set('Name', os.path.split(filename)[1]) - node.tail = '\n\t\t' - node.text = '\n\t\t' - traverse(filename, node) + lastname = os.path.split(filename)[1] + # Visual Studio 2008 nodes + node2008 = etree.SubElement(base2008, 'Filter') + node2008.set('Name', lastname) + node2008.tail = '\n\t\t' + node2008.text = '\n\t\t' + + # Visual Studio 2010 nodes + subprefix = os.path.join(prefix, lastname) + node2010 = etree.SubElement(filters2010, 'Filter') + node2010.set('Include', subprefix) + ui = etree.SubElement(node2010, 'UniqueIdentifier') + ui.text = '{' + str(uuid.uuid4()) + '}' + ui.tail = '\n\t\t' + node2010.tail = '\n\t\t' + node2010.text = '\n\t\t\t' + + traverse(filename, subprefix, node2008) else: ext = os.path.splitext(filename)[1] - if ext == '.cpp' or ext == '.c' or ext == '.h': - node = etree.SubElement(base, 'File') + filename = '..\\' + filename + + # Visual Studio 2008 nodes + if ext == '.cpp' or ext == '.c' or ext == '.h' or ext == '.inl': + node = etree.SubElement(base2008, 'File') node.set('RelativePath', filename) node.tail = '\n\t\t' -traverse('.\\src', sources) -traverse('.\\include', headers) -of = open('mitsuba.vcproj', 'w') -of.write(etree.tostring(doc, pretty_print=True)) + # Visual Studio 2010 nodes + if ext == '.cpp' or ext == '.c': + node = etree.SubElement(sources2010, 'ClCompile') + node.set('Include', filename) + node.tail = '\n\t\t' + node.text = '\n\t\t\t' + node = etree.SubElement(sources2010_filters, 'ClCompile') + node.set('Include', filename) + node.tail = '\n\t\t' + node.text = '\n\t\t\t' + filter = etree.SubElement(node, 'Filter') + filter.text = prefix + filter.tail = '\n\t\t' + elif ext == '.h' or ext == '.inl': + node = etree.SubElement(headers2010, 'ClInclude') + node.set('Include', filename) + node.tail = '\n\t\t' + node.text = '\n\t\t\t' + node = etree.SubElement(headers2010_filters, 'ClInclude') + node.set('Include', filename) + node.tail = '\n\t\t' + node.text = '\n\t\t\t' + filter = etree.SubElement(node, 'Filter') + filter.text = prefix + filter.tail = '\n\t\t' + + +traverse('.\\src', 'Source Files', sources2008) +traverse('.\\include', 'Header Files', headers2008) + +of = open('build/mitsuba-msvc2008.vcproj', 'w') +of.write(etree.tostring(doc2008, pretty_print=True)) of.close() -shutil.copyfile('data/windows/mitsuba.sln.template', 'mitsuba.sln') + +of = open('build/mitsuba-msvc2010.vcxproj', 'w') +of.write(etree.tostring(doc2010, pretty_print=True)) +of.close() + +of = open('build/mitsuba-msvc2010.vcxproj.filters', 'w') +of.write(etree.tostring(doc2010_filters, pretty_print=True)) +of.close() + +shutil.copyfile('data/windows/mitsuba-msvc2008.sln.template', 'build/mitsuba-msvc2008.sln') +shutil.copyfile('data/windows/mitsuba-msvc2010.sln.template', 'build/mitsuba-msvc2010.sln') diff --git a/data/windows/mitsuba-msvc2008.sln.template b/data/windows/mitsuba-msvc2008.sln.template new file mode 100644 index 00000000..f1e995ff --- /dev/null +++ b/data/windows/mitsuba-msvc2008.sln.template @@ -0,0 +1,26 @@ + +Microsoft Visual Studio Solution File, Format Version 10.00 +# Visual Studio 2008 +Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "mitsuba", "mitsuba-msvc2008.vcproj", "{BA3C2621-9FB1-4348-9059-AFC8CCAB25E9}" +EndProject +Global + GlobalSection(SolutionConfigurationPlatforms) = preSolution + Debug|Win32 = Debug|Win32 + Debug|x64 = Debug|x64 + Release|Win32 = Release|Win32 + Release|x64 = Release|x64 + EndGlobalSection + GlobalSection(ProjectConfigurationPlatforms) = postSolution + {BA3C2621-9FB1-4348-9059-AFC8CCAB25E9}.Debug|Win32.ActiveCfg = Debug|Win32 + {BA3C2621-9FB1-4348-9059-AFC8CCAB25E9}.Debug|Win32.Build.0 = Debug|Win32 + {BA3C2621-9FB1-4348-9059-AFC8CCAB25E9}.Debug|x64.ActiveCfg = Debug|x64 + {BA3C2621-9FB1-4348-9059-AFC8CCAB25E9}.Debug|x64.Build.0 = Debug|x64 + {BA3C2621-9FB1-4348-9059-AFC8CCAB25E9}.Release|Win32.ActiveCfg = Release|Win32 + {BA3C2621-9FB1-4348-9059-AFC8CCAB25E9}.Release|Win32.Build.0 = Release|Win32 + {BA3C2621-9FB1-4348-9059-AFC8CCAB25E9}.Release|x64.ActiveCfg = Release|x64 + {BA3C2621-9FB1-4348-9059-AFC8CCAB25E9}.Release|x64.Build.0 = Release|x64 + EndGlobalSection + GlobalSection(SolutionProperties) = preSolution + HideSolutionNode = FALSE + EndGlobalSection +EndGlobal diff --git a/data/windows/mitsuba-msvc2008.vcproj.template b/data/windows/mitsuba-msvc2008.vcproj.template new file mode 100644 index 00000000..0592043a --- /dev/null +++ b/data/windows/mitsuba-msvc2008.vcproj.template @@ -0,0 +1,121 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/data/windows/mitsuba-msvc2010.sln.template b/data/windows/mitsuba-msvc2010.sln.template new file mode 100644 index 00000000..4cccda1f --- /dev/null +++ b/data/windows/mitsuba-msvc2010.sln.template @@ -0,0 +1,26 @@ + +Microsoft Visual Studio Solution File, Format Version 11.00 +# Visual Studio 2010 +Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "mitsuba", "mitsuba-msvc2010.vcxproj", "{BA3C2621-9FB1-4348-9059-AFC8CCAB25E9}" +EndProject +Global + GlobalSection(SolutionConfigurationPlatforms) = preSolution + Debug|Win32 = Debug|Win32 + Debug|x64 = Debug|x64 + Release|Win32 = Release|Win32 + Release|x64 = Release|x64 + EndGlobalSection + GlobalSection(ProjectConfigurationPlatforms) = postSolution + {BA3C2621-9FB1-4348-9059-AFC8CCAB25E9}.Debug|Win32.ActiveCfg = Debug|Win32 + {BA3C2621-9FB1-4348-9059-AFC8CCAB25E9}.Debug|Win32.Build.0 = Debug|Win32 + {BA3C2621-9FB1-4348-9059-AFC8CCAB25E9}.Debug|x64.ActiveCfg = Debug|x64 + {BA3C2621-9FB1-4348-9059-AFC8CCAB25E9}.Debug|x64.Build.0 = Debug|x64 + {BA3C2621-9FB1-4348-9059-AFC8CCAB25E9}.Release|Win32.ActiveCfg = Release|Win32 + {BA3C2621-9FB1-4348-9059-AFC8CCAB25E9}.Release|Win32.Build.0 = Release|Win32 + {BA3C2621-9FB1-4348-9059-AFC8CCAB25E9}.Release|x64.ActiveCfg = Release|x64 + {BA3C2621-9FB1-4348-9059-AFC8CCAB25E9}.Release|x64.Build.0 = Release|x64 + EndGlobalSection + GlobalSection(SolutionProperties) = preSolution + HideSolutionNode = FALSE + EndGlobalSection +EndGlobal diff --git a/data/windows/mitsuba-msvc2010.vcxproj.filters.template b/data/windows/mitsuba-msvc2010.vcxproj.filters.template new file mode 100644 index 00000000..e155cd2d --- /dev/null +++ b/data/windows/mitsuba-msvc2010.vcxproj.filters.template @@ -0,0 +1,17 @@ + + + + + {93995380-89BD-4b04-88EB-625FBE52EBFB} + h;hpp;hxx;hm;inl;inc;xsd + + + {4FC737F1-C7A5-4376-A066-2A32D752A2FF} + cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx + + + + + + + diff --git a/data/windows/mitsuba-msvc2010.vcxproj.template b/data/windows/mitsuba-msvc2010.vcxproj.template new file mode 100644 index 00000000..3e73355f --- /dev/null +++ b/data/windows/mitsuba-msvc2010.vcxproj.template @@ -0,0 +1,121 @@ + + + + + Debug + Win32 + + + Debug + x64 + + + Release + Win32 + + + Release + x64 + + + + {BA3C2621-9FB1-4348-9059-AFC8CCAB25E9} + mitsuba + MakeFileProj + + + + Makefile + + + Makefile + + + Makefile + + + Makefile + + + + + + + + + + + + + + + + + + + <_ProjectFileVersion>10.0.30319.1 + Debug\ + Debug\ + scons --parallelize --cfg=..\build\config-msvc2010-win32-debug.py + scons --parallelize --cfg=..\build\config-msvc2010-win32-debug.py -c && scons --parallelize --cfg=..\build\config-msvc2010-win32-debug.py + scons --parallelize --cfg=..\build\config-msvc2010-win32-debug.py -c + dist\mtsgui.exe + WIN32;_DEBUG;$(NMakePreprocessorDefinitions) + ..\include;$(NMakeIncludeSearchPath) + $(NMakeForcedIncludes) + $(NMakeAssemblySearchPath) + $(NMakeForcedUsingAssemblies) + Release\ + Release\ + scons --parallelize --cfg=..\build\config-msvc2010-win32.py + scons --parallelize --cfg=..\build\config-msvc2010-win32.py -c && scons --parallelize --cfg=..\build\config-msvc2010-win32.py + scons --parallelize --cfg=..\build\config-msvc2010-win32.py -c + dist\mtsgui.exe + WIN32;NDEBUG;SINGLE_PRECISION;$(NMakePreprocessorDefinitions) + ..\include;$(NMakeIncludeSearchPath) + $(NMakeForcedIncludes) + $(NMakeAssemblySearchPath) + $(NMakeForcedUsingAssemblies) + Debug\ + Debug\ + scons --parallelize --cfg=..\build\config-msvc2010-win64-debug.py + scons --parallelize --cfg=..\build\config-msvc2010-win64-debug.py -c && scons --parallelize --cfg=..\build\config-msvc2010-win64-debug.py + scons --parallelize --cfg=..\build\config-msvc2010-win64-debug.py -c + dist\mtsgui.exe + WIN32;_DEBUG;$(NMakePreprocessorDefinitions) + ..\include;$(NMakeIncludeSearchPath) + $(NMakeForcedIncludes) + $(NMakeAssemblySearchPath) + $(NMakeForcedUsingAssemblies) + Release\ + Release\ + scons --parallelize --cfg=..\build\config-msvc2010-win64.py + scons --parallelize --cfg=..\build\config-msvc2010-win64.py -c && scons --parallelize --cfg=..\build\config-msvc2010-win64.py + scons --parallelize --cfg=..\build\config-msvc2010-win64.py -c + dist\mtsgui.exe + WIN32;NDEBUG;SINGLE_PRECISION;$(NMakePreprocessorDefinitions) + ..\include;$(NMakeIncludeSearchPath) + $(NMakeForcedIncludes) + $(NMakeAssemblySearchPath) + $(NMakeForcedUsingAssemblies) + + + + + + {93995380-89BD-4b04-88EB-625FBE52EBFB} + h;hpp;hxx;hm;inl;inc;xsd + + + {4FC737F1-C7A5-4376-A066-2A32D752A2FF} + cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx + + + + + + + + + +