msbuild integration: provide separate files for VS2010 and VS2012
authorHans Wennborg <hans@hanshq.net>
Fri, 6 Sep 2013 17:05:46 +0000 (17:05 +0000)
committerHans Wennborg <hans@hanshq.net>
Fri, 6 Sep 2013 17:05:46 +0000 (17:05 +0000)
The previous msbuild integration only worked if VS2010 was installed. This patch
renames the current integration to LLVM-vs2010 and adds LLVM-vs2012.

Differential Revision: http://llvm-reviews.chandlerc.com/D1614

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

tools/msbuild/CMakeLists.txt
tools/msbuild/Microsoft.Cpp.Win32.LLVM-vs2010.targets [new file with mode: 0644]
tools/msbuild/Microsoft.Cpp.Win32.LLVM-vs2012.targets [new file with mode: 0644]
tools/msbuild/Microsoft.Cpp.Win32.llvm.props.in
tools/msbuild/Microsoft.Cpp.Win32.llvm.targets [deleted file]
tools/msbuild/install.bat
tools/msbuild/uninstall.bat

index 393b22a72cc640b2b93a787af5df1f2fc2521d12..860ed22526c1a543665b255e3c6a8469ad49da2c 100644 (file)
@@ -1,10 +1,20 @@
 if (WIN32)
-  set(prop_file "Microsoft.Cpp.Win32.llvm.props")
+  set(prop_file_in "Microsoft.Cpp.Win32.llvm.props.in")
+  set(prop_file_v100 "Microsoft.Cpp.Win32.LLVM-vs2010.props")
+  set(prop_file_v110 "Microsoft.Cpp.Win32.LLVM-vs2012.props")
 
   # CPack will install a registry key in this format that we wish to reference.
   set(REG_KEY "${CMAKE_PROJECT_NAME} ${CPACK_PACKAGE_VERSION}")
-  configure_file(${prop_file}.in ${prop_file})
-  install(FILES "${CMAKE_CURRENT_BINARY_DIR}/${prop_file}" DESTINATION tools/msbuild)
+
+  set(VS_VERSION "v100")
+  configure_file(${prop_file_in} ${prop_file_v100})
+  set(VS_VERSION "v110")
+  configure_file(${prop_file_in} ${prop_file_v110})
+
+  set(REG_KEY)
+  set(VS_VERSION)
+  install(FILES "${CMAKE_CURRENT_BINARY_DIR}/${prop_file_v100}" DESTINATION tools/msbuild)
+  install(FILES "${CMAKE_CURRENT_BINARY_DIR}/${prop_file_v110}" DESTINATION tools/msbuild)
 
   install(DIRECTORY .
     DESTINATION tools/msbuild
@@ -13,4 +23,4 @@ if (WIN32)
     PATTERN "*.bat"
     PATTERN ".svn" EXCLUDE
     )
-endif()  
+endif()
diff --git a/tools/msbuild/Microsoft.Cpp.Win32.LLVM-vs2010.targets b/tools/msbuild/Microsoft.Cpp.Win32.LLVM-vs2010.targets
new file mode 100644 (file)
index 0000000..df41a84
--- /dev/null
@@ -0,0 +1,2 @@
+<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">\r
+</Project>\r
diff --git a/tools/msbuild/Microsoft.Cpp.Win32.LLVM-vs2012.targets b/tools/msbuild/Microsoft.Cpp.Win32.LLVM-vs2012.targets
new file mode 100644 (file)
index 0000000..f7432f2
--- /dev/null
@@ -0,0 +1,3 @@
+<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">\r
+  <Import Project="$(VCTargetsPath)\Microsoft.CppCommon.targets" />\r
+</Project>\r
index 3020d793f92a8a68f89107a45a45910cde86da44..07e931f95fa190a8f6860ebc79f7e150d3d08420 100644 (file)
@@ -1,5 +1,5 @@
 <Project xmlns="http://schemas.microsoft.com/developer/msbuild/2003">  \r
-  <Import Project="$(VCTargetsPath)\Platforms\$(Platform)\PlatformToolsets\v100\Microsoft.Cpp.$(Platform).v100.props"/>\r
+  <Import Project="$(VCTargetsPath)\Platforms\$(Platform)\PlatformToolsets\@VS_VERSION@\Microsoft.Cpp.$(Platform).@VS_VERSION@.props"/>\r
 \r
   <PropertyGroup>\r
     <LLVMInstallDir>$(Registry:HKEY_LOCAL_MACHINE\SOFTWARE\LLVM\@REG_KEY@)</LLVMInstallDir>\r
diff --git a/tools/msbuild/Microsoft.Cpp.Win32.llvm.targets b/tools/msbuild/Microsoft.Cpp.Win32.llvm.targets
deleted file mode 100644 (file)
index df41a84..0000000
+++ /dev/null
@@ -1,2 +0,0 @@
-<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">\r
-</Project>\r
index db11c863538939d15d5280482e9f78533e0a9996..2d5af629afff6d6192f4ac51c92d78c31bd2155e 100644 (file)
@@ -1,28 +1,44 @@
 @echo off\r
 \r
 echo Installing MSVC integration...\r
+set SUCCESS=0\r
 \r
 REM Change to the directory of this batch file.\r
 cd /d %~dp0\r
 \r
 REM Search for the MSBuild toolsets directory.\r
 SET D="%ProgramFiles%\MSBuild\Microsoft.Cpp\v4.0\Platforms\Win32\PlatformToolsets"\r
-IF EXIST %D% GOTO FOUND_MSBUILD\r
+IF EXIST %D% GOTO FOUND_V100\r
 SET D="%ProgramFiles(x86)%\MSBuild\Microsoft.Cpp\v4.0\Platforms\Win32\PlatformToolsets"\r
-IF EXIST %D% GOTO FOUND_MSBUILD\r
+IF EXIST %D% GOTO FOUND_V100\r
 \r
-echo Failed to find MSBuild toolsets directory.\r
-goto FAILED\r
+:TRY_V110\r
+SET D="%ProgramFiles%\MSBuild\Microsoft.Cpp\v4.0\V110\Platforms\Win32\PlatformToolsets"\r
+IF EXIST %D% GOTO FOUND_V110\r
+SET D="%ProgramFiles(x86)%\MSBuild\Microsoft.Cpp\v4.0\V110\Platforms\Win32\PlatformToolsets"\r
+IF EXIST %D% GOTO FOUND_V110\r
+\r
+IF NOT SUCCESS == 1 echo Failed to find MSBuild toolsets directory.\r
+IF NOT SUCCESS == 1 goto FAILED\r
 \r
-:FOUND_MSBUILD\r
-IF NOT EXIST %D%\llvm mkdir %D%\llvm\r
-IF NOT %ERRORLEVEL% == 0 GOTO FAILED\r
 \r
-copy Microsoft.Cpp.Win32.llvm.props %D%\llvm\r
+:FOUND_V100\r
+IF NOT EXIST %D%\LLVM-vs2010 mkdir %D%\LLVM-vs2010\r
+IF NOT %ERRORLEVEL% == 0 GOTO FAILED\r
+copy Microsoft.Cpp.Win32.LLVM-vs2010.props %D%\LLVM-vs2010\r
 IF NOT %ERRORLEVEL% == 0 GOTO FAILED\r
-copy Microsoft.Cpp.Win32.llvm.targets %D%\llvm\r
+copy Microsoft.Cpp.Win32.LLVM-vs2010.targets %D%\LLVM-vs2010\r
 IF NOT %ERRORLEVEL% == 0 GOTO FAILED\r
+set SUCCESS=1\r
+GOTO TRY_V110\r
 \r
+:FOUND_V110\r
+IF NOT EXIST %D%\LLVM-vs2012 mkdir %D%\LLVM-vs2012\r
+IF NOT %ERRORLEVEL% == 0 GOTO FAILED\r
+copy Microsoft.Cpp.Win32.LLVM-vs2012.props %D%\LLVM-vs2012\r
+IF NOT %ERRORLEVEL% == 0 GOTO FAILED\r
+copy Microsoft.Cpp.Win32.LLVM-vs2012.targets %D%\LLVM-vs2012\r
+IF NOT %ERRORLEVEL% == 0 GOTO FAILED\r
 echo Done!\r
 goto END\r
 \r
index 8bc304e0b828551bd4e22d7c7ef7908f042b4dd7..c6972397e73885ded4ef71b904da13dbe333f51f 100644 (file)
@@ -5,30 +5,24 @@ echo Uninstalling MSVC integration...
 REM CD to the directory of this batch file.\r
 cd /d %~dp0\r
 \r
-REM Search for the MSBuild toolsets directory.\r
 SET D="%ProgramFiles%\MSBuild\Microsoft.Cpp\v4.0\Platforms\Win32\PlatformToolsets"\r
-IF EXIST %D% GOTO FOUND_MSBUILD\r
-SET D="%ProgramFiles(x86)%\MSBuild\Microsoft.Cpp\v4.0\Platforms\Win32\PlatformToolsets"\r
-IF EXIST %D% GOTO FOUND_MSBUILD\r
+IF EXIST %D%\LLVM-vs2010 del %D%\LLVM-vs2010\Microsoft.Cpp.Win32.LLVM-vs2010.props\r
+IF EXIST %D%\LLVM-vs2010 del %D%\LLVM-vs2010\Microsoft.Cpp.Win32.LLVM-vs2010.targets\r
+IF EXIST %D%\LLVM-vs2010 rmdir %D%\LLVM-vs2010\r
 \r
-echo Failed to find MSBuild toolsets directory.\r
-goto FAILED\r
+SET D="%ProgramFiles(x86)%\MSBuild\Microsoft.Cpp\v4.0\Platforms\Win32\PlatformToolsets"\r
+IF EXIST %D%\LLVM-vs2010 del %D%\LLVM-vs2010\Microsoft.Cpp.Win32.LLVM-vs2010.props\r
+IF EXIST %D%\LLVM-vs2010 del %D%\LLVM-vs2010\Microsoft.Cpp.Win32.LLVM-vs2010.targets\r
+IF EXIST %D%\LLVM-vs2010 rmdir %D%\LLVM-vs2010\r
 \r
-:FOUND_MSBUILD\r
+SET D="%ProgramFiles%\MSBuild\Microsoft.Cpp\v4.0\V110\Platforms\Win32\PlatformToolsets"\r
+IF EXIST %D%\LLVM-vs2012 del %D%\LLVM-vs2012\Microsoft.Cpp.Win32.LLVM-vs2012.props\r
+IF EXIST %D%\LLVM-vs2012 del %D%\LLVM-vs2012\Microsoft.Cpp.Win32.LLVM-vs2012.targets\r
+IF EXIST %D%\LLVM-vs2012 rmdir %D%\LLVM-vs2012\r
 \r
-del %D%\llvm\Microsoft.Cpp.Win32.llvm.props\r
-IF NOT %ERRORLEVEL% == 0 GOTO FAILED\r
-del %D%\llvm\Microsoft.Cpp.Win32.llvm.targets\r
-IF NOT %ERRORLEVEL% == 0 GOTO FAILED\r
-rmdir %D%\llvm\r
-IF NOT %ERRORLEVEL% == 0 GOTO FAILED\r
+SET D="%ProgramFiles(x86)%\MSBuild\Microsoft.Cpp\v4.0\V110\Platforms\Win32\PlatformToolsets"\r
+IF EXIST %D%\LLVM-vs2012 del %D%\LLVM-vs2012\Microsoft.Cpp.Win32.LLVM-vs2012.props\r
+IF EXIST %D%\LLVM-vs2012 del %D%\LLVM-vs2012\Microsoft.Cpp.Win32.LLVM-vs2012.targets\r
+IF EXIST %D%\LLVM-vs2012 rmdir %D%\LLVM-vs2012\r
 \r
 echo Done!\r
-goto END\r
-\r
-:FAILED\r
-echo MSVC integration uninstall failed.\r
-pause\r
-goto END\r
-\r
-:END\r