[llvm] r190173 - msbuild integration: provide separate files for VS2010 and VS2012

Hans Wennborg hans at hanshq.net
Fri Sep 6 10:05:46 PDT 2013


Author: hans
Date: Fri Sep  6 12:05:46 2013
New Revision: 190173

URL: http://llvm.org/viewvc/llvm-project?rev=190173&view=rev
Log:
msbuild integration: provide separate files for VS2010 and VS2012

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

Added:
    llvm/trunk/tools/msbuild/Microsoft.Cpp.Win32.LLVM-vs2010.targets
      - copied, changed from r190165, llvm/trunk/tools/msbuild/Microsoft.Cpp.Win32.llvm.targets
    llvm/trunk/tools/msbuild/Microsoft.Cpp.Win32.LLVM-vs2012.targets
      - copied, changed from r190165, llvm/trunk/tools/msbuild/Microsoft.Cpp.Win32.llvm.targets
Removed:
    llvm/trunk/tools/msbuild/Microsoft.Cpp.Win32.llvm.targets
Modified:
    llvm/trunk/tools/msbuild/CMakeLists.txt
    llvm/trunk/tools/msbuild/Microsoft.Cpp.Win32.llvm.props.in
    llvm/trunk/tools/msbuild/install.bat
    llvm/trunk/tools/msbuild/uninstall.bat

Modified: llvm/trunk/tools/msbuild/CMakeLists.txt
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/tools/msbuild/CMakeLists.txt?rev=190173&r1=190172&r2=190173&view=diff
==============================================================================
--- llvm/trunk/tools/msbuild/CMakeLists.txt (original)
+++ llvm/trunk/tools/msbuild/CMakeLists.txt Fri Sep  6 12:05:46 2013
@@ -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()

Copied: llvm/trunk/tools/msbuild/Microsoft.Cpp.Win32.LLVM-vs2010.targets (from r190165, llvm/trunk/tools/msbuild/Microsoft.Cpp.Win32.llvm.targets)
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/tools/msbuild/Microsoft.Cpp.Win32.LLVM-vs2010.targets?p2=llvm/trunk/tools/msbuild/Microsoft.Cpp.Win32.LLVM-vs2010.targets&p1=llvm/trunk/tools/msbuild/Microsoft.Cpp.Win32.llvm.targets&r1=190165&r2=190173&rev=190173&view=diff
==============================================================================
    (empty)

Copied: llvm/trunk/tools/msbuild/Microsoft.Cpp.Win32.LLVM-vs2012.targets (from r190165, llvm/trunk/tools/msbuild/Microsoft.Cpp.Win32.llvm.targets)
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/tools/msbuild/Microsoft.Cpp.Win32.LLVM-vs2012.targets?p2=llvm/trunk/tools/msbuild/Microsoft.Cpp.Win32.LLVM-vs2012.targets&p1=llvm/trunk/tools/msbuild/Microsoft.Cpp.Win32.llvm.targets&r1=190165&r2=190173&rev=190173&view=diff
==============================================================================
--- llvm/trunk/tools/msbuild/Microsoft.Cpp.Win32.llvm.targets (original)
+++ llvm/trunk/tools/msbuild/Microsoft.Cpp.Win32.LLVM-vs2012.targets Fri Sep  6 12:05:46 2013
@@ -1,2 +1,3 @@
 <Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
+  <Import Project="$(VCTargetsPath)\Microsoft.CppCommon.targets" />
 </Project>

Modified: llvm/trunk/tools/msbuild/Microsoft.Cpp.Win32.llvm.props.in
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/tools/msbuild/Microsoft.Cpp.Win32.llvm.props.in?rev=190173&r1=190172&r2=190173&view=diff
==============================================================================
--- llvm/trunk/tools/msbuild/Microsoft.Cpp.Win32.llvm.props.in (original)
+++ llvm/trunk/tools/msbuild/Microsoft.Cpp.Win32.llvm.props.in Fri Sep  6 12:05:46 2013
@@ -1,5 +1,5 @@
 <Project xmlns="http://schemas.microsoft.com/developer/msbuild/2003">  
-  <Import Project="$(VCTargetsPath)\Platforms\$(Platform)\PlatformToolsets\v100\Microsoft.Cpp.$(Platform).v100.props"/>
+  <Import Project="$(VCTargetsPath)\Platforms\$(Platform)\PlatformToolsets\@VS_VERSION@\Microsoft.Cpp.$(Platform). at VS_VERSION@.props"/>
 
   <PropertyGroup>
     <LLVMInstallDir>$(Registry:HKEY_LOCAL_MACHINE\SOFTWARE\LLVM\@REG_KEY@)</LLVMInstallDir>

Removed: llvm/trunk/tools/msbuild/Microsoft.Cpp.Win32.llvm.targets
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/tools/msbuild/Microsoft.Cpp.Win32.llvm.targets?rev=190172&view=auto
==============================================================================
--- llvm/trunk/tools/msbuild/Microsoft.Cpp.Win32.llvm.targets (original)
+++ llvm/trunk/tools/msbuild/Microsoft.Cpp.Win32.llvm.targets (removed)
@@ -1,2 +0,0 @@
-<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
-</Project>

Modified: llvm/trunk/tools/msbuild/install.bat
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/tools/msbuild/install.bat?rev=190173&r1=190172&r2=190173&view=diff
==============================================================================
--- llvm/trunk/tools/msbuild/install.bat (original)
+++ llvm/trunk/tools/msbuild/install.bat Fri Sep  6 12:05:46 2013
@@ -1,28 +1,44 @@
 @echo off
 
 echo Installing MSVC integration...
+set SUCCESS=0
 
 REM Change to the directory of this batch file.
 cd /d %~dp0
 
 REM Search for the MSBuild toolsets directory.
 SET D="%ProgramFiles%\MSBuild\Microsoft.Cpp\v4.0\Platforms\Win32\PlatformToolsets"
-IF EXIST %D% GOTO FOUND_MSBUILD
+IF EXIST %D% GOTO FOUND_V100
 SET D="%ProgramFiles(x86)%\MSBuild\Microsoft.Cpp\v4.0\Platforms\Win32\PlatformToolsets"
-IF EXIST %D% GOTO FOUND_MSBUILD
+IF EXIST %D% GOTO FOUND_V100
 
-echo Failed to find MSBuild toolsets directory.
-goto FAILED
+:TRY_V110
+SET D="%ProgramFiles%\MSBuild\Microsoft.Cpp\v4.0\V110\Platforms\Win32\PlatformToolsets"
+IF EXIST %D% GOTO FOUND_V110
+SET D="%ProgramFiles(x86)%\MSBuild\Microsoft.Cpp\v4.0\V110\Platforms\Win32\PlatformToolsets"
+IF EXIST %D% GOTO FOUND_V110
+
+IF NOT SUCCESS == 1 echo Failed to find MSBuild toolsets directory.
+IF NOT SUCCESS == 1 goto FAILED
 
-:FOUND_MSBUILD
-IF NOT EXIST %D%\llvm mkdir %D%\llvm
-IF NOT %ERRORLEVEL% == 0 GOTO FAILED
 
-copy Microsoft.Cpp.Win32.llvm.props %D%\llvm
+:FOUND_V100
+IF NOT EXIST %D%\LLVM-vs2010 mkdir %D%\LLVM-vs2010
+IF NOT %ERRORLEVEL% == 0 GOTO FAILED
+copy Microsoft.Cpp.Win32.LLVM-vs2010.props %D%\LLVM-vs2010
 IF NOT %ERRORLEVEL% == 0 GOTO FAILED
-copy Microsoft.Cpp.Win32.llvm.targets %D%\llvm
+copy Microsoft.Cpp.Win32.LLVM-vs2010.targets %D%\LLVM-vs2010
 IF NOT %ERRORLEVEL% == 0 GOTO FAILED
+set SUCCESS=1
+GOTO TRY_V110
 
+:FOUND_V110
+IF NOT EXIST %D%\LLVM-vs2012 mkdir %D%\LLVM-vs2012
+IF NOT %ERRORLEVEL% == 0 GOTO FAILED
+copy Microsoft.Cpp.Win32.LLVM-vs2012.props %D%\LLVM-vs2012
+IF NOT %ERRORLEVEL% == 0 GOTO FAILED
+copy Microsoft.Cpp.Win32.LLVM-vs2012.targets %D%\LLVM-vs2012
+IF NOT %ERRORLEVEL% == 0 GOTO FAILED
 echo Done!
 goto END
 

Modified: llvm/trunk/tools/msbuild/uninstall.bat
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/tools/msbuild/uninstall.bat?rev=190173&r1=190172&r2=190173&view=diff
==============================================================================
--- llvm/trunk/tools/msbuild/uninstall.bat (original)
+++ llvm/trunk/tools/msbuild/uninstall.bat Fri Sep  6 12:05:46 2013
@@ -5,30 +5,24 @@ echo Uninstalling MSVC integration...
 REM CD to the directory of this batch file.
 cd /d %~dp0
 
-REM Search for the MSBuild toolsets directory.
 SET D="%ProgramFiles%\MSBuild\Microsoft.Cpp\v4.0\Platforms\Win32\PlatformToolsets"
-IF EXIST %D% GOTO FOUND_MSBUILD
-SET D="%ProgramFiles(x86)%\MSBuild\Microsoft.Cpp\v4.0\Platforms\Win32\PlatformToolsets"
-IF EXIST %D% GOTO FOUND_MSBUILD
-
-echo Failed to find MSBuild toolsets directory.
-goto FAILED
-
-:FOUND_MSBUILD
+IF EXIST %D%\LLVM-vs2010 del %D%\LLVM-vs2010\Microsoft.Cpp.Win32.LLVM-vs2010.props
+IF EXIST %D%\LLVM-vs2010 del %D%\LLVM-vs2010\Microsoft.Cpp.Win32.LLVM-vs2010.targets
+IF EXIST %D%\LLVM-vs2010 rmdir %D%\LLVM-vs2010
 
-del %D%\llvm\Microsoft.Cpp.Win32.llvm.props
-IF NOT %ERRORLEVEL% == 0 GOTO FAILED
-del %D%\llvm\Microsoft.Cpp.Win32.llvm.targets
-IF NOT %ERRORLEVEL% == 0 GOTO FAILED
-rmdir %D%\llvm
-IF NOT %ERRORLEVEL% == 0 GOTO FAILED
+SET D="%ProgramFiles(x86)%\MSBuild\Microsoft.Cpp\v4.0\Platforms\Win32\PlatformToolsets"
+IF EXIST %D%\LLVM-vs2010 del %D%\LLVM-vs2010\Microsoft.Cpp.Win32.LLVM-vs2010.props
+IF EXIST %D%\LLVM-vs2010 del %D%\LLVM-vs2010\Microsoft.Cpp.Win32.LLVM-vs2010.targets
+IF EXIST %D%\LLVM-vs2010 rmdir %D%\LLVM-vs2010
+
+SET D="%ProgramFiles%\MSBuild\Microsoft.Cpp\v4.0\V110\Platforms\Win32\PlatformToolsets"
+IF EXIST %D%\LLVM-vs2012 del %D%\LLVM-vs2012\Microsoft.Cpp.Win32.LLVM-vs2012.props
+IF EXIST %D%\LLVM-vs2012 del %D%\LLVM-vs2012\Microsoft.Cpp.Win32.LLVM-vs2012.targets
+IF EXIST %D%\LLVM-vs2012 rmdir %D%\LLVM-vs2012
+
+SET D="%ProgramFiles(x86)%\MSBuild\Microsoft.Cpp\v4.0\V110\Platforms\Win32\PlatformToolsets"
+IF EXIST %D%\LLVM-vs2012 del %D%\LLVM-vs2012\Microsoft.Cpp.Win32.LLVM-vs2012.props
+IF EXIST %D%\LLVM-vs2012 del %D%\LLVM-vs2012\Microsoft.Cpp.Win32.LLVM-vs2012.targets
+IF EXIST %D%\LLVM-vs2012 rmdir %D%\LLVM-vs2012
 
 echo Done!
-goto END
-
-:FAILED
-echo MSVC integration uninstall failed.
-pause
-goto END
-
-:END





More information about the llvm-commits mailing list