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
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@189434
91177308-0d34-0410-b5e6-
96231b3b80d8
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)
--- /dev/null
+if (WIN32)
+ install(DIRECTORY .
+ DESTINATION tools/msbuild
+ FILES_MATCHING
+ PATTERN "*.targets"
+ PATTERN "*.props"
+ PATTERN "*.bat"
+ PATTERN ".svn" EXCLUDE
+ )
+endif()
--- /dev/null
+@echo off\r
+\r
+echo Installing MSVC integration...\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
+SET D="%ProgramFiles(x86)%\MSBuild\Microsoft.Cpp\v4.0\Platforms\Win32\PlatformToolsets"\r
+IF EXIST %D% GOTO FOUND_MSBUILD\r
+\r
+echo Failed to find MSBuild toolsets directory.\r
+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
+IF NOT %ERRORLEVEL% == 0 GOTO FAILED\r
+copy Microsoft.Cpp.Win32.llvm.targets %D%\llvm\r
+IF NOT %ERRORLEVEL% == 0 GOTO FAILED\r
+\r
+echo Done!\r
+goto END\r
+\r
+:FAILED\r
+echo MSVC integration install failed.\r
+pause\r
+goto END\r
+\r
+:END\r
--- /dev/null
+@echo off\r
+\r
+echo Uninstalling MSVC integration...\r
+\r
+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
+\r
+echo Failed to find MSBuild toolsets directory.\r
+goto FAILED\r
+\r
+:FOUND_MSBUILD\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
+\r
+echo Done!\r
+goto END\r
+\r
+:FAILED\r
+echo MSVC integration uninstall failed.\r
+pause\r
+goto END\r
+\r
+:END\r