summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorZachary Turner <zturner@google.com>2018-07-20 16:30:02 +0000
committerZachary Turner <zturner@google.com>2018-07-20 16:30:02 +0000
commitf51ced79104a05940ef278810f664d8daf67ea9c (patch)
tree6743b69ad058a9aa273cc335f6ae9193f95b282b
parent7d86834e82ca6d4bd80a18d40c405001243e2d5a (diff)
Rewrite the VS integration scripts.
This is a new modernized VS integration installer. It adds a Visual Studio .sln file which, when built, outputs a VSIX that can be used to install ourselves as a "real" Visual Studio Extension. We can even upload this extension to the visual studio marketplace. This fixes a longstanding problem where we didn't support installing into VS 2017 and higher. In addition to supporting VS 2017, due to the way this is written we now longer need to do anything special to support future versions of VS as well. Everything should "just work". This also fixes several bugs with our old integration, such as MSBuild triggering full rebuilds when /Zi was used. Finally, we add a new UI page called "LLVM" which becomes visible when the LLVM toolchain is selected. For now this only contains one option which is the path to clang-cl.exe, but in the future we can add more things here. Differential Revision: https://reviews.llvm.org/D42762 git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@337572 91177308-0d34-0410-b5e6-96231b3b80d8
-rw-r--r--CMakeLists.txt4
-rw-r--r--tools/msbuild/.gitignore2
-rw-r--r--tools/msbuild/CMakeLists.txt69
-rw-r--r--tools/msbuild/LLVM.Cpp.Common.props75
-rw-r--r--tools/msbuild/LLVM.Cpp.Common.targets184
-rw-r--r--tools/msbuild/Microsoft.Cpp.Win32.LLVM-vs2010.targets2
-rw-r--r--tools/msbuild/Microsoft.Cpp.Win32.LLVM-vs2012.targets3
-rw-r--r--tools/msbuild/Microsoft.Cpp.Win32.LLVM-vs2012_xp.targets21
-rw-r--r--tools/msbuild/Microsoft.Cpp.Win32.llvm.props.in18
-rw-r--r--tools/msbuild/Platformx64/Toolset.props11
-rw-r--r--tools/msbuild/Platformx64/Toolset.targets3
-rw-r--r--tools/msbuild/Platformx86/Toolset.props11
-rw-r--r--tools/msbuild/Platformx86/Toolset.targets3
-rw-r--r--tools/msbuild/install.bat180
-rw-r--r--tools/msbuild/license.txt39
-rw-r--r--tools/msbuild/llvm-general.xml25
-rw-r--r--tools/msbuild/llvm.csproj100
-rw-r--r--tools/msbuild/llvm.sln25
-rw-r--r--tools/msbuild/source.extension.vsixmanifest22
-rw-r--r--tools/msbuild/toolset-vs2013.targets3
-rw-r--r--tools/msbuild/toolset-vs2013_xp.targets21
-rw-r--r--tools/msbuild/toolset-vs2014.targets3
-rw-r--r--tools/msbuild/toolset-vs2014_xp.targets21
-rw-r--r--tools/msbuild/uninstall.bat106
24 files changed, 590 insertions, 361 deletions
diff --git a/CMakeLists.txt b/CMakeLists.txt
index 955cf94ad7a..e546720e0bf 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -231,10 +231,6 @@ if(WIN32 AND NOT UNIX)
set(CPACK_NSIS_MUI_UNIICON "${CMAKE_CURRENT_SOURCE_DIR}\\\\cmake\\\\nsis_icon.ico")
set(CPACK_NSIS_MODIFY_PATH "ON")
set(CPACK_NSIS_ENABLE_UNINSTALL_BEFORE_INSTALL "ON")
- set(CPACK_NSIS_EXTRA_INSTALL_COMMANDS
- "ExecWait '$INSTDIR/tools/msbuild/install.bat'")
- set(CPACK_NSIS_EXTRA_UNINSTALL_COMMANDS
- "ExecWait '$INSTDIR/tools/msbuild/uninstall.bat'")
if( CMAKE_CL_64 )
set(CPACK_NSIS_INSTALL_ROOT "$PROGRAMFILES64")
endif()
diff --git a/tools/msbuild/.gitignore b/tools/msbuild/.gitignore
new file mode 100644
index 00000000000..01c1f5a9d0b
--- /dev/null
+++ b/tools/msbuild/.gitignore
@@ -0,0 +1,2 @@
+bin
+obj
diff --git a/tools/msbuild/CMakeLists.txt b/tools/msbuild/CMakeLists.txt
deleted file mode 100644
index 9d132ea58d5..00000000000
--- a/tools/msbuild/CMakeLists.txt
+++ /dev/null
@@ -1,69 +0,0 @@
-if (MSVC)
- # CPack will install a registry key in this format that we wish to reference.
- set(REG_KEY "${CPACK_PACKAGE_INSTALL_REGISTRY_KEY}")
- set(LIB_PATH_VERSION "${LLVM_VERSION_MAJOR}.${LLVM_VERSION_MINOR}")
-
- foreach (platform "Win32" "x64")
- set(prop_file_in "Microsoft.Cpp.Win32.llvm.props.in")
- set(prop_file_v100 "Microsoft.Cpp.${platform}.LLVM-vs2010.props")
- set(prop_file_v110 "Microsoft.Cpp.${platform}.LLVM-vs2012.props")
- set(prop_file_v110_xp "Microsoft.Cpp.${platform}.LLVM-vs2012_xp.props")
- set(prop_file_v120 "toolset-vs2013.props")
- set(prop_file_v120_xp "toolset-vs2013_xp.props")
- set(prop_file_v140 "toolset-vs2014.props")
- set(prop_file_v140_xp "toolset-vs2014_xp.props")
-
- if (platform STREQUAL "Win32")
- set(mflag "m32")
- else()
- set(mflag "m64")
- endif()
- set(VS_VERSION "v100")
- set(MSC_VERSION "1600")
- configure_file(${prop_file_in} ${platform}/${prop_file_v100})
- set(VS_VERSION "v110")
- set(MSC_VERSION "1700")
- configure_file(${prop_file_in} ${platform}/${prop_file_v110})
- set(VS_VERSION "v110_xp")
- configure_file(${prop_file_in} ${platform}/${prop_file_v110_xp})
- set(VS_VERSION "v120")
- set(MSC_VERSION "1800")
- configure_file(${prop_file_in} ${platform}/${prop_file_v120})
- set(VS_VERSION "v120_xp")
- configure_file(${prop_file_in} ${platform}/${prop_file_v120_xp})
- set(VS_VERSION "v140")
- set(MSC_VERSION "1900")
- configure_file(${prop_file_in} ${platform}/${prop_file_v140})
- set(VS_VERSION "v140_xp")
- configure_file(${prop_file_in} ${platform}/${prop_file_v140_xp})
- set(VS_VERSION)
- set(MSC_VERSION)
- set(mflag)
-
- install(FILES "${CMAKE_CURRENT_BINARY_DIR}/${platform}/${prop_file_v100}" DESTINATION tools/msbuild/${platform})
- install(FILES "${CMAKE_CURRENT_BINARY_DIR}/${platform}/${prop_file_v110}" DESTINATION tools/msbuild/${platform})
- install(FILES "${CMAKE_CURRENT_BINARY_DIR}/${platform}/${prop_file_v110_xp}" DESTINATION tools/msbuild/${platform})
- install(FILES "${CMAKE_CURRENT_BINARY_DIR}/${platform}/${prop_file_v120}" DESTINATION tools/msbuild/${platform})
- install(FILES "${CMAKE_CURRENT_BINARY_DIR}/${platform}/${prop_file_v120_xp}" DESTINATION tools/msbuild/${platform})
- install(FILES "${CMAKE_CURRENT_BINARY_DIR}/${platform}/${prop_file_v140}" DESTINATION tools/msbuild/${platform})
- install(FILES "${CMAKE_CURRENT_BINARY_DIR}/${platform}/${prop_file_v140_xp}" DESTINATION tools/msbuild/${platform})
-
- install(FILES "Microsoft.Cpp.Win32.LLVM-vs2010.targets" DESTINATION "tools/msbuild/${platform}" RENAME "Microsoft.Cpp.${platform}.LLVM-vs2010.targets")
- install(FILES "Microsoft.Cpp.Win32.LLVM-vs2012.targets" DESTINATION "tools/msbuild/${platform}" RENAME "Microsoft.Cpp.${platform}.LLVM-vs2012.targets")
- install(FILES "Microsoft.Cpp.Win32.LLVM-vs2012_xp.targets" DESTINATION "tools/msbuild/${platform}" RENAME "Microsoft.Cpp.${platform}.LLVM-vs2012_xp.targets")
- install(FILES "toolset-vs2013.targets" DESTINATION "tools/msbuild/${platform}")
- install(FILES "toolset-vs2013_xp.targets" DESTINATION "tools/msbuild/${platform}")
- install(FILES "toolset-vs2014.targets" DESTINATION "tools/msbuild/${platform}")
- install(FILES "toolset-vs2014_xp.targets" DESTINATION "tools/msbuild/${platform}")
- endforeach()
-
- set(LIB_PATH_VERSION)
- set(REG_KEY)
-
- install(DIRECTORY .
- DESTINATION tools/msbuild
- FILES_MATCHING
- PATTERN "*.bat"
- PATTERN ".svn" EXCLUDE
- )
-endif()
diff --git a/tools/msbuild/LLVM.Cpp.Common.props b/tools/msbuild/LLVM.Cpp.Common.props
new file mode 100644
index 00000000000..ffc1270a85c
--- /dev/null
+++ b/tools/msbuild/LLVM.Cpp.Common.props
@@ -0,0 +1,75 @@
+<Project xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
+ <!-- The general order of executing an MSBuild file is roughly:
+ 1) vcxproj file
+ 2) ├─ Import Microsoft.Cpp.props
+ 3) │ └─ Import Toolset specific props (e.g. $(VCTargets)Platforms\Win32\PlatformToolsets\llvm\Toolset.props)
+ 4) │ └─ Import This File (LLVM.Cpp.Common.props)
+ 5) │─ Core logic of vcxproj (define files, override properties, etc)
+ 6) └─ Import Microsoft.Cpp.targets
+ 7) │─ Import Toolset specific targets file (e.g. $(VCTargets)Platforms\Win32\PlatformToolsets\llvm\Toolset.targets)
+ 8) └─ Run the compiler.
+ The important thing is that we have hooks at 3, 4, and 7. 3 and 4 give
+ us the ability to provide initial values for toolchain settings (where
+ is the compiler, what values are considered "default" for a given
+ setting, etc), 7 gives us the ability to act on anything that the user
+ has overridden (such as warning or erroring on incompatible settings,
+ mapping settings to other settings, etc).
+ -->
+
+ <PropertyGroup>
+ <!-- This initializes the values in Properties > General > Output Directory.
+ Builds will fail without this. -->
+ <OutDirWasSpecified Condition=" '$(OutDir)'!='' AND '$(OutDirWasSpecified)'=='' ">true</OutDirWasSpecified>
+ <OutDirWasSpecified Condition=" '$(OutDir)'=='' AND '$(OutDirWasSpecified)'=='' ">false</OutDirWasSpecified>
+
+ <IntDir Condition="'$(IntDir)'=='' AND '$(IntermediateOutputPath)'!=''">$(IntermediateOutputPath)</IntDir>
+ <IntDir Condition="'$(IntDir)'=='' AND '$(IntermediateOutputPath)'==''">$(Configuration)\</IntDir>
+ <OutDir Condition="'$(OutDir)'=='' AND '$(SolutionDir)' != ''">$(SolutionDir)$(Configuration)\</OutDir>
+ <OutDir Condition="'$(OutDir)'=='' AND '$(SolutionDir)' == ''">$(IntDir)</OutDir>
+ <DebuggerFlavor Condition="'$(DebuggerFlavor)'==''">WindowsLocalDebugger</DebuggerFlavor>
+ </PropertyGroup>
+
+ <PropertyGroup>
+ <!-- Short names for platform toolsets (added to project name in Solution Explorer) -->
+ <_PlatformToolsetShortNameFor_llvm>LLVM</_PlatformToolsetShortNameFor_llvm>
+ <_PlatformToolsetFriendlyNameFor_llvm>LLVM</_PlatformToolsetFriendlyNameFor_llvm>
+ </PropertyGroup>
+
+ <!-- Find an installed LLVM and set up our paths. -->
+ <PropertyGroup>
+ <LLVMInstallDir>$(Registry:HKEY_LOCAL_MACHINE\SOFTWARE\LLVM@LLVM)</LLVMInstallDir>
+ <LLVMInstallDir Condition="'$(LLVMInstallDir)' == ''">$(Registry:HKEY_LOCAL_MACHINE\SOFTWARE\Wow6432Node\LLVM@LLVM)</LLVMInstallDir>
+ <ClangClExecutable>$(LLVMInstallDir)bin\clang-cl.exe</ClangClExecutable>
+ </PropertyGroup>
+
+ <Import Project="$(VCTargetsPath)\Microsoft.Cpp.WindowsSDK.props" Condition="Exists('$(VCTargetsPath)\Microsoft.Cpp.WindowsSDK.props')"/>
+ <Import Project="$(VCTargetsPath)\Microsoft.Cpp.Common.props" />
+
+ <PropertyGroup>
+ <!-- Set some paths (such as include paths) that are common to all platforms. This is the same as what
+ the default paths for cl will use.
+ -->
+ <IncludePath Condition="'$(IncludePath)' == ''">$(IncludePath);$(VC_IncludePath);$(WindowsSDK_IncludePath);</IncludePath>
+ <LibraryWPath Condition="'$(LibraryWPath)' == ''">$(WindowsSDK_MetadataPath);</LibraryWPath>
+ <SourcePath Condition="'$(SourcePath)' == ''">$(VC_SourcePath);</SourcePath>
+ </PropertyGroup>
+
+
+ <!-- Set values which are reflected in the property UI by default. The user can override these
+ by editing the vcxproj file (or making changes via the UI, which has the same effect).
+ -->
+ <ItemDefinitionGroup>
+ <ClCompile>
+ <!-- Set this to "Default" (which means not passing any /RTC option) so that any other value will
+ be treated as having been overridden by the user. This Serves as a hint to the user that
+ Default is the value we support, and other values will generate a warning. It also means
+ that if the user simply creates a new project in MSVC (which uses /RTCu by default), then
+ switches the toolset to Clang, we will still treat the value as default (which for us is to
+ not pass the option). Only if the user explicitly overrode this setting in a project to use
+ /RTCu would we see the warning. -->
+ <BasicRuntimeChecks>Default</BasicRuntimeChecks>
+
+ <AdditionalOptions>-m$(PlatformArchitecture) %(AdditionalOptions)</AdditionalOptions>
+ </ClCompile>
+ </ItemDefinitionGroup>
+</Project>
diff --git a/tools/msbuild/LLVM.Cpp.Common.targets b/tools/msbuild/LLVM.Cpp.Common.targets
new file mode 100644
index 00000000000..1edc08d2a32
--- /dev/null
+++ b/tools/msbuild/LLVM.Cpp.Common.targets
@@ -0,0 +1,184 @@
+<Project xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
+ <Import Project="$(VCTargetsPath)\Microsoft.CppCommon.targets" />
+
+ <PropertyGroup>
+ <!-- Set the path to clang-cl executable based on the value of the project-
+ level setting. This has to be done in the .targets file since values
+ selected via the settings UI appear in the vcxproj (which is imported
+ before the targets file but after the props file) and we need the path
+ that the user may have overridden in the UI. -->
+ <CLToolExe>$(ClangClExecutable)</CLToolExe>
+ </PropertyGroup>
+
+ <ItemGroup>
+ <PropertyPageSchema Include="$(VCTargetsPath)$(LangID)\llvm-general.xml">
+ <Context>Project</Context>
+ </PropertyPageSchema>
+ </ItemGroup>
+
+ <!-- We hook up a target to run every time ClCompile is about to run, the
+ purpose of which is to sanitize the command line before it gets passed to
+ the compiler. Some options we silently discard, other options we warn on
+ and then discard, and other options we generate a hard error.
+
+ We try to keep hard errors to a minimum and reserve it for cases where
+ the option implies fundamentally different assumptions about the way code
+ should be compiled. This code would probably generate an error anyway,
+ but at least this way we give the user a more useful message about what
+ the actual problem is, rather than relying on some obscure compilation
+ error.
+
+ For any options that clang-cl discards, we would prefer to not even pass
+ them in on the command line. So if a user starts with a cl projects and
+ changes the toolset to clang, they could have set options such as /Gm
+ (minimal rebuild), /sdl (Security Checks), etc. The ClCompile task would
+ then notice this and pass these through to clang-cl.exe. Clang would of
+ course ignore them, but in some cases (such as /Gm), they would generate
+ -Wunused-command-line-argument warnings, so it's better if we can just
+ strip them from the command line entirely. This also has the side
+ benefit of making command lines shorter which is always nice when trying
+ to look at the tool output.
+ -->
+ <Target Name="BeforeClCompile" BeforeTargets="ClCompile">
+ <!-- Warn on /Zi and /ZI, then map them both to /Z7. -->
+ <Warning Condition="'%(ClCompile.DebugInformationFormat)' == 'ProgramDatabase'"
+ File="@(ClCompile)(0,0)"
+ Text="clang-cl does not support /Zi (Program Database). The file will be compiled as if /Z7 (C7 Compatible Debug Info) had been passed. Update the Debug Information Format in project settings to silence this warning."/>
+ <Warning Condition="'%(ClCompile.DebugInformationFormat)' == 'EditAndContinue'"
+ File="@(ClCompile)(0,0)"
+ Text="clang-cl does not support /ZI (Program Database for Edit and Continue). The file will be compiled as if /Z7 (C7 Compatible Debug Info) had been passed. Update the Debug Information Format in project settings to silence this warning."/>
+
+ <!-- Warn if Fiber Safe Optimizations are enabled, and then ignore them. -->
+ <Warning Condition="'%(ClCompile.EnableFiberSafeOptimizations)' == 'true'"
+ File="@(ClCompile)(0,0)"
+ Text="clang-cl does not support fiber safe optimizations (/GT). Disable this option in compatibility settings to silence this warning."/>
+
+ <!-- Warn if Whole Program Optimization is enabled, and then ignore it. -->
+ <Warning Condition="'%(ClCompile.WholeProgramOptimization)' == 'true'"
+ File="@(ClCompile)(0,0)"
+ Text="clang-cl does not support MSVC Link Time Optimization. Disable this option in compatibility settings to silence this warning."/>
+
+ <!-- Warn if Ignore Standard Include Paths is non-empty, then ignore it. -->
+ <Warning Condition="'%(ClCompile.IgnoreStandardIncludePath)' == 'true'"
+ File="@(ClCompile)(0,0)"
+ Text="clang-cl does not support Ignore Standard Include Path (/X). Disable this option in compatibility settings to silence this warning."/>
+
+ <!-- Warn if Smaller Type Check is enabled, then ignore it.-->
+ <Warning Condition="'%(ClCompile.SmallerTypeCheck)' == 'true'"
+ File="@(ClCompile)(0,0)"
+ Text="clang-cl does not support Smaller Type Check (/RTCc). Disable this option in compatibility settings to silence this warning."/>
+
+ <!-- Warn if Runtime Checks are enabled, then ignore them.-->
+ <Warning Condition="'%(ClCompile.BasicRuntimeChecks)' != 'Default'"
+ File="@(ClCompile)(0,0)"
+ Text="clang-cl does not support Basic Runtime Checks (/RTCu, /RTC1, /RTCs). Disable this option in compatibility settings to silence this warning."/>
+
+ <!-- Warn if parallel code generation on #pragma loop is enabled, then ignore. -->
+ <Warning Condition="'(ClCompile.EnableParallelCodeGeneration)' == 'true'"
+ File="@(ClCompile)(0,0)"
+ Text="clang-cl does not support parallel code generation with #pragma loop(hint) (/Qpar). Disable this option in compatibility settings to silence this warning."/>
+
+ <!-- Warn if hotpatchable images are turned on -->
+ <Warning Condition="'%(ClCompile.CreateHotpatchableImage)' == 'true'"
+ File="@(ClCompile)(0,0)"
+ Text="clang-cl does not support creating hotpatchable images (/hotpatch). Disable this option in compatibility settings to silence this warning."/>
+
+ <!-- Warn if /Zc:forScope- is specified, and then ignore it. -->
+ <Warning Condition="'%(ClCompile.ForceConformanceInForLoopScope)' == 'false'"
+ File="@(ClCompile)(0,0)"
+ Text="clang-cl does not support disabling for loop scope conformance (/Zc:forScope-). Disable this option in compatibility settings to silence this warning."/>
+
+ <!-- Warn if /Zc:wchar_t- is specified, and then ignore it. -->
+ <Warning Condition="'%(ClCompile.TreatWChar_tAsBuiltInType)' == 'false'"
+ File="@(ClCompile)(0,0)"
+ Text="clang-cl does not support treating wchar_t as a non builtin type (/Zc:wchar_t-). Disable this option in compatibility settings to silence this warning."/>
+
+ <!-- Warn if XML Documentation is generated, and then ignore it. -->
+ <Warning Condition="'%(ClCompile.GenerateXMLDocumentationFiles)' == 'true'"
+ File="@(ClCompile)(0,0)"
+ Text="clang-cl does not support generating xml documentation comment files (/doc). Disable this option in compatibility settings to silence this warning."/>
+
+ <!-- Warn if Browse Information is generated, and then ignore it. -->
+ <Warning Condition="'%(ClCompile.BrowseInformation)' == 'true'"
+ File="@(ClCompile)(0,0)"
+ Text="clang-cl does not support generating browse information (/FR). Disable this option in compatibility settings to silence this warning."/>
+
+ <!-- Warn if /analyze is passed, then ignore it. -->
+ <Warning Condition="'%(ClCompile.EnablePREfast)' == 'true'"
+ File="@(ClCompile)(0,0)"
+ Text="clang-cl does not support MSVC code analysis functionality (/analyze). Disable this option in compatibility settings to silence this warning."/>
+
+ <!-- Error if they're trying to compile this file as managed code. -->
+ <Error Condition="('%(ClCompile.CompileAsManaged)' != 'false') AND ('%(ClCompile.CompileAsManaged)' != '')"
+ File="@(ClCompile)(0,0)"
+ Text="clang-cl does not support compiling managed code (/clr). This file cannot be compiled."/>
+
+ <!-- Error if WinRT is being used. -->
+ <Error Condition="('%(ClCompile.CompileAsWinRT)' == 'true') OR ('%(ClCompile.WinRTNoStdLib)' == 'true')"
+ File="@(ClCompile)(0,0)"
+ Text="clang-cl does not support Windows Runtime Language Extensions (/ZW, /ZW:nostdlib). This file cannot be compiled."/>
+
+ <!-- Error if OpenMP language extensions are enabled. -->
+ <Error Condition="'%(ClCompile.OpenMPSupport)' == 'true'"
+ File="@(ClCompile)(0,0)"
+ Text="clang-cl does not support OpenMP (/openmp). This file cannot be compiled."/>
+
+ <!-- Error if C++ Modules are enabled. Clang has its own notion of modules that are not compatible. -->
+ <Error Condition="'%(ClCompile.EnableModules)' == 'true'"
+ File="@(ClCompile)(0,0)"
+ Text="clang-cl does not support MSVC Modules (/experimental:module). This file cannot be compiled."/>
+
+ <ItemGroup>
+ <ClCompile>
+ <!-- Map /ZI and /Zi to /Z7. Clang internally does this, so if we were
+ to just pass the option through, clang would work. The problem is
+ that MSBuild would not. MSBuild detects /ZI and /Zi and then
+ assumes (rightly) that there will be a compiler-generated PDB (e.g.
+ vc141.pdb). Since clang-cl will not emit this, MSBuild will always
+ think that the compiler-generated PDB needs to be re-generated from
+ scratch and trigger a full build. The way to avoid this is to
+ always give MSBuild accurate information about how we plan to
+ generate debug info (which is to always using /Z7 semantics).
+ -->
+ <DebugInformationFormat Condition="'%(ClCompile.DebugInformationFormat)' == 'ProgramDatabase'">OldStyle</DebugInformationFormat>
+ <DebugInformationFormat Condition="'%(ClCompile.DebugInformationFormat)' == 'EditAndContinue'">OldStyle</DebugInformationFormat>
+
+ <!-- Unset any options that we either silently ignore or warn about due to compatibility.
+ Generally when an option is set to no value, that means "Don't pass an option to the
+ compiler at all."
+ -->
+ <WholeProgramOptimization/>
+ <EnableFiberSafeOptimizations/>
+ <IgnoreStandardIncludePath/>
+ <EnableParallelCodeGeneration/>
+ <ForceConformanceInForLoopScope/>
+ <TreatWChar_tAsBuiltInType/>
+ <SDLCheck/>
+ <GenerateXMLDocumentationFiles/>
+ <BrowseInformation/>
+ <EnablePREfast/>
+ <MinimalRebuild/>
+ <StringPooling/>
+ <ExpandAttributedSource/>
+ <EnforceTypeConversionRules/>
+ <ErrorReporting/>
+ <DisableLanguageExtensions/>
+ <ProgramDataBaseFileName/>
+ <DisableSpecificWarnings/>
+ <TreatSpecificWarningsAsErrors/>
+ <ForcedUsingFiles/>
+ <PREfastLog/>
+ <PREfastAdditionalOptions/>
+ <PREfastAdditionalPlugins/>
+ <MultiProcessorCompilation/>
+ <UseFullPaths/>
+ <RemoveUnreferencedCodeData/>
+
+ <!-- We can't just unset BasicRuntimeChecks, as that will pass /RTCu to the compiler.
+ We have to explicitly set it to 'Default' to avoid passing anything. -->
+ <BasicRuntimeChecks>Default</BasicRuntimeChecks>
+ </ClCompile>
+ </ItemGroup>
+ </Target>
+
+</Project>
diff --git a/tools/msbuild/Microsoft.Cpp.Win32.LLVM-vs2010.targets b/tools/msbuild/Microsoft.Cpp.Win32.LLVM-vs2010.targets
deleted file mode 100644
index df41a844aa7..00000000000
--- a/tools/msbuild/Microsoft.Cpp.Win32.LLVM-vs2010.targets
+++ /dev/null
@@ -1,2 +0,0 @@
-<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
-</Project>
diff --git a/tools/msbuild/Microsoft.Cpp.Win32.LLVM-vs2012.targets b/tools/msbuild/Microsoft.Cpp.Win32.LLVM-vs2012.targets
deleted file mode 100644
index f7432f2fe5d..00000000000
--- a/tools/msbuild/Microsoft.Cpp.Win32.LLVM-vs2012.targets
+++ /dev/null
@@ -1,3 +0,0 @@
-<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
- <Import Project="$(VCTargetsPath)\Microsoft.CppCommon.targets" />
-</Project>
diff --git a/tools/msbuild/Microsoft.Cpp.Win32.LLVM-vs2012_xp.targets b/tools/msbuild/Microsoft.Cpp.Win32.LLVM-vs2012_xp.targets
deleted file mode 100644
index e8250d8e824..00000000000
--- a/tools/msbuild/Microsoft.Cpp.Win32.LLVM-vs2012_xp.targets
+++ /dev/null
@@ -1,21 +0,0 @@
-<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
- <!-- Force TargetFrameworkVersion to v4.0 to support XP-->
- <PropertyGroup>
- <TargetFrameworkVersion>v4.0</TargetFrameworkVersion>
- <BeforeClCompileTargets>NoSupportCodeAnalysisXP;$(BeforeClCompileTargets)</BeforeClCompileTargets>
- </PropertyGroup>
-
- <Import Project="$(VCTargetsPath)\Microsoft.CppCommon.targets" />
-
- <Target Name="NoSupportCodeAnalysisXP" Condition="'$(ErrorNoSupportCodeAnalysisXP)' != 'false'">
- <VCMessage Condition="'$(DesignTimeBuild)' != 'true' and '@(ClCompile->AnyHaveMetadataValue('EnablePREfast', 'true'))'=='true'" Code="MSB8026" Type="Error"/>
- </Target>
-
- <PropertyGroup>
- <PrepareForBuildDependsOn>CheckWindowsSDK71A;$(PrepareForBuildDependsOn)</PrepareForBuildDependsOn>
- </PropertyGroup>
-
- <Target Name="CheckWindowsSDK71A">
- <VCMessage Code="MSB8003" Type="Warning" Arguments="WindowsSdkDir_71A" Condition="'$(WindowsSdkDir_71A)'=='' and '$(UseEnv)' != 'true'" />
- </Target>
-</Project>
diff --git a/tools/msbuild/Microsoft.Cpp.Win32.llvm.props.in b/tools/msbuild/Microsoft.Cpp.Win32.llvm.props.in
deleted file mode 100644
index a775c31c767..00000000000
--- a/tools/msbuild/Microsoft.Cpp.Win32.llvm.props.in
+++ /dev/null
@@ -1,18 +0,0 @@
-<Project xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
- <Import Project="$(VCTargetsPath)\Platforms\$(Platform)\PlatformToolsets\@VS_VERSION@\Microsoft.Cpp.$(Platform).@VS_VERSION@.props" Condition="Exists('$(VCTargetsPath)\Platforms\$(Platform)\PlatformToolsets\@VS_VERSION@\Microsoft.Cpp.$(Platform).@VS_VERSION@.props')"/>
- <Import Project="$(VCTargetsPath)\Platforms\$(Platform)\PlatformToolsets\@VS_VERSION@\Toolset.props" Condition="Exists('$(VCTargetsPath)\Platforms\$(Platform)\PlatformToolsets\@VS_VERSION@\Toolset.props')"/>
-
- <PropertyGroup>
- <LLVMInstallDir>$(Registry:HKEY_LOCAL_MACHINE\SOFTWARE\LLVM\@REG_KEY@)</LLVMInstallDir>
- <LLVMInstallDir Condition="'$(LLVMInstallDir)' == ''">$(Registry:HKEY_LOCAL_MACHINE\SOFTWARE\Wow6432Node\LLVM\@REG_KEY@)</LLVMInstallDir>
- <ExecutablePath>$(LLVMInstallDir)\msbuild-bin;$(ExecutablePath)</ExecutablePath>
- <LibraryPath>$(LLVMInstallDir)\lib\clang\@LIB_PATH_VERSION@\lib\windows;$(LibraryPath)</LibraryPath>
- </PropertyGroup>
-
- <ItemDefinitionGroup>
- <ClCompile>
- <!-- Set the value of _MSC_VER to claim for compatibility -->
- <AdditionalOptions>-@mflag@ -fmsc-version=@MSC_VERSION@ %(AdditionalOptions)</AdditionalOptions>
- </ClCompile>
- </ItemDefinitionGroup>
-</Project>
diff --git a/tools/msbuild/Platformx64/Toolset.props b/tools/msbuild/Platformx64/Toolset.props
new file mode 100644
index 00000000000..4762f4eaa1c
--- /dev/null
+++ b/tools/msbuild/Platformx64/Toolset.props
@@ -0,0 +1,11 @@
+<Project xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
+ <Import Project="$(VCTargetsPath)\LLVM.Cpp.Common.props"/>
+
+ <PropertyGroup>
+ <ExecutablePath Condition="'$(ExecutablePath)' == ''">$(VC_ExecutablePath_x64);$(WindowsSDK_ExecutablePath);$(VS_ExecutablePath);$(MSBuild_ExecutablePath);$(FxCopDir);$(PATH);</ExecutablePath>
+ <ReferencePath Condition="'$(ReferencePath)' == ''">$(VC_ReferencesPath_x64);</ReferencePath>
+ <LibraryPath Condition="'$(LibraryPath)' == ''">$(VC_LibraryPath_x64);$(WindowsSDK_LibraryPath_x64);$(NETFXKitsDir)Lib\um\x64</LibraryPath>
+ <ExcludePath Condition="'$(ExcludePath)' == ''">$(VC_IncludePath);$(WindowsSDK_IncludePath);$(MSBuild_ExecutablePath);$(VC_LibraryPath_x64);</ExcludePath>
+ <DebugCppRuntimeFilesPath Condition="'$(DebugCppRuntimeFilesPath)' == ''">$(VCToolsInstallDir)redist\Debug_NonRedist\x64</DebugCppRuntimeFilesPath>
+ </PropertyGroup>
+</Project>
diff --git a/tools/msbuild/Platformx64/Toolset.targets b/tools/msbuild/Platformx64/Toolset.targets
new file mode 100644
index 00000000000..938e03b51e2
--- /dev/null
+++ b/tools/msbuild/Platformx64/Toolset.targets
@@ -0,0 +1,3 @@
+<Project xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
+ <Import Project="$(VCTargetsPath)\LLVM.Cpp.Common.targets"/>
+</Project>
diff --git a/tools/msbuild/Platformx86/Toolset.props b/tools/msbuild/Platformx86/Toolset.props
new file mode 100644
index 00000000000..5a5cd6c736f
--- /dev/null
+++ b/tools/msbuild/Platformx86/Toolset.props
@@ -0,0 +1,11 @@
+<Project xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
+ <Import Project="$(VCTargetsPath)\LLVM.Cpp.Common.props"/>
+
+ <PropertyGroup>
+ <ExecutablePath Condition="'$(ExecutablePath)' == ''">$(VC_ExecutablePath_x86);$(WindowsSDK_ExecutablePath);$(VS_ExecutablePath);$(MSBuild_ExecutablePath);$(SystemRoot)\SysWow64;$(FxCopDir);$(PATH);</ExecutablePath>
+ <ReferencePath Condition="'$(ReferencePath)' == ''">$(VC_ReferencesPath_x86);</ReferencePath>
+ <LibraryPath Condition="'$(LibraryPath)' == ''">$(VC_LibraryPath_x86);$(WindowsSDK_LibraryPath_x86);$(NETFXKitsDir)Lib\um\x86</LibraryPath>
+ <ExcludePath Condition="'$(ExcludePath)' == ''">$(VC_IncludePath);$(WindowsSDK_IncludePath);$(MSBuild_ExecutablePath);$(VC_LibraryPath_x86);</ExcludePath>
+ <DebugCppRuntimeFilesPath Condition="'$(DebugCppRuntimeFilesPath)' == ''">$(VCToolsInstallDir)redist\Debug_NonRedist\x86</DebugCppRuntimeFilesPath>
+ </PropertyGroup>
+</Project>
diff --git a/tools/msbuild/Platformx86/Toolset.targets b/tools/msbuild/Platformx86/Toolset.targets
new file mode 100644
index 00000000000..938e03b51e2
--- /dev/null
+++ b/tools/msbuild/Platformx86/Toolset.targets
@@ -0,0 +1,3 @@
+<Project xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
+ <Import Project="$(VCTargetsPath)\LLVM.Cpp.Common.targets"/>
+</Project>
diff --git a/tools/msbuild/install.bat b/tools/msbuild/install.bat
index 6e321e3f580..bbc8a746151 100644
--- a/tools/msbuild/install.bat
+++ b/tools/msbuild/install.bat
@@ -1,123 +1,57 @@
-@echo off
-
-echo Installing MSVC integration...
-set SUCCESS=0
-
-REM Change to the directory of this batch file.
-cd /d %~dp0
-
-REM Loop over the two platforms in awkward batch file fashion.
-set PLATFORM=None
-:PLATFORMLOOPHEAD
-IF %PLATFORM% == x64 GOTO PLATFORMLOOPEND
-IF %PLATFORM% == Win32 SET PLATFORM=x64
-IF %PLATFORM% == None SET PLATFORM=Win32
-
-REM Search for the MSBuild toolsets directory.
-
-SET D="%ProgramFiles%\MSBuild\Microsoft.Cpp\v4.0\Platforms\%PLATFORM%\PlatformToolsets"
-IF EXIST %D% GOTO FOUND_V100
-SET D="%ProgramFiles(x86)%\MSBuild\Microsoft.Cpp\v4.0\Platforms\%PLATFORM%\PlatformToolsets"
-IF EXIST %D% GOTO FOUND_V100
-
-:TRY_V110
-SET D="%ProgramFiles%\MSBuild\Microsoft.Cpp\v4.0\V110\Platforms\%PLATFORM%\PlatformToolsets"
-IF EXIST %D% GOTO FOUND_V110
-SET D="%ProgramFiles(x86)%\MSBuild\Microsoft.Cpp\v4.0\V110\Platforms\%PLATFORM%\PlatformToolsets"
-IF EXIST %D% GOTO FOUND_V110
-
-:TRY_V120
-SET D="%ProgramFiles%\MSBuild\Microsoft.Cpp\v4.0\V120\Platforms\%PLATFORM%\PlatformToolsets"
-IF EXIST %D% GOTO FOUND_V120
-SET D="%ProgramFiles(x86)%\MSBuild\Microsoft.Cpp\v4.0\V120\Platforms\%PLATFORM%\PlatformToolsets"
-IF EXIST %D% GOTO FOUND_V120
-
-:TRY_V140
-SET D="%ProgramFiles%\MSBuild\Microsoft.Cpp\v4.0\V140\Platforms\%PLATFORM%\PlatformToolsets"
-IF EXIST %D% GOTO FOUND_V140
-SET D="%ProgramFiles(x86)%\MSBuild\Microsoft.Cpp\v4.0\V140\Platforms\%PLATFORM%\PlatformToolsets"
-IF EXIST %D% GOTO FOUND_V140
-
-:TRY_V150
-
-GOTO PLATFORMLOOPHEAD
-
-:PLATFORMLOOPEND
-IF %SUCCESS% == 1 goto DONE
-echo Failed to find MSBuild toolsets directory.
-goto FAILED
-
-
-:FOUND_V100
-REM Routine for installing v100 toolchain.
-IF NOT EXIST %D%\LLVM-vs2010 mkdir %D%\LLVM-vs2010
-IF NOT %ERRORLEVEL% == 0 GOTO FAILED
-copy %PLATFORM%\Microsoft.Cpp.%PLATFORM%.LLVM-vs2010.props %D%\LLVM-vs2010
-IF NOT %ERRORLEVEL% == 0 GOTO FAILED
-copy %PLATFORM%\Microsoft.Cpp.%PLATFORM%.LLVM-vs2010.targets %D%\LLVM-vs2010
-IF NOT %ERRORLEVEL% == 0 GOTO FAILED
-set SUCCESS=1
-GOTO TRY_V110
-
-:FOUND_V110
-REM Routine for installing v110 toolchain.
-IF NOT EXIST %D%\LLVM-vs2012 mkdir %D%\LLVM-vs2012
-IF NOT %ERRORLEVEL% == 0 GOTO FAILED
-copy %PLATFORM%\Microsoft.Cpp.%PLATFORM%.LLVM-vs2012.props %D%\LLVM-vs2012
-IF NOT %ERRORLEVEL% == 0 GOTO FAILED
-copy %PLATFORM%\Microsoft.Cpp.%PLATFORM%.LLVM-vs2012.targets %D%\LLVM-vs2012
-IF NOT %ERRORLEVEL% == 0 GOTO FAILED
-IF NOT EXIST %D%\LLVM-vs2012_xp mkdir %D%\LLVM-vs2012_xp
-IF NOT %ERRORLEVEL% == 0 GOTO FAILED
-copy %PLATFORM%\Microsoft.Cpp.%PLATFORM%.LLVM-vs2012_xp.props %D%\LLVM-vs2012_xp
-IF NOT %ERRORLEVEL% == 0 GOTO FAILED
-copy %PLATFORM%\Microsoft.Cpp.%PLATFORM%.LLVM-vs2012_xp.targets %D%\LLVM-vs2012_xp
-IF NOT %ERRORLEVEL% == 0 GOTO FAILED
-set SUCCESS=1
-GOTO TRY_V120
-
-:FOUND_V120
-REM Routine for installing v120 toolchain.
-IF NOT EXIST %D%\LLVM-vs2013 mkdir %D%\LLVM-vs2013
-IF NOT %ERRORLEVEL% == 0 GOTO FAILED
-copy %PLATFORM%\toolset-vs2013.props %D%\LLVM-vs2013\toolset.props
-IF NOT %ERRORLEVEL% == 0 GOTO FAILED
-copy %PLATFORM%\toolset-vs2013.targets %D%\LLVM-vs2013\toolset.targets
-IF NOT %ERRORLEVEL% == 0 GOTO FAILED
-IF NOT EXIST %D%\LLVM-vs2013_xp mkdir %D%\LLVM-vs2013_xp
-IF NOT %ERRORLEVEL% == 0 GOTO FAILED
-copy %PLATFORM%\toolset-vs2013_xp.props %D%\LLVM-vs2013_xp\toolset.props
-IF NOT %ERRORLEVEL% == 0 GOTO FAILED
-copy %PLATFORM%\toolset-vs2013_xp.targets %D%\LLVM-vs2013_xp\toolset.targets
-IF NOT %ERRORLEVEL% == 0 GOTO FAILED
-set SUCCESS=1
-GOTO TRY_V140
-
-:FOUND_V140
-REM Routine for installing v140 toolchain.
-IF NOT EXIST %D%\LLVM-vs2014 mkdir %D%\LLVM-vs2014
-IF NOT %ERRORLEVEL% == 0 GOTO FAILED
-copy %PLATFORM%\toolset-vs2014.props %D%\LLVM-vs2014\toolset.props
-IF NOT %ERRORLEVEL% == 0 GOTO FAILED
-copy %PLATFORM%\toolset-vs2014.targets %D%\LLVM-vs2014\toolset.targets
-IF NOT %ERRORLEVEL% == 0 GOTO FAILED
-IF NOT EXIST %D%\LLVM-vs2014_xp mkdir %D%\LLVM-vs2014_xp
-IF NOT %ERRORLEVEL% == 0 GOTO FAILED
-copy %PLATFORM%\toolset-vs2014_xp.props %D%\LLVM-vs2014_xp\toolset.props
-IF NOT %ERRORLEVEL% == 0 GOTO FAILED
-copy %PLATFORM%\toolset-vs2014_xp.targets %D%\LLVM-vs2014_xp\toolset.targets
-IF NOT %ERRORLEVEL% == 0 GOTO FAILED
-set SUCCESS=1
-GOTO TRY_V150
-
-
-:DONE
-echo Done!
-goto END
-
-:FAILED
-echo MSVC integration install failed.
-pause
-goto END
-
-:END
+@echo off
+
+echo Installing MSVC integration...
+set SUCCESS=0
+
+REM In general this script should not be used except for development and testing
+REM purposes. The proper way to install is via the VSIX, and the proper way to
+REM uninstall is through the Visual Studio extension manager.
+
+REM Change to the directory of this batch file.
+cd /d %~dp0
+
+REM Older versions of VS would look for these files in the Program Files\MSBuild directory
+REM but with VS2017 it seems to look for these directly in the Visual Studio instance.
+REM This means we'll need to do a little extra work to properly detect all the various
+REM instances, but in reality we can probably sidestep all of this by just wrapping this
+REM in a vsix and calling it a day, as that should handle everything for us.
+SET VCTargets=%ProgramFiles(x86)%\Microsoft Visual Studio\2017\Professional\Common7\IDE\VC\VCTargets
+
+ECHO Installing Common Files
+copy LLVM.Cpp.Common.props "%VCTargets%"
+IF NOT %ERRORLEVEL% == 0 GOTO FAILED
+copy LLVM.Cpp.Common.targets "%VCTargets%"
+IF NOT %ERRORLEVEL% == 0 GOTO FAILED
+
+ECHO Installing x64 Platform Toolset
+SET PlatformToolsets=%VCTargets%\Platforms\x64\PlatformToolsets
+IF NOT EXIST "%PlatformToolsets%\llvm" mkdir "%PlatformToolsets%\llvm"
+IF NOT %ERRORLEVEL% == 0 GOTO FAILED
+copy PlatformX64\Toolset.props "%PlatformToolsets%\llvm"
+IF NOT %ERRORLEVEL% == 0 GOTO FAILED
+copy PlatformX64\Toolset.targets "%PlatformToolsets%\llvm"
+IF NOT %ERRORLEVEL% == 0 GOTO FAILED
+
+ECHO Installing Win32 Platform Toolset
+SET PlatformToolsets=%VCTargets%\Platforms\Win32\PlatformToolsets
+IF NOT EXIST "%PlatformToolsets%\llvm" mkdir "%PlatformToolsets%\llvm"
+IF NOT %ERRORLEVEL% == 0 GOTO FAILED
+copy PlatformX86\Toolset.props "%PlatformToolsets%\llvm"
+IF NOT %ERRORLEVEL% == 0 GOTO FAILED
+copy PlatformX86\Toolset.targets "%PlatformToolsets%\llvm"
+IF NOT %ERRORLEVEL% == 0 GOTO FAILED
+
+ECHO Installing C++ Settings UI
+copy llvm-general.xml "%VCTargets%\1033"
+IF NOT %ERRORLEVEL% == 0 GOTO FAILED
+
+:DONE
+echo Done!
+goto END
+
+:FAILED
+echo MSVC integration install failed.
+pause
+goto END
+
+:END
diff --git a/tools/msbuild/license.txt b/tools/msbuild/license.txt
new file mode 100644
index 00000000000..76aa2afdf81
--- /dev/null
+++ b/tools/msbuild/license.txt
@@ -0,0 +1,39 @@
+====================
+LLVM Release License
+====================
+University of Illinois/NCSA
+Open Source License
+
+Copyright (c) 2007-2018 University of Illinois at Urbana-Champaign.
+All rights reserved.
+
+Developed by:
+
+ LLVM Team
+
+ University of Illinois at Urbana-Champaign
+
+ http://llvm.org
+
+Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal with the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
+
+ * Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimers.
+
+ * Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimers in the documentation and/or other materials provided with the distribution.
+
+ * Neither the names of the LLVM Team, University of Illinois at Urbana-Champaign, nor the names of its contributors may be used to endorse or promote products derived from this Software without specific prior written permission.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE CONTRIBUTORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS WITH THE SOFTWARE.
+
+====================
+The LLVM software contains code written by third parties. Such software will have its own individual LICENSE.TXT file in the directory in which it appears. This file will describe the copyrights, license, and restrictions which apply
+to that code.
+
+The disclaimer of warranty in the University of Illinois Open Source License applies to all code in the LLVM Distribution, and nothing in any of the other licenses gives permission to use the names of the LLVM Team or the University of Illinois to endorse or promote products derived from this Software.
+
+The following pieces of software have additional or alternate copyrights, licenses, and/or restrictions:
+
+Program Directory
+------- ---------
+<none yet>
+
diff --git a/tools/msbuild/llvm-general.xml b/tools/msbuild/llvm-general.xml
new file mode 100644
index 00000000000..6faf9110e60
--- /dev/null
+++ b/tools/msbuild/llvm-general.xml
@@ -0,0 +1,25 @@
+<?xml version="1.0" encoding="utf-8"?>
+<Rule
+ Name="LLVMGeneral"
+ DisplayName="LLVM"
+ PageTemplate="generic"
+ Description="LLVM"
+ xmlns="http://schemas.microsoft.com/build/2009/properties">
+ <Rule.Categories>
+ <Category Name="General" DisplayName="General" Description="General" />
+ </Rule.Categories>
+ <Rule.DataSource>
+ <DataSource Persistence="ProjectFile" Label="Configuration" />
+ </Rule.DataSource>
+
+ <StringProperty Name="ClangClExecutable"
+ DisplayName="Clang-CL Executable"
+ Description="Specifies the path to clang-cl.exe."
+ Category="General"
+ Default="$(LLVMInstallDir)bin\clang-cl.exe"
+ Subtype="file">
+ <StringProperty.DataSource>
+ <DataSource Persistence="ProjectFile" Label="" />
+ </StringProperty.DataSource>
+ </StringProperty>
+</Rule>
diff --git a/tools/msbuild/llvm.csproj b/tools/msbuild/llvm.csproj
new file mode 100644
index 00000000000..a614bb2f22b
--- /dev/null
+++ b/tools/msbuild/llvm.csproj
@@ -0,0 +1,100 @@
+<?xml version="1.0" encoding="utf-8"?>
+<Project ToolsVersion="15.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
+ <PropertyGroup>
+ <MinimumVisualStudioVersion>15.0</MinimumVisualStudioVersion>
+ <VSToolsPath Condition="'$(VSToolsPath)' == ''">$(MSBuildExtensionsPath32)\Microsoft\VisualStudio\v$(VisualStudioVersion)</VSToolsPath>
+ </PropertyGroup>
+ <Import Project="$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props" Condition="Exists('$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props')" />
+ <PropertyGroup>
+ <Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
+ <Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
+ <SchemaVersion>2.0</SchemaVersion>
+ <ProjectTypeGuids>{82b43b9b-a64c-4715-b499-d71e9ca2bd60};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</ProjectTypeGuids>
+ <ProjectGuid>{62530D9E-1B24-4C31-8DC9-AE47E9E5DC53}</ProjectGuid>
+ <OutputType>Library</OutputType>
+ <AppDesignerFolder>Properties</AppDesignerFolder>
+ <RootNamespace>llvm</RootNamespace>
+ <AssemblyName>llvm</AssemblyName>
+ <TargetFrameworkVersion>v4.6.1</TargetFrameworkVersion>
+ <GeneratePkgDefFile>false</GeneratePkgDefFile>
+ <IncludeAssemblyInVSIXContainer>false</IncludeAssemblyInVSIXContainer>
+ <IncludeDebugSymbolsInVSIXContainer>false</IncludeDebugSymbolsInVSIXContainer>
+ <IncludeDebugSymbolsInLocalVSIXDeployment>false</IncludeDebugSymbolsInLocalVSIXDeployment>
+ <CopyBuildOutputToOutputDirectory>false</CopyBuildOutputToOutputDirectory>
+ <CopyOutputSymbolsToOutputDirectory>false</CopyOutputSymbolsToOutputDirectory>
+ <StartAction>Program</StartAction>
+ <StartProgram Condition="'$(DevEnvDir)' != ''">$(DevEnvDir)devenv.exe</StartProgram>
+ <StartArguments>/rootsuffix Exp</StartArguments>
+ </PropertyGroup>
+ <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
+ <DebugSymbols>true</DebugSymbols>
+ <DebugType>full</DebugType>
+ <Optimize>false</Optimize>
+ <OutputPath>bin\Debug\</OutputPath>
+ <DefineConstants>DEBUG;TRACE</DefineConstants>
+ <ErrorReport>prompt</ErrorReport>
+ <WarningLevel>4</WarningLevel>
+ </PropertyGroup>
+ <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
+ <DebugType>pdbonly</DebugType>
+ <Optimize>true</Optimize>
+ <OutputPath>bin\Release\</OutputPath>
+ <DefineConstants>TRACE</DefineConstants>
+ <ErrorReport>prompt</ErrorReport>
+ <WarningLevel>4</WarningLevel>
+ </PropertyGroup>
+ <ItemGroup>
+ <Content Include="llvm-general.xml">
+ <IncludeInVSIX>true</IncludeInVSIX>
+ <InstallRoot>VCTargets</InstallRoot>
+ <VSIXSubPath>1033</VSIXSubPath>
+ </Content>
+ <Content Include="LLVM.Cpp.Common.props">
+ <IncludeInVSIX>true</IncludeInVSIX>
+ <InstallRoot>VCTargets</InstallRoot>
+ </Content>
+ <Content Include="license.txt">
+ <CopyToOutputDirectory>Always</CopyToOutputDirectory>
+ <IncludeInVSIX>true</IncludeInVSIX>
+ </Content>
+ <Content Include="LLVM.Cpp.Common.targets">
+ <IncludeInVSIX>true</IncludeInVSIX>
+ <InstallRoot>VCTargets</InstallRoot>
+ </Content>
+ <None Include="source.extension.vsixmanifest">
+ <SubType>Designer</SubType>
+ </None>
+ <Content Include="Platformx64\Toolset.props">
+ <IncludeInVSIX>true</IncludeInVSIX>
+ <InstallRoot>VCTargets</InstallRoot>
+ <VSIXSubPath>Platforms\x64\PlatformToolsets\llvm</VSIXSubPath>
+ </Content>
+ <Content Include="Platformx64\Toolset.targets">
+ <IncludeInVSIX>true</IncludeInVSIX>
+ <InstallRoot>VCTargets</InstallRoot>
+ <VSIXSubPath>Platforms\x64\PlatformToolsets\llvm</VSIXSubPath>
+ </Content>
+ <Content Include="Platformx86\Toolset.props">
+ <IncludeInVSIX>true</IncludeInVSIX>
+ <InstallRoot>VCTargets</InstallRoot>
+ <VSIXSubPath>Platforms\Win32\PlatformToolsets\llvm</VSIXSubPath>
+ </Content>
+ <Content Include="Platformx86\Toolset.targets">
+ <IncludeInVSIX>true</IncludeInVSIX>
+ <InstallRoot>VCTargets</InstallRoot>
+ <VSIXSubPath>Platforms\Win32\PlatformToolsets\llvm</VSIXSubPath>
+ </Content>
+ </ItemGroup>
+ <ItemGroup>
+ <Folder Include="Properties\" />
+ </ItemGroup>
+ <Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
+ <Import Project="$(VSToolsPath)\VSSDK\Microsoft.VsSDK.targets" Condition="'$(VSToolsPath)' != ''" />
+ <!-- To modify your build process, add your task inside one of the targets below and uncomment it.
+ Other similar extension points exist, see Microsoft.Common.targets.
+ <Target Name="BeforeBuild">
+ </Target>
+ <Target Name="AfterBuild">
+ </Target>
+ -->
+</Project> \ No newline at end of file
diff --git a/tools/msbuild/llvm.sln b/tools/msbuild/llvm.sln
new file mode 100644
index 00000000000..9fc37441b8b
--- /dev/null
+++ b/tools/msbuild/llvm.sln
@@ -0,0 +1,25 @@
+
+Microsoft Visual Studio Solution File, Format Version 12.00
+# Visual Studio 15
+VisualStudioVersion = 15.0.27004.2006
+MinimumVisualStudioVersion = 10.0.40219.1
+Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "llvm", "llvm.csproj", "{62530D9E-1B24-4C31-8DC9-AE47E9E5DC53}"
+EndProject
+Global
+ GlobalSection(SolutionConfigurationPlatforms) = preSolution
+ Debug|Any CPU = Debug|Any CPU
+ Release|Any CPU = Release|Any CPU
+ EndGlobalSection
+ GlobalSection(ProjectConfigurationPlatforms) = postSolution
+ {62530D9E-1B24-4C31-8DC9-AE47E9E5DC53}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
+ {62530D9E-1B24-4C31-8DC9-AE47E9E5DC53}.Debug|Any CPU.Build.0 = Debug|Any CPU
+ {62530D9E-1B24-4C31-8DC9-AE47E9E5DC53}.Release|Any CPU.ActiveCfg = Release|Any CPU
+ {62530D9E-1B24-4C31-8DC9-AE47E9E5DC53}.Release|Any CPU.Build.0 = Release|Any CPU
+ EndGlobalSection
+ GlobalSection(SolutionProperties) = preSolution
+ HideSolutionNode = FALSE
+ EndGlobalSection
+ GlobalSection(ExtensibilityGlobals) = postSolution
+ SolutionGuid = {BD0FC803-C28B-4327-A129-CFB35C873897}
+ EndGlobalSection
+EndGlobal
diff --git a/tools/msbuild/source.extension.vsixmanifest b/tools/msbuild/source.extension.vsixmanifest
new file mode 100644
index 00000000000..28be6a4242c
--- /dev/null
+++ b/tools/msbuild/source.extension.vsixmanifest
@@ -0,0 +1,22 @@
+<?xml version="1.0" encoding="utf-8"?>
+<PackageManifest Version="2.0.0" xmlns="http://schemas.microsoft.com/developer/vsx-schema/2011" xmlns:d="http://schemas.microsoft.com/developer/vsx-schema-design/2011">
+ <Metadata>
+ <Identity Id="llvm.d29c51f0-961f-4e20-aad6-356af569907f" Version="1.0" Language="en-US" Publisher="The LLVM Foundation" />
+ <DisplayName>LLVM Compiler Toolchain</DisplayName>
+ <Description xml:space="preserve">Allows the LLVM Compiler Toolchain (installed separately) to be used from within Visual Studio to build C/C++ Projects.</Description>
+ <License>license.txt</License>
+ </Metadata>
+ <Installation AllUsers="true">
+ <InstallationTarget Id="Microsoft.VisualStudio.Community" Version="[14.0,16.0)" />
+ <InstallationTarget Version="[14.0,16.0)" Id="Microsoft.VisualStudio.Pro" />
+ <InstallationTarget Version="[14.0,16.0)" Id="Microsoft.VisualStudio.Enterprise" />
+ </Installation>
+ <Dependencies>
+ <Dependency Id="Microsoft.Framework.NDP" DisplayName="Microsoft .NET Framework" d:Source="Manual" Version="[4.5,)" />
+ </Dependencies>
+ <Prerequisites>
+ <Prerequisite Id="Microsoft.VisualStudio.Component.CoreEditor" Version="[15.0,16.0)" DisplayName="Visual Studio core editor" />
+ <Prerequisite Id="Microsoft.VisualStudio.ComponentGroup.NativeDesktop.Core" Version="[15.0.26621.2,16.0)" DisplayName="Visual C++ core desktop features" />
+ <Prerequisite Id="Microsoft.VisualStudio.Component.VC.CoreIde" Version="[15.0.26606.0,16.0)" DisplayName="Visual Studio C++ core features" />
+ </Prerequisites>
+</PackageManifest>
diff --git a/tools/msbuild/toolset-vs2013.targets b/tools/msbuild/toolset-vs2013.targets
deleted file mode 100644
index a6efac48bae..00000000000
--- a/tools/msbuild/toolset-vs2013.targets
+++ /dev/null
@@ -1,3 +0,0 @@
-<Project ToolsVersion="12.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
- <Import Project="$(VCTargetsPath)\Microsoft.CppCommon.targets" />
-</Project>
diff --git a/tools/msbuild/toolset-vs2013_xp.targets b/tools/msbuild/toolset-vs2013_xp.targets
deleted file mode 100644
index e7196818542..00000000000
--- a/tools/msbuild/toolset-vs2013_xp.targets
+++ /dev/null
@@ -1,21 +0,0 @@
-<Project ToolsVersion="12.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
- <!-- Force TargetFrameworkVersion to v4.0 to support XP-->
- <PropertyGroup>
- <TargetFrameworkVersion>v4.0</TargetFrameworkVersion>
- <BeforeClCompileTargets>NoSupportCodeAnalysisXP;$(BeforeClCompileTargets)</BeforeClCompileTargets>
- </PropertyGroup>
-
- <Import Project="$(VCTargetsPath)\Microsoft.CppCommon.targets" />
-
- <Target Name="NoSupportCodeAnalysisXP" Condition="'$(ErrorNoSupportCodeAnalysisXP)' != 'false'">
- <VCMessage Condition="'$(DesignTimeBuild)' != 'true' and '@(ClCompile->AnyHaveMetadataValue('EnablePREfast', 'true'))'=='true'" Code="MSB8026" Type="Error"/>
- </Target>
-
- <PropertyGroup>
- <PrepareForBuildDependsOn>CheckWindowsSDK71A;$(PrepareForBuildDependsOn)</PrepareForBuildDependsOn>
- </PropertyGroup>
-
- <Target Name="CheckWindowsSDK71A">
- <VCMessage Code="MSB8003" Type="Warning" Arguments="WindowsSdkDir_71A" Condition="'$(WindowsSdkDir_71A)'=='' and '$(UseEnv)' != 'true'" />
- </Target>
-</Project>
diff --git a/tools/msbuild/toolset-vs2014.targets b/tools/msbuild/toolset-vs2014.targets
deleted file mode 100644
index 05b59a2d84f..00000000000
--- a/tools/msbuild/toolset-vs2014.targets
+++ /dev/null
@@ -1,3 +0,0 @@
-<Project ToolsVersion="14.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
- <Import Project="$(VCTargetsPath)\Microsoft.CppCommon.targets" />
-</Project>
diff --git a/tools/msbuild/toolset-vs2014_xp.targets b/tools/msbuild/toolset-vs2014_xp.targets
deleted file mode 100644
index eec4f18daa4..00000000000
--- a/tools/msbuild/toolset-vs2014_xp.targets
+++ /dev/null
@@ -1,21 +0,0 @@
-<Project ToolsVersion="14.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
- <!-- Force TargetFrameworkVersion to v4.0 to support XP-->
- <PropertyGroup>
- <TargetFrameworkVersion>v4.0</TargetFrameworkVersion>
- <BeforeClCompileTargets>NoSupportCodeAnalysisXP;$(BeforeClCompileTargets)</BeforeClCompileTargets>
- </PropertyGroup>
-
- <Import Project="$(VCTargetsPath)\Microsoft.CppCommon.targets" />
-
- <Target Name="NoSupportCodeAnalysisXP" Condition="'$(ErrorNoSupportCodeAnalysisXP)' != 'false'">
- <VCMessage Condition="'$(DesignTimeBuild)' != 'true' and '@(ClCompile->AnyHaveMetadataValue('EnablePREfast', 'true'))'=='true'" Code="MSB8026" Type="Error"/>
- </Target>
-
- <PropertyGroup>
- <PrepareForBuildDependsOn>CheckWindowsSDK71A;$(PrepareForBuildDependsOn)</PrepareForBuildDependsOn>
- </PropertyGroup>
-
- <Target Name="CheckWindowsSDK71A">
- <VCMessage Code="MSB8003" Type="Warning" Arguments="WindowsSdkDir_71A" Condition="'$(WindowsSdkDir_71A)'=='' and '$(UseEnv)' != 'true'" />
- </Target>
-</Project>
diff --git a/tools/msbuild/uninstall.bat b/tools/msbuild/uninstall.bat
index c1afae2c3c9..0c8852ec46d 100644
--- a/tools/msbuild/uninstall.bat
+++ b/tools/msbuild/uninstall.bat
@@ -1,73 +1,33 @@
-@echo off
-
-echo Uninstalling MSVC integration...
-
-REM CD to the directory of this batch file.
-cd /d %~dp0
-
-set PLATFORM=None
-:LOOPHEAD
-IF %PLATFORM% == x64 GOTO LOOPEND
-IF %PLATFORM% == Win32 SET PLATFORM=x64
-IF %PLATFORM% == None SET PLATFORM=Win32
-
-
-SET D="%ProgramFiles%\MSBuild\Microsoft.Cpp\v4.0\Platforms\%PLATFORM%\PlatformToolsets"
-IF EXIST %D%\LLVM-vs2010 del %D%\LLVM-vs2010\Microsoft.Cpp.%PLATFORM%.LLVM-vs2010.props
-IF EXIST %D%\LLVM-vs2010 del %D%\LLVM-vs2010\Microsoft.Cpp.%PLATFORM%.LLVM-vs2010.targets
-IF EXIST %D%\LLVM-vs2010 rmdir %D%\LLVM-vs2010
-SET D="%ProgramFiles(x86)%\MSBuild\Microsoft.Cpp\v4.0\Platforms\%PLATFORM%\PlatformToolsets"
-IF EXIST %D%\LLVM-vs2010 del %D%\LLVM-vs2010\Microsoft.Cpp.%PLATFORM%.LLVM-vs2010.props
-IF EXIST %D%\LLVM-vs2010 del %D%\LLVM-vs2010\Microsoft.Cpp.%PLATFORM%.LLVM-vs2010.targets
-IF EXIST %D%\LLVM-vs2010 rmdir %D%\LLVM-vs2010
-
-SET D="%ProgramFiles%\MSBuild\Microsoft.Cpp\v4.0\V110\Platforms\%PLATFORM%\PlatformToolsets"
-IF EXIST %D%\LLVM-vs2012 del %D%\LLVM-vs2012\Microsoft.Cpp.%PLATFORM%.LLVM-vs2012.props
-IF EXIST %D%\LLVM-vs2012 del %D%\LLVM-vs2012\Microsoft.Cpp.%PLATFORM%.LLVM-vs2012.targets
-IF EXIST %D%\LLVM-vs2012 rmdir %D%\LLVM-vs2012
-IF EXIST %D%\LLVM-vs2012_xp del %D%\LLVM-vs2012_xp\Microsoft.Cpp.%PLATFORM%.LLVM-vs2012_xp.props
-IF EXIST %D%\LLVM-vs2012_xp del %D%\LLVM-vs2012_xp\Microsoft.Cpp.%PLATFORM%.LLVM-vs2012_xp.targets
-IF EXIST %D%\LLVM-vs2012_xp rmdir %D%\LLVM-vs2012_xp
-SET D="%ProgramFiles(x86)%\MSBuild\Microsoft.Cpp\v4.0\V110\Platforms\%PLATFORM%\PlatformToolsets"
-IF EXIST %D%\LLVM-vs2012 del %D%\LLVM-vs2012\Microsoft.Cpp.%PLATFORM%.LLVM-vs2012.props
-IF EXIST %D%\LLVM-vs2012 del %D%\LLVM-vs2012\Microsoft.Cpp.%PLATFORM%.LLVM-vs2012.targets
-IF EXIST %D%\LLVM-vs2012 rmdir %D%\LLVM-vs2012
-IF EXIST %D%\LLVM-vs2012_xp del %D%\LLVM-vs2012_xp\Microsoft.Cpp.%PLATFORM%.LLVM-vs2012_xp.props
-IF EXIST %D%\LLVM-vs2012_xp del %D%\LLVM-vs2012_xp\Microsoft.Cpp.%PLATFORM%.LLVM-vs2012_xp.targets
-IF EXIST %D%\LLVM-vs2012_xp rmdir %D%\LLVM-vs2012_xp
-
-SET D="%ProgramFiles%\MSBuild\Microsoft.Cpp\v4.0\V120\Platforms\%PLATFORM%\PlatformToolsets"
-IF EXIST %D%\LLVM-vs2013 del %D%\LLVM-vs2013\toolset.props
-IF EXIST %D%\LLVM-vs2013 del %D%\LLVM-vs2013\toolset.targets
-IF EXIST %D%\LLVM-vs2013 rmdir %D%\LLVM-vs2013
-IF EXIST %D%\LLVM-vs2013_xp del %D%\LLVM-vs2013_xp\toolset.props
-IF EXIST %D%\LLVM-vs2013_xp del %D%\LLVM-vs2013_xp\toolset.targets
-IF EXIST %D%\LLVM-vs2013_xp rmdir %D%\LLVM-vs2013_xp
-SET D="%ProgramFiles(x86)%\MSBuild\Microsoft.Cpp\v4.0\V120\Platforms\%PLATFORM%\PlatformToolsets"
-IF EXIST %D%\LLVM-vs2013 del %D%\LLVM-vs2013\toolset.props
-IF EXIST %D%\LLVM-vs2013 del %D%\LLVM-vs2013\toolset.targets
-IF EXIST %D%\LLVM-vs2013 rmdir %D%\LLVM-vs2013
-IF EXIST %D%\LLVM-vs2013_xp del %D%\LLVM-vs2013_xp\toolset.props
-IF EXIST %D%\LLVM-vs2013_xp del %D%\LLVM-vs2013_xp\toolset.targets
-IF EXIST %D%\LLVM-vs2013_xp rmdir %D%\LLVM-vs2013_xp
-
-SET D="%ProgramFiles%\MSBuild\Microsoft.Cpp\v4.0\V140\Platforms\%PLATFORM%\PlatformToolsets"
-IF EXIST %D%\LLVM-vs2014 del %D%\LLVM-vs2014\toolset.props
-IF EXIST %D%\LLVM-vs2014 del %D%\LLVM-vs2014\toolset.targets
-IF EXIST %D%\LLVM-vs2014 rmdir %D%\LLVM-vs2014
-IF EXIST %D%\LLVM-vs2014_xp del %D%\LLVM-vs2014_xp\toolset.props
-IF EXIST %D%\LLVM-vs2014_xp del %D%\LLVM-vs2014_xp\toolset.targets
-IF EXIST %D%\LLVM-vs2014_xp rmdir %D%\LLVM-vs2014_xp
-SET D="%ProgramFiles(x86)%\MSBuild\Microsoft.Cpp\v4.0\V140\Platforms\%PLATFORM%\PlatformToolsets"
-IF EXIST %D%\LLVM-vs2014 del %D%\LLVM-vs2014\toolset.props
-IF EXIST %D%\LLVM-vs2014 del %D%\LLVM-vs2014\toolset.targets
-IF EXIST %D%\LLVM-vs2014 rmdir %D%\LLVM-vs2014
-IF EXIST %D%\LLVM-vs2014_xp del %D%\LLVM-vs2014_xp\toolset.props
-IF EXIST %D%\LLVM-vs2014_xp del %D%\LLVM-vs2014_xp\toolset.targets
-IF EXIST %D%\LLVM-vs2014_xp rmdir %D%\LLVM-vs2014_xp
-
-
-GOTO LOOPHEAD
-
-:LOOPEND
-echo Done!
+@echo off
+
+echo Uninstalling MSVC integration...
+
+REM In general this script should not be used except for development and testing
+REM purposes. The proper way to install is via the VSIX, and the proper way to
+REM uninstall is through the Visual Studio extension manager.
+
+REM CD to the directory of this batch file.
+cd /d %~dp0
+
+SET VCTargets=%ProgramFiles(x86)%\Microsoft Visual Studio\2017\Professional\Common7\IDE\VC\VCTargets
+
+ECHO Uninstalling Common Files
+IF EXIST "%VCTargets%\LLVM.Cpp.Common.props" del "%VCTargets%\LLVM.Cpp.Common.props"
+IF EXIST "%VCTargets%\LLVM.Cpp.Common.targets" del "%VCTargets%\LLVM.Cpp.Common.targets"
+
+ECHO Uninstalling x64 Platform Toolset
+SET PlatformToolsets=%VCTargets%\Platforms\x64\PlatformToolsets
+IF EXIST "%PlatformToolsets%\llvm\Toolset.props" del "%PlatformToolsets%\llvm\Toolset.props"
+IF EXIST "%PlatformToolsets%\llvm\Toolset.targets" del "%PlatformToolsets%\llvm\Toolset.targets"
+IF EXIST "%PlatformToolsets%\llvm" rd "%PlatformToolsets%\llvm"
+
+ECHO Uninstalling Win32 Platform Toolset
+SET PlatformToolsets=%VCTargets%\Platforms\Win32\PlatformToolsets
+IF EXIST "%PlatformToolsets%\llvm\Toolset.props" del "%PlatformToolsets%\llvm\Toolset.props"
+IF EXIST "%PlatformToolsets%\llvm\Toolset.targets" del "%PlatformToolsets%\llvm\Toolset.targets"
+IF EXIST "%PlatformToolsets%\llvm" rd "%PlatformToolsets%\llvm"
+
+ECHO Uninstalling C++ Settings UI
+IF EXIST "%VCTargets%\1033\llvm-general.xml" del "%VCTargets%\1033\llvm-general.xml"
+
+echo Done!