mirror of
https://github.com/RPCS3/llvm-mirror.git
synced 2024-11-22 10:42:39 +01:00
Update the Visual Studio Integration from user feedback.
This patch removes the MSBuild warnings about options that clang-cl ignores. It also adds several additional fields to the LLVM Configuration options page. The first is that it adds support for LLD! To give the user flexibility though, we don't want to force LLD to always-on, and if we're not forcing LLD then we might as well not force clang-cl either. So we add options that can enable or disable lld, clang-cl, or any combination of the two. Whenever one is disabled, it falls back to the Microsoft equivalent. Additionally, for each of clang-cl and lld-link, we add a new configuration setting that allows Additional Options to be passed for that specific tool only. This is similar to the C/C++ > Command Line > Additional Options entry box, but it serves the use case where a user switches back and forth between the toolsets in their vcxproj, but where cl.exe won't accept some options that clang-cl will. In this case you can pass those options in the clang-cl additional options and whenever clang-cl is disabled (or the other toolset is selected entirely), those options won't get passed at all. llvm-svn: 340780
This commit is contained in:
parent
91525f438c
commit
552792e81d
@ -41,6 +41,9 @@
|
||||
<LLVMInstallDir Condition="'$(LLVMInstallDir)' == ''">$(Registry:HKEY_LOCAL_MACHINE\SOFTWARE\Wow6432Node\LLVM\LLVM)</LLVMInstallDir>
|
||||
<LLVMInstallDir Condition="'$(LLVMInstallDir)' != ''">$(LLVMInstallDir)\</LLVMInstallDir>
|
||||
<ClangClExecutable>$(LLVMInstallDir)bin\clang-cl.exe</ClangClExecutable>
|
||||
<LldLinkExecutable>$(LLVMInstallDir)bin\lld-link.exe</LldLinkExecutable>
|
||||
<UseClangCl>true</UseClangCl>
|
||||
<UseLldLink>true</UseLldLink>
|
||||
</PropertyGroup>
|
||||
|
||||
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.WindowsSDK.props" Condition="Exists('$(VCTargetsPath)\Microsoft.Cpp.WindowsSDK.props')"/>
|
||||
@ -69,8 +72,6 @@
|
||||
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>
|
||||
|
@ -7,7 +7,8 @@
|
||||
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>
|
||||
<CLToolExe Condition="$(UseClangCl)">$(ClangClExecutable)</CLToolExe>
|
||||
<LinkToolExe Condition="$(UseLldLink)">$(LldLinkExecutable)</LinkToolExe>
|
||||
</PropertyGroup>
|
||||
|
||||
<ItemGroup>
|
||||
@ -16,6 +17,20 @@
|
||||
</PropertyPageSchema>
|
||||
</ItemGroup>
|
||||
|
||||
<!-- Take any clang-specific options that the user wants to pass and stick them onto the
|
||||
general purpose list of command line flags. -->
|
||||
<ItemDefinitionGroup Condition="$(UseClangCl)">
|
||||
<ClCompile>
|
||||
<AdditionalOptions>-m$(PlatformArchitecture) $(ClangClAdditionalOptions) %(AdditionalOptions)</AdditionalOptions>
|
||||
</ClCompile>
|
||||
</ItemDefinitionGroup>
|
||||
|
||||
<ItemDefinitionGroup Condition="$(UseLldLink)">
|
||||
<Link>
|
||||
<AdditionalOptions>$(LldLinkAdditionalOptions) %(AdditionalOptions)</AdditionalOptions>
|
||||
</Link>
|
||||
</ItemDefinitionGroup>
|
||||
|
||||
<!-- 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
|
||||
@ -39,67 +54,7 @@
|
||||
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, then map to /Z7. /Zi is mapped to /Z7 below too (see comment there), but don't warn on that. -->
|
||||
<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 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."/>
|
||||
|
||||
<Target Name="BeforeClCompile" BeforeTargets="ClCompile" Condition="$(UseClangCl)">
|
||||
<!-- Error if they're trying to compile this file as managed code. -->
|
||||
<Error Condition="('%(ClCompile.CompileAsManaged)' != 'false') AND ('%(ClCompile.CompileAsManaged)' != '')"
|
||||
File="@(ClCompile)(0,0)"
|
||||
|
@ -9,17 +9,47 @@
|
||||
<Category Name="General" DisplayName="General" Description="General" />
|
||||
</Rule.Categories>
|
||||
<Rule.DataSource>
|
||||
<DataSource Persistence="ProjectFile" Label="Configuration" />
|
||||
<DataSource Persistence="ProjectFile" Label="LLVM" />
|
||||
</Rule.DataSource>
|
||||
|
||||
<BoolProperty Name="UseClangCl"
|
||||
DisplayName="Use clang-cl"
|
||||
Description="Use clang-cl for compiling. If this option is disabled, the Microsoft compiler (cl.exe) will be used instead."
|
||||
Category="General"
|
||||
Default="true">
|
||||
</BoolProperty>
|
||||
<StringProperty Name="ClangClExecutable"
|
||||
DisplayName="Clang-CL Executable"
|
||||
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>
|
||||
|
||||
<StringProperty Name="ClangClAdditionalOptions"
|
||||
DisplayName="Additional Compiler Options"
|
||||
Description="Additional options to pass to clang. This is essentially the same as C/C++ > Command Line > Additional Options, except that it is safe to put options here that will be rejected by cl.exe in case you switch toolchains back and forth."
|
||||
Category="General">
|
||||
</StringProperty>
|
||||
|
||||
<BoolProperty Name="UseLldLink"
|
||||
DisplayName="Use lld-link"
|
||||
Description="Use lld-link for linking. If this option is disabled, the Microsoft linker (link.exe) will be used instead."
|
||||
Category="General"
|
||||
Default="true">
|
||||
</BoolProperty>
|
||||
<StringProperty Name="LldLinkExecutable"
|
||||
DisplayName="lld-link Executable"
|
||||
Description="Specifies the path to lld-link.exe."
|
||||
Category="General"
|
||||
Default="$(LLVMInstallDir)bin\lld-link.exe"
|
||||
Subtype="file">
|
||||
</StringProperty>
|
||||
|
||||
<StringProperty Name="LldLinkAdditionalOptions"
|
||||
DisplayName="Additional Linker Options"
|
||||
Description="Additional options to pass to lld-link. This is essentially the same as General > Linker > Command Line > Additional Options, except that it is safe to put options here that will be rejected by link.exe in case you switch toolchains back and forth."
|
||||
Category="General">
|
||||
</StringProperty>
|
||||
|
||||
</Rule>
|
||||
|
Loading…
Reference in New Issue
Block a user