[llvm] r189434 - cmake: Add msbuild integration to the install

Hans Wennborg hans at hanshq.net
Tue Aug 27 18:19:26 PDT 2013


Author: hans
Date: Tue Aug 27 20:19:26 2013
New Revision: 189434

URL: http://llvm.org/viewvc/llvm-project?rev=189434&view=rev
Log:
cmake: Add msbuild integration to the install

This adds the msbuild integration files to the install, provides batch scripts
for (un)installing it in a convenient way, and hooks up the nsis installer to
run those scripts.

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

Added:
    llvm/trunk/tools/msbuild/CMakeLists.txt
    llvm/trunk/tools/msbuild/install.bat
    llvm/trunk/tools/msbuild/uninstall.bat
Modified:
    llvm/trunk/CMakeLists.txt

Modified: llvm/trunk/CMakeLists.txt
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/CMakeLists.txt?rev=189434&r1=189433&r2=189434&view=diff
==============================================================================
--- llvm/trunk/CMakeLists.txt (original)
+++ llvm/trunk/CMakeLists.txt Tue Aug 27 20:19:26 2013
@@ -512,6 +512,11 @@ set(CPACK_RESOURCE_FILE_LICENSE "${LLVM_
 if(WIN32 AND NOT UNIX)
   set(CPACK_PACKAGE_ICON "${LLVM_MAIN_SRC_DIR}\\\\cmake\\\\nsis_logo.bmp")
   set(CPACK_NSIS_MODIFY_PATH "ON")
+  set(CPACK_NSIS_ENABLE_UNINSTALL_BEFORE_INSTALL "ON")
+  set(CPACK_NSIS_EXTRA_INSTALL_COMMANDS
+    "ExecWait '$INSTDIR/tools/msbuild/install.bat'")
+  set(CPACK_NSIS_EXTRA_UNINSTALL_COMMANDS
+    "ExecWait '$INSTDIR/tools/msbuild/uninstall.bat'")
 endif()
 include(CPack)
 

Added: llvm/trunk/tools/msbuild/CMakeLists.txt
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/tools/msbuild/CMakeLists.txt?rev=189434&view=auto
==============================================================================
--- llvm/trunk/tools/msbuild/CMakeLists.txt (added)
+++ llvm/trunk/tools/msbuild/CMakeLists.txt Tue Aug 27 20:19:26 2013
@@ -0,0 +1,10 @@
+if (WIN32)
+  install(DIRECTORY .
+    DESTINATION tools/msbuild
+    FILES_MATCHING
+    PATTERN "*.targets"
+    PATTERN "*.props"
+    PATTERN "*.bat"
+    PATTERN ".svn" EXCLUDE
+    )
+endif()  

Added: llvm/trunk/tools/msbuild/install.bat
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/tools/msbuild/install.bat?rev=189434&view=auto
==============================================================================
--- llvm/trunk/tools/msbuild/install.bat (added)
+++ llvm/trunk/tools/msbuild/install.bat Tue Aug 27 20:19:26 2013
@@ -0,0 +1,34 @@
+ at echo off
+
+echo Installing MSVC integration...
+
+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
+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 NOT EXIST %D%\llvm mkdir %D%\llvm
+IF NOT %ERRORLEVEL% == 0 GOTO FAILED
+
+copy Microsoft.Cpp.Win32.llvm.props %D%\llvm
+IF NOT %ERRORLEVEL% == 0 GOTO FAILED
+copy Microsoft.Cpp.Win32.llvm.targets %D%\llvm
+IF NOT %ERRORLEVEL% == 0 GOTO FAILED
+
+echo Done!
+goto END
+
+:FAILED
+echo MSVC integration install failed.
+pause
+goto END
+
+:END

Added: llvm/trunk/tools/msbuild/uninstall.bat
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/tools/msbuild/uninstall.bat?rev=189434&view=auto
==============================================================================
--- llvm/trunk/tools/msbuild/uninstall.bat (added)
+++ llvm/trunk/tools/msbuild/uninstall.bat Tue Aug 27 20:19:26 2013
@@ -0,0 +1,34 @@
+ at echo off
+
+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
+
+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
+
+echo Done!
+goto END
+
+:FAILED
+echo MSVC integration uninstall failed.
+pause
+goto END
+
+:END





More information about the llvm-commits mailing list