OSDN Git Service

Add a VS "14" msbuild toolset
authorReid Kleckner <reid@kleckner.net>
Wed, 23 Jul 2014 23:49:16 +0000 (23:49 +0000)
committerReid Kleckner <reid@kleckner.net>
Wed, 23 Jul 2014 23:49:16 +0000 (23:49 +0000)
This allows people to try clang inside MSBuild with the VS "14" CTP
releases.

Fixes PR20341.

Patch by Marcel Raad!

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

tools/msbuild/CMakeLists.txt
tools/msbuild/install.bat
tools/msbuild/toolset-vs2014.targets [new file with mode: 0644]
tools/msbuild/toolset-vs2014_xp.targets [new file with mode: 0644]
tools/msbuild/uninstall.bat

index b7be71d..4f471e5 100644 (file)
@@ -10,6 +10,8 @@ if (WIN32)
     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")
@@ -29,6 +31,11 @@ if (WIN32)
     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)
@@ -38,12 +45,16 @@ if (WIN32)
     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)
index 9880fb2..18057b4 100644 (file)
@@ -30,6 +30,12 @@ IF EXIST %D% GOTO FOUND_V120
 SET D="%ProgramFiles(x86)%\MSBuild\Microsoft.Cpp\v4.0\V120\Platforms\%PLATFORM%\PlatformToolsets"\r
 IF EXIST %D% GOTO FOUND_V120\r
 \r
+:TRY_V140\r
+SET D="%ProgramFiles%\MSBuild\Microsoft.Cpp\v4.0\V140\Platforms\%PLATFORM%\PlatformToolsets"\r
+IF EXIST %D% GOTO FOUND_V140\r
+SET D="%ProgramFiles(x86)%\MSBuild\Microsoft.Cpp\v4.0\V140\Platforms\%PLATFORM%\PlatformToolsets"\r
+IF EXIST %D% GOTO FOUND_V140\r
+\r
 :LOOPEND\r
 IF %SUCCESS% == 1 goto DONE\r
 echo Failed to find MSBuild toolsets directory.\r
@@ -76,6 +82,22 @@ IF NOT %ERRORLEVEL% == 0 GOTO FAILED
 copy %PLATFORM%\toolset-vs2013_xp.targets %D%\LLVM-vs2013_xp\toolset.targets\r
 IF NOT %ERRORLEVEL% == 0 GOTO FAILED\r
 set SUCCESS=1\r
+GOTO TRY_V140\r
+\r
+:FOUND_V140\r
+IF NOT EXIST %D%\LLVM-vs2014 mkdir %D%\LLVM-vs2014\r
+IF NOT %ERRORLEVEL% == 0 GOTO FAILED\r
+copy %PLATFORM%\toolset-vs2014.props %D%\LLVM-vs2014\toolset.props\r
+IF NOT %ERRORLEVEL% == 0 GOTO FAILED\r
+copy %PLATFORM%\toolset-vs2014.targets %D%\LLVM-vs2014\toolset.targets\r
+IF NOT %ERRORLEVEL% == 0 GOTO FAILED\r
+IF NOT EXIST %D%\LLVM-vs2014_xp mkdir %D%\LLVM-vs2014_xp\r
+IF NOT %ERRORLEVEL% == 0 GOTO FAILED\r
+copy %PLATFORM%\toolset-vs2014_xp.props %D%\LLVM-vs2014_xp\toolset.props\r
+IF NOT %ERRORLEVEL% == 0 GOTO FAILED\r
+copy %PLATFORM%\toolset-vs2014_xp.targets %D%\LLVM-vs2014_xp\toolset.targets\r
+IF NOT %ERRORLEVEL% == 0 GOTO FAILED\r
+set SUCCESS=1\r
 GOTO START\r
 \r
 \r
diff --git a/tools/msbuild/toolset-vs2014.targets b/tools/msbuild/toolset-vs2014.targets
new file mode 100644 (file)
index 0000000..fd09c4f
--- /dev/null
@@ -0,0 +1,6 @@
+<Project ToolsVersion="14.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">\r
+  <Import Project="$(VCTargetsPath)\Microsoft.CppCommon.targets" />\r
+</Project>\r
+<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
new file mode 100644 (file)
index 0000000..eec4f18
--- /dev/null
@@ -0,0 +1,21 @@
+<Project ToolsVersion="14.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">\r
+  <!-- Force TargetFrameworkVersion to v4.0 to support XP-->\r
+  <PropertyGroup>\r
+    <TargetFrameworkVersion>v4.0</TargetFrameworkVersion>\r
+    <BeforeClCompileTargets>NoSupportCodeAnalysisXP;$(BeforeClCompileTargets)</BeforeClCompileTargets>\r
+  </PropertyGroup>\r
+\r
+  <Import Project="$(VCTargetsPath)\Microsoft.CppCommon.targets" />\r
+\r
+  <Target Name="NoSupportCodeAnalysisXP" Condition="'$(ErrorNoSupportCodeAnalysisXP)' != 'false'">\r
+    <VCMessage Condition="'$(DesignTimeBuild)' != 'true' and '@(ClCompile->AnyHaveMetadataValue('EnablePREfast', 'true'))'=='true'" Code="MSB8026" Type="Error"/>\r
+  </Target>\r
+\r
+  <PropertyGroup>\r
+    <PrepareForBuildDependsOn>CheckWindowsSDK71A;$(PrepareForBuildDependsOn)</PrepareForBuildDependsOn>\r
+  </PropertyGroup>\r
+\r
+  <Target Name="CheckWindowsSDK71A">\r
+    <VCMessage Code="MSB8003" Type="Warning" Arguments="WindowsSdkDir_71A" Condition="'$(WindowsSdkDir_71A)'=='' and '$(UseEnv)' != 'true'" />\r
+  </Target>\r
+</Project>\r
index b0bc943..ec9fecf 100644 (file)
@@ -51,6 +51,21 @@ 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\r
 IF EXIST %D%\LLVM-vs2013_xp rmdir %D%\LLVM-vs2013_xp\r
 \r
+SET D="%ProgramFiles%\MSBuild\Microsoft.Cpp\v4.0\V140\Platforms\%PLATFORM%\PlatformToolsets"\r
+IF EXIST %D%\LLVM-vs2014 del %D%\LLVM-vs2014\toolset.props\r
+IF EXIST %D%\LLVM-vs2014 del %D%\LLVM-vs2014\toolset.targets\r
+IF EXIST %D%\LLVM-vs2014 rmdir %D%\LLVM-vs2014\r
+IF EXIST %D%\LLVM-vs2014_xp del %D%\LLVM-vs2014_xp\toolset.props\r
+IF EXIST %D%\LLVM-vs2014_xp del %D%\LLVM-vs2014_xp\toolset.targets\r
+IF EXIST %D%\LLVM-vs2014_xp rmdir %D%\LLVM-vs2014_xp\r
+SET D="%ProgramFiles(x86)%\MSBuild\Microsoft.Cpp\v4.0\V140\Platforms\%PLATFORM%\PlatformToolsets"\r
+IF EXIST %D%\LLVM-vs2014 del %D%\LLVM-vs2014\toolset.props\r
+IF EXIST %D%\LLVM-vs2014 del %D%\LLVM-vs2014\toolset.targets\r
+IF EXIST %D%\LLVM-vs2014 rmdir %D%\LLVM-vs2014\r
+IF EXIST %D%\LLVM-vs2014_xp del %D%\LLVM-vs2014_xp\toolset.props\r
+IF EXIST %D%\LLVM-vs2014_xp del %D%\LLVM-vs2014_xp\toolset.targets\r
+IF EXIST %D%\LLVM-vs2014_xp rmdir %D%\LLVM-vs2014_xp\r
+\r
 \r
 GOTO START\r
 \r