[VS Addin] Add default compiler include paths to visual studio

This allows intelisense to find the NaCl compiler
headers and prevents the red underline on standard
include files.

Still not perfect as it doesn't dectect use of
libc++ vs libstdc++ in PNaCl, but a huge improvement.

I ended up forking the default.props files (previously
these were derived from the x86_64 version at package
create time).

TEST= manual local testing.
BUG= https://code.google.com/p/chromium/issues/detail?id=179121
R=binji@chromium.org

Review URL: https://codereview.chromium.org/594733002

git-svn-id: https://nativeclient-sdk.googlecode.com/svn/trunk/src@1578 050acbb0-2703-11df-ab0a-9f3f633ae91d
diff --git a/visual_studio/NativeClientVSAddIn/InstallerResources/NaCl/NaCl.Paths.default.props b/visual_studio/NativeClientVSAddIn/InstallerResources/NaCl/NaCl.Paths.default.props
index 16533fe..528de00 100644
--- a/visual_studio/NativeClientVSAddIn/InstallerResources/NaCl/NaCl.Paths.default.props
+++ b/visual_studio/NativeClientVSAddIn/InstallerResources/NaCl/NaCl.Paths.default.props
@@ -21,7 +21,7 @@
     <FrameworkSdkDir Condition="'$(FrameworkSdkDir)' == ''">$(Registry:HKEY_LOCAL_MACHINE\SOFTWARE\Wow6432Node\Microsoft\Microsoft SDKs\Windows\v7.0A@InstallationFolder)</FrameworkSdkDir>
 
     <ExecutablePath Condition="'$(ExecutablePath)' == ''">$(PATH);</ExecutablePath>
-    <IncludePath Condition="'$(IncludePath)' == ''">$(VSNaClSDKRoot)include;</IncludePath>
+    <IncludePath Condition="'$(IncludePath)' == ''">$(NaClDefaultIncludePath);$(VSNaClSDKRoot)include;</IncludePath>
     <LibraryPath Condition="'$(LibraryPath)' == '' AND '$(TargetArchitecture)'=='i686'">$(VSNaClSDKRoot)lib\$(ToolchainName)_x86_32\$(Configuration);</LibraryPath>
     <LibraryPath Condition="'$(LibraryPath)' == '' AND '$(TargetArchitecture)'=='x86_64'">$(VSNaClSDKRoot)lib\$(ToolchainName)_x86_64\$(Configuration);</LibraryPath>
     <LibraryPath Condition="'$(LibraryPath)' == '' AND '$(TargetArchitecture)'=='arm'">$(VSNaClSDKRoot)lib\$(ToolchainName)_arm\$(Configuration);</LibraryPath>
diff --git a/visual_studio/NativeClientVSAddIn/InstallerResources/NaCl32/Microsoft.Cpp.NaCL32.default.props b/visual_studio/NativeClientVSAddIn/InstallerResources/NaCl32/Microsoft.Cpp.NaCL32.default.props
new file mode 100644
index 0000000..975c3d5
--- /dev/null
+++ b/visual_studio/NativeClientVSAddIn/InstallerResources/NaCl32/Microsoft.Cpp.NaCL32.default.props
@@ -0,0 +1,35 @@
+<Project xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
+
+  <PropertyGroup>
+    <PlatformShortName>NaCl32</PlatformShortName>
+    <PlatformArchitecture>32</PlatformArchitecture>
+    <TargetArchitecture>x86_32</TargetArchitecture>
+    <PlatformToolset Condition="'$(PlatformToolset)' == ''">v110</PlatformToolset>
+
+    <ProjectName Condition=" '$(ProjectName)' == '' ">$(MSBuildProjectName)</ProjectName>
+    <TargetName Condition="'$(TargetName)'==''">$(ProjectName)_$(PlatformArchitecture)</TargetName>
+    <ToolchainName Condition="'$(ToolchainName)' == ''">newlib</ToolchainName>
+    <IntDir Condition="'$(IntDir)'=='' AND '$(IntermediateOutputPath)'!=''">$(IntermediateOutputPath)</IntDir>
+
+    <!-- Set IntDir and OutDir to a dummy value here to stop the builtin Default.props file
+         from setting them.  This allows us to set them to their real default values in the
+         .props file. By which time the user settings for ToolchainName in the vcproj file
+         will have been set.  If we try to use $(ToolchainName) here it will always evaluate
+         to newlib. -->
+    <IntDir Condition="'$(IntDir)'=='' AND '$(IntermediateOutputPath)'==''">DUMMY</IntDir>
+    <OutDir Condition="'$(OutDir)'==''">DUMMY</OutDir>
+
+    <VSNaClSDKRoot Condition="'$(VSNaClSDKRoot)'==''">$(NACL_SDK_ROOT)\</VSNaClSDKRoot>
+
+    <NaClToolchainRoot>$(VSNaClSDKRoot)toolchain\win_x86_$(ToolchainName)\</NaClToolchainRoot>
+
+    <NaClDefaultIncludePath Condition="'$(NaClDefaultIncludePath)'==''">$(NaClToolchainRoot)$(TargetArchitecture)-nacl\usr\include;$(NaClToolchainRoot)x86_64-nacl\include;$(NaClToolchainRoot)x86_64-nacl\include\c++\4.4.3;$(NaClToolchainRoot)lib\gcc\x86_64-nacl/4.4.3/include/</NaClDefaultIncludePath>
+
+    <NaClWebServerPort Condition="'$(NaClWebServerPort)'==''">5103</NaClWebServerPort>
+    <NaClIndexHTML Condition="'$(NaClIndexHTML)'==''">index.html</NaClIndexHTML>
+    <NaClManifestPath Condition="'$(NaClManifestPath)'==''"></NaClManifestPath>
+  </PropertyGroup>
+
+  <Import Project="$(VCTargetsPath)\NaCl\NaCl.Toolset.default.props" />
+
+</Project>
diff --git a/visual_studio/NativeClientVSAddIn/InstallerResources/NaCl64/Microsoft.Cpp.NaCl64.default.props b/visual_studio/NativeClientVSAddIn/InstallerResources/NaCl64/Microsoft.Cpp.NaCl64.default.props
index af1c194..d75dddc 100644
--- a/visual_studio/NativeClientVSAddIn/InstallerResources/NaCl64/Microsoft.Cpp.NaCl64.default.props
+++ b/visual_studio/NativeClientVSAddIn/InstallerResources/NaCl64/Microsoft.Cpp.NaCl64.default.props
@@ -19,7 +19,13 @@
     <IntDir Condition="'$(IntDir)'=='' AND '$(IntermediateOutputPath)'==''">DUMMY</IntDir>
     <OutDir Condition="'$(OutDir)'==''">DUMMY</OutDir>
 
+
     <VSNaClSDKRoot Condition="'$(VSNaClSDKRoot)'==''">$(NACL_SDK_ROOT)\</VSNaClSDKRoot>
+
+    <NaClToolchainRoot>$(VSNaClSDKRoot)toolchain\win_x86_$(ToolchainName)\</NaClToolchainRoot>
+
+    <NaClDefaultIncludePath Condition="'$(NaClDefaultIncludePath)'==''">$(NaClToolchainRoot)$(TargetArchitecture)-nacl\usr\include;$(NaClToolchainRoot)x86_64-nacl\include;$(NaClToolchainRoot)x86_64-nacl\include\c++\4.4.3;$(NaClToolchainRoot)lib\gcc\x86_64-nacl\4.4.3\include</NaClDefaultIncludePath>
+
     <NaClWebServerPort Condition="'$(NaClWebServerPort)'==''">5103</NaClWebServerPort>
     <NaClIndexHTML Condition="'$(NaClIndexHTML)'==''">index.html</NaClIndexHTML>
     <NaClManifestPath Condition="'$(NaClManifestPath)'==''"></NaClManifestPath>
diff --git a/visual_studio/NativeClientVSAddIn/InstallerResources/NaClARM/Microsoft.Cpp.NaCLARM.default.props b/visual_studio/NativeClientVSAddIn/InstallerResources/NaClARM/Microsoft.Cpp.NaCLARM.default.props
new file mode 100644
index 0000000..65ba16b
--- /dev/null
+++ b/visual_studio/NativeClientVSAddIn/InstallerResources/NaClARM/Microsoft.Cpp.NaCLARM.default.props
@@ -0,0 +1,39 @@
+<Project xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
+
+  <PropertyGroup>
+    <PlatformShortName>NaClARM</PlatformShortName>
+    <PlatformArchitecture>arm</PlatformArchitecture>
+    <TargetArchitecture>arm</TargetArchitecture>
+    <PlatformToolset Condition="'$(PlatformToolset)' == ''">v110</PlatformToolset>
+
+    <ProjectName Condition=" '$(ProjectName)' == '' ">$(MSBuildProjectName)</ProjectName>
+    <TargetName Condition="'$(TargetName)'==''">$(ProjectName)_$(PlatformArchitecture)</TargetName>
+    <ToolchainName Condition="'$(ToolchainName)' == ''">newlib</ToolchainName>
+    <IntDir Condition="'$(IntDir)'=='' AND '$(IntermediateOutputPath)'!=''">$(IntermediateOutputPath)</IntDir>
+
+    <!-- Set IntDir and OutDir to a dummy value here to stop the builtin Default.props file
+         from setting them.  This allows us to set them to their real default values in the
+         .props file. By which time the user settings for ToolchainName in the vcproj file
+         will have been set.  If we try to use $(ToolchainName) here it will always evaluate
+         to newlib. -->
+    <IntDir Condition="'$(IntDir)'=='' AND '$(IntermediateOutputPath)'==''">DUMMY</IntDir>
+    <OutDir Condition="'$(OutDir)'==''">DUMMY</OutDir>
+
+    <VSNaClSDKRoot Condition="'$(VSNaClSDKRoot)'==''">$(NACL_SDK_ROOT)\</VSNaClSDKRoot>
+
+    <NaClToolchainRoot>$(VSNaClSDKRoot)toolchain\win_arm_$(ToolchainName)\</NaClToolchainRoot>
+
+    <NaClDefaultIncludePath Condition="'$(NaClDefaultIncludePath)'==''">$(NaClToolchainRoot)$(TargetArchitecture)-nacl\usr\include;$(NaClToolchainRoot)arm-nacl\include</NaClDefaultIncludePath>
+
+    <NaClDefaultIncludePath Condition="Exists('$(NaClToolchainRoot)lib\gcc\arm-nacl\4.8.2')">$(NaClDefaultIncludePath);$(NaClToolchainRoot)arm-nacl\include\c++\4.8.2;$(NaClToolchainRoot)lib\gcc\arm-nacl\4.8.2\include</NaClDefaultIncludePath>
+
+    <NaClDefaultIncludePath Condition="Exists('$(NaClToolchainRoot)lib\gcc\arm-nacl\4.8.3')">$(NaClDefaultIncludePath);$(NaClToolchainRoot)arm-nacl\include\c++\4.8.3;$(NaClToolchainRoot)lib\gcc\arm-nacl\4.8.3\include</NaClDefaultIncludePath>
+
+    <NaClWebServerPort Condition="'$(NaClWebServerPort)'==''">5103</NaClWebServerPort>
+    <NaClIndexHTML Condition="'$(NaClIndexHTML)'==''">index.html</NaClIndexHTML>
+    <NaClManifestPath Condition="'$(NaClManifestPath)'==''"></NaClManifestPath>
+  </PropertyGroup>
+
+  <Import Project="$(VCTargetsPath)\NaCl\NaCl.Toolset.default.props" />
+
+</Project>
diff --git a/visual_studio/NativeClientVSAddIn/InstallerResources/PNaCl/Microsoft.Cpp.PNaCl.default.props b/visual_studio/NativeClientVSAddIn/InstallerResources/PNaCl/Microsoft.Cpp.PNaCl.default.props
new file mode 100644
index 0000000..183dbb5
--- /dev/null
+++ b/visual_studio/NativeClientVSAddIn/InstallerResources/PNaCl/Microsoft.Cpp.PNaCl.default.props
@@ -0,0 +1,41 @@
+<Project xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
+
+  <PropertyGroup>
+    <PlatformShortName>PNaCl</PlatformShortName>
+    <PlatformArchitecture>32</PlatformArchitecture>
+    <TargetArchitecture>pnacl</TargetArchitecture>
+    <PlatformToolset Condition="'$(PlatformToolset)' == ''">v110</PlatformToolset>
+
+    <ProjectName Condition=" '$(ProjectName)' == '' ">$(MSBuildProjectName)</ProjectName>
+    <TargetName Condition="'$(TargetName)'==''">$(ProjectName)</TargetName>
+    <ToolchainName Condition="'$(ToolchainName)' == ''">newlib</ToolchainName>
+    <IntDir Condition="'$(IntDir)'=='' AND '$(IntermediateOutputPath)'!=''">$(IntermediateOutputPath)</IntDir>
+
+    <!-- Set IntDir and OutDir to a dummy value here to stop the builtin Default.props file
+         from setting them.  This allows us to set them to their real default values in the
+         .props file. By which time the user settings for ToolchainName in the vcproj file
+         will have been set.  If we try to use $(ToolchainName) here it will always evaluate
+         to newlib. -->
+    <IntDir Condition="'$(IntDir)'=='' AND '$(IntermediateOutputPath)'==''">DUMMY</IntDir>
+    <OutDir Condition="'$(OutDir)'==''">DUMMY</OutDir>
+
+    <VSNaClSDKRoot Condition="'$(VSNaClSDKRoot)'==''">$(NACL_SDK_ROOT)\</VSNaClSDKRoot>
+
+    <NaClToolchainRoot>$(VSNaClSDKRoot)toolchain\win_pnacl\</NaClToolchainRoot>
+
+    <NaClDefaultIncludePath Condition="'$(NaClDefaultIncludePath)'==''">$(NaClToolchainRoot)usr\local\include;$(NaClToolchainRoot)usr\include</NaClDefaultIncludePath>
+
+    <NaClDefaultIncludePath Condition="!Exists('$(NaClToolchainRoot)host_x86_32\lib\clang\3.4')">$(NaClDefaultIncludePath);$(NaClToolchainRoot)\lib\clang\3.4\include</NaClDefaultIncludePath>
+
+    <NaClDefaultIncludePath Condition="Exists('$(NaClToolchainRoot)host_x86_32\lib\clang\3.4')">$(NaClDefaultIncludePath);$(NaClToolchainRoot)host_x86_32\lib\clang\3.4\include</NaClDefaultIncludePath>
+
+    <NaClDefaultIncludePath Condition="Exists('$(NaClToolchainRoot)usr\include\c++\v1')">$(NaClDefaultIncludePath);$(NaClToolchainRoot)usr\include\c++\v1</NaClDefaultIncludePath>
+
+    <NaClWebServerPort Condition="'$(NaClWebServerPort)'==''">5103</NaClWebServerPort>
+    <NaClIndexHTML Condition="'$(NaClIndexHTML)'==''">index.html</NaClIndexHTML>
+    <NaClManifestPath Condition="'$(NaClManifestPath)'==''"></NaClManifestPath>
+  </PropertyGroup>
+
+  <Import Project="$(VCTargetsPath)\NaCl\NaCl.Toolset.default.props" />
+
+</Project>
diff --git a/visual_studio/NativeClientVSAddIn/InstallerResources/PNaCl/Props/pnacl_general.xml b/visual_studio/NativeClientVSAddIn/InstallerResources/PNaCl/Props/pnacl_general.xml
index fb15634..13c6077 100644
--- a/visual_studio/NativeClientVSAddIn/InstallerResources/PNaCl/Props/pnacl_general.xml
+++ b/visual_studio/NativeClientVSAddIn/InstallerResources/PNaCl/Props/pnacl_general.xml
@@ -80,7 +80,7 @@
   <StringProperty Name="TargetName" DisplayName="Target Name"
                   Description="Specifies a file name that this project will generate."
                   F1Keyword="VC.Project.VCConfiguration.TargetName"
-                  Category="General" Default="$(ProjectName)_$(PlatformArchitecture)"
+                  Category="General" Default="$(ProjectName)"
                   >
                   <StringProperty.DataSource>
                      <DataSource Persistence="ProjectFile" Label="" />
diff --git a/visual_studio/NativeClientVSAddIn/InstallerResources/PNaCl/Props/pnacl_general_ps.xml b/visual_studio/NativeClientVSAddIn/InstallerResources/PNaCl/Props/pnacl_general_ps.xml
index 2c72949..1c5f00a 100644
--- a/visual_studio/NativeClientVSAddIn/InstallerResources/PNaCl/Props/pnacl_general_ps.xml
+++ b/visual_studio/NativeClientVSAddIn/InstallerResources/PNaCl/Props/pnacl_general_ps.xml
@@ -82,7 +82,7 @@
   <StringProperty Name="TargetName" DisplayName="Target Name"
                   Description="Specifies a file name that this project will generate."
                   F1Keyword="VC.Project.VCConfiguration.TargetName"
-                  Category="General" Default="$(ProjectName)_$(PlatformArchitecture)"
+                  Category="General" Default="$(ProjectName)"
                   >
                   <StringProperty.DataSource>
                      <DataSource Persistence="ProjectFile" Label="" />
diff --git a/visual_studio/NativeClientVSAddIn/UnitTests/PropertyManagerTest.cs b/visual_studio/NativeClientVSAddIn/UnitTests/PropertyManagerTest.cs
index d8a4b45..0aa2a74 100644
--- a/visual_studio/NativeClientVSAddIn/UnitTests/PropertyManagerTest.cs
+++ b/visual_studio/NativeClientVSAddIn/UnitTests/PropertyManagerTest.cs
@@ -201,7 +201,6 @@
       string slnDir = Path.GetDirectoryName(naclSolution);
       string projectDir = Path.Combine(
           slnDir, Path.GetDirectoryName(TestUtilities.NaClProjectUniqueName)) + @"\";
-      
 
       foreach (string platform in NaClPlatformNames())
       {
@@ -237,39 +236,6 @@
     }
 
     /// <summary>
-    /// A test for GetProperty. Checks some non-trivial C# properties and the GetProperty method.
-    /// </summary>
-    [TestMethod]
-    public void GetPropertyPNaClTest()
-    {
-        string expectedSDKRootDir =
-            Environment.GetEnvironmentVariable(Strings.SDKPathEnvironmentVariable);
-        Assert.IsNotNull(expectedSDKRootDir, "SDK Path environment variable not set!");
-        expectedSDKRootDir = expectedSDKRootDir.TrimEnd(new char[] { '/', '\\' });
-
-        // Set up the property manager to read the NaCl platform settings from BlankValidSolution.
-        PropertyManager target = new PropertyManager();
-        dte_.Solution.Open(naclSolution);
-        Project naclProject = dte_.Solution.Projects.Item(TestUtilities.NaClProjectUniqueName);
-        target.SetTarget(naclProject, Strings.PNaClPlatformName, "Debug");
-        Assert.AreEqual(
-            PropertyManager.ProjectPlatformType.NaCl,
-            target.PlatformType,
-            "SetTarget did not succeed with nacl platform on valid project.");
-
-        string slnDir = Path.GetDirectoryName(naclSolution);
-        string projectDir = Path.Combine(
-            slnDir, Path.GetDirectoryName(TestUtilities.NaClProjectUniqueName)) + @"\";
-        string outputDir = Path.Combine(projectDir, "PNaCl", "newlib", "Debug") + @"\";
-        string assembly = Path.Combine(outputDir, TestUtilities.BlankNaClProjectName + ".pexe");
-
-        Assert.AreEqual(expectedSDKRootDir, target.SDKRootDirectory, "SDK Root.");
-        Assert.AreEqual(projectDir, target.ProjectDirectory, "ProjectDirectory.");
-        Assert.AreEqual(outputDir, target.OutputDirectory, "OutputDirectory.");
-        Assert.AreEqual(assembly, target.PluginAssembly, "PluginAssembly.");
-    }
-
-    /// <summary>
     /// Return a list of all nacl platform names.
     /// </summary>
     public static string[] NaClPlatformNames()
diff --git a/visual_studio/NativeClientVSAddIn/create_package.py b/visual_studio/NativeClientVSAddIn/create_package.py
index 6fca5eb..e6b155a 100644
--- a/visual_studio/NativeClientVSAddIn/create_package.py
+++ b/visual_studio/NativeClientVSAddIn/create_package.py
@@ -237,7 +237,6 @@
       '64': '32',
       '.nexe': '.pexe',
       'nacl_link.xml': 'pnacl_link.xml',
-      '$(ProjectName)_$(PlatformArchitecture)': '$(ProjectName)',
   }
 
   dest = join(STAGING_DIR, 'PNaCl')