1<Project xmlns="http://schemas.microsoft.com/developer/msbuild/2003" DefaultTargets="install" ToolsVersion="3.5">
2
3    <!--
4        Ex: 
5            C:\Windows\Microsoft.NET\Framework\v4.0.30319\MSBuild.exe Project.proj -> both platforms
6            C:\Windows\Microsoft.NET\Framework\v4.0.30319\MSBuild.exe Project.proj /p:Platform="x86" -> x86 only
7
8            MSBuild.exe zlib.proj /p:SRCROOT="c:\sources\zlib" /p:DSTROOT="c:\roots\zlib"
9    -->
10   
11   
12	<!--
13		Unless 'vcvars=none' is included in the buildArguments, the build system will call vcvars before invoking MSBuild.
14		If vcvars has been called, VCINSTALLDIR will be defined to the appropriate VC path. Otherwise, the path will be
15		retrieved from the registry.
16		
17		For manual builds, either call vcvars before invoking MSBuild or change the version in the registry key below to match the system.
18	-->
19	<PropertyGroup>
20        <VCPath Condition="'$(VCINSTALLDIR)' == ''">$(registry:HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\VisualStudio\11.0\Setup\VC@ProductDir)</VCPath>
21		<VCPath Condition="'$(VCINSTALLDIR)' != ''">$(VCINSTALLDIR)</VCPath>
22    </PropertyGroup>
23	
24	<ItemGroup>
25        <!-- command line platforms (/p:Platform="xxx;yyy") -->
26        <PlatformList Condition="'@(PlatformList)' == '' and $(Platform) != ''" Include="$(Platform.Split(';'))" />
27        <!-- default platforms: x86 and x64 cross -->
28        <PlatformList Condition="'@(PlatformList)' == ''" Include="x86;x86_amd64" />
29    </ItemGroup>
30 
31    <Target Name="install">
32
33        <!-- SRCROOT, DSTROOT, and OBJROOT must be defined -->
34        <Error Text="SRCROOT property or environment variable must be defined." Condition="'$(SRCROOT)' == ''"/>
35        <Error Text="DSTROOT property or environment variable must be defined." Condition="'$(DSTROOT)' == ''"/>
36
37		<ItemGroup>
38			<NMakeArgs Include="SRCROOT=&quot;$(SRCROOT)&quot;"/>
39			<NMakeArgs Include="DSTROOT=&quot;$(DSTROOT)&quot;"/>
40		</ItemGroup>
41
42        <!-- ensure the registry queries succeeded -->
43		<Error Text="Cannot determine Visual Studio 'vcvars' location." Condition="'$(VCPath)' == ''"/>
44        
45        <!-- The following will be executed once for each item in $(PlatformList) -->
46        <Exec Command="call &quot;$(VCPath)vcvarsall.bat&quot; %(PlatformList.Identity) &amp;
47                       nmake.exe /f $(MSBuildProjectDirectory)\NMakefile PLATFORM=%(PlatformList.Identity) @(NMakeArgs, ' ') install" />
48    </Target>
49
50	<Target Name="install_DEBUG">
51
52        <!-- SRCROOT, DSTROOT, and OBJROOT must be defined -->
53        <Error Text="SRCROOT property or environment variable must be defined." Condition="'$(SRCROOT)' == ''"/>
54        <Error Text="DSTROOT property or environment variable must be defined." Condition="'$(DSTROOT)' == ''"/>
55
56		<ItemGroup>
57			<NMakeArgs Include="SRCROOT=&quot;$(SRCROOT)&quot;"/>
58			<NMakeArgs Include="DSTROOT=&quot;$(DSTROOT)&quot;"/>
59		</ItemGroup>
60		
61        <!-- ensure the registry queries succeeded -->
62		<Error Text="Cannot determine Visual Studio 'vcvars' location." Condition="'$(VCPath)' == ''"/>
63		
64        <!-- The following will be executed once for each item in $(PlatformList) -->
65        <Exec Command="call &quot;$(VCPath)vcvarsall.bat&quot; %(PlatformList.Identity) &amp;
66                       nmake.exe /f $(MSBuildProjectDirectory)\NMakefile PLATFORM=%(PlatformList.Identity) @(NMakeArgs, ' ') install_DEBUG" />
67    </Target>
68	
69</Project>
70