OSDN Git Service

vs integration: Use llvm-lib for librarian
authorRussell Gallop <russell.gallop@gmail.com>
Mon, 29 Apr 2019 10:10:17 +0000 (10:10 +0000)
committerRussell Gallop <russell.gallop@gmail.com>
Mon, 29 Apr 2019 10:10:17 +0000 (10:10 +0000)
This uses llvm-lib.exe for the librarian instead of Visual Studio
provided lib.exe. Without this it is not possible to create static
libraries with -flto using the plugin.

Original patch by Steven Noonan

This fixes: PR41147

Differential Revision: https://reviews.llvm.org/D61193

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@359430 91177308-0d34-0410-b5e6-96231b3b80d8

tools/msbuild/LLVM.Cpp.Common.props
tools/msbuild/LLVM.Cpp.Common.targets
tools/msbuild/llvm-general.xml

index 3420b77..bc021b3 100644 (file)
     <LLVMInstallDir Condition="'$(LLVMInstallDir)' != ''">$(LLVMInstallDir)\</LLVMInstallDir>\r
     <ClangClExecutable>$(LLVMInstallDir)bin\clang-cl.exe</ClangClExecutable>\r
     <LldLinkExecutable>$(LLVMInstallDir)bin\lld-link.exe</LldLinkExecutable>\r
+    <LlvmLibExecutable>$(LLVMInstallDir)bin\llvm-lib.exe</LlvmLibExecutable>\r
     <UseClangCl>true</UseClangCl>\r
     <UseLldLink>true</UseLldLink>\r
+    <UseLlvmLib>true</UseLlvmLib>\r
   </PropertyGroup>\r
 \r
   <Import Project="$(VCTargetsPath)\Microsoft.Cpp.WindowsSDK.props" Condition="Exists('$(VCTargetsPath)\Microsoft.Cpp.WindowsSDK.props')"/>\r
index 5870a3d..74a98d6 100644 (file)
@@ -9,6 +9,7 @@
          that the user may have overridden in the UI. -->\r
     <CLToolExe Condition="$(UseClangCl)">$(ClangClExecutable)</CLToolExe>\r
     <LinkToolExe Condition="$(UseLldLink)">$(LldLinkExecutable)</LinkToolExe>\r
+    <LIBToolExe Condition="$(UseLlvmLib)">$(LlvmLibExecutable)</LIBToolExe>\r
   </PropertyGroup>\r
 \r
   <ItemGroup>\r
index a14a684..66a2cfe 100644 (file)
                   Category="General">\r
   </StringProperty>\r
 \r
+\r
+  <BoolProperty Name="UseLlvmLib"\r
+                DisplayName="Use llvm-lib"\r
+                Description="Use llvm-lib for managing libraries.  If this option is disabled, the Microsoft librarian (lib.exe) will be used instead."\r
+                Category="General"\r
+                Default="true">\r
+  </BoolProperty>\r
+  <StringProperty Name="LlvmLibExecutable"\r
+                  DisplayName="llvm-lib Executable"\r
+                  Description="Specifies the path to llvm-lib.exe."\r
+                  Category="General"\r
+                  Default="$(LLVMInstallDir)bin\llvm-lib.exe"\r
+                  Subtype="file">\r
+  </StringProperty>\r
+\r
+  <StringProperty Name="LlvmLibAdditionalOptions"\r
+                  DisplayName="Additional Librarian Options"\r
+                  Description="Additional options to pass to llvm-lib.  This is essentially the same as General > Librarian > Command Line > Additional Options, except that it is safe to put options here that will be rejected by lib.exe in case you switch toolchains back and forth."\r
+                  Category="General">\r
+  </StringProperty>\r
+\r
 </Rule>\r