[PATCH] cmake: Add msbuild integration to the install
Hans Wennborg
hans at chromium.org
Tue Aug 27 17:19:33 PDT 2013
Hi rnk,
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.
http://llvm-reviews.chandlerc.com/D1537
Files:
CMakeLists.txt
tools/msbuild/CMakeLists.txt
tools/msbuild/install.bat
tools/msbuild/uninstall.bat
Index: CMakeLists.txt
===================================================================
--- CMakeLists.txt
+++ CMakeLists.txt
@@ -512,6 +512,11 @@
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)
Index: tools/msbuild/CMakeLists.txt
===================================================================
--- /dev/null
+++ tools/msbuild/CMakeLists.txt
@@ -0,0 +1,10 @@
+if (WIN32)
+ install(DIRECTORY .
+ DESTINATION tools/msbuild
+ FILES_MATCHING
+ PATTERN "*.targets"
+ PATTERN "*.props"
+ PATTERN "*.bat"
+ PATTERN ".svn" EXCLUDE
+ )
+endif()
Index: tools/msbuild/install.bat
===================================================================
--- /dev/null
+++ tools/msbuild/install.bat
@@ -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
Index: tools/msbuild/uninstall.bat
===================================================================
--- /dev/null
+++ tools/msbuild/uninstall.bat
@@ -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
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D1537.1.patch
Type: text/x-patch
Size: 2967 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20130827/f5cbad06/attachment.bin>
More information about the llvm-commits
mailing list