install.ps1 2.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263
  1. $ErrorActionPreference = "Stop"
  2. try {
  3. & git submodule --quiet update --init --recursive
  4. Write-Host -ForegroundColor Green "`n### Installing CMake and python ###`n"
  5. & cinst --no-progress cmake python2
  6. & C:\Python27\python.exe -m pip install --upgrade pip
  7. & C:\Python27\Scripts\pip.exe install six
  8. Write-Host -ForegroundColor Green "`n### Installing sphinx ###`n"
  9. & C:\Python27\Scripts\pip.exe install --user sphinx sphinx_rtd_theme
  10. Write-Host -ForegroundColor Green "`n### Installing Miktex ###`n"
  11. if (-not (Test-Path "c:\miktex\texmfs\install\miktex\bin\pdflatex.exe")) {
  12. & appveyor DownloadFile https://ftp.uni-erlangen.de/mirrors/CTAN/systems/win32/miktex/setup/windows-x86/miktex-portable.exe
  13. & 7z x miktex-portable.exe -oc:\miktex -bso0 -bsp0
  14. # Remove some big files to reduce size to be cached
  15. Remove-Item -Path c:\miktex\texmfs\install\doc -Recurse
  16. Remove-Item -Path c:\miktex\texmfs\install\miktex\bin\biber.exe
  17. Remove-Item -Path c:\miktex\texmfs\install\miktex\bin\a5toa4.exe
  18. }
  19. Write-Host -ForegroundColor Green "`n### Installing graphviz ###`n"
  20. & cinst --no-progress graphviz
  21. if ($LASTEXITCODE -and $LASTEXITCODE -ne 0) {
  22. Write-Host -ForegroundColor Red "`n`n*** Installing graphviz failed. Exiting ... ***"
  23. exit $LASTEXITCODE
  24. }
  25. Write-Host -ForegroundColor Green "`n### Installing mbedtls ###`n"
  26. if ($env:CC_SHORTNAME -eq "mingw") {
  27. & C:\msys64\usr\bin\pacman --noconfirm -S mingw-w64-x86_64-mbedtls
  28. } elseif ($env:CC_SHORTNAME -eq "vs2015") {
  29. # we need the static version, since open62541 is built with /MT
  30. # vcpkg currently only supports VS2015 and newer builds
  31. & vcpkg install mbedtls:x86-windows-static
  32. }
  33. if ($LASTEXITCODE -and $LASTEXITCODE -ne 0) {
  34. Write-Host -ForegroundColor Red "`n`n*** Installing mbedtls failed. Exiting ... ***"
  35. exit $LASTEXITCODE
  36. }
  37. if ($env:CC_SHORTNAME -eq "vs2015") {
  38. Write-Host -ForegroundColor Green "`n### Installing libcheck ###`n"
  39. & appveyor DownloadFile https://github.com/Pro/check/releases/download/0.12.0_win/check.zip
  40. & 7z x check.zip -oc:\ -bso0 -bsp0
  41. Write-Host -ForegroundColor Green "`n### Installing DrMemory ###`n"
  42. & cinst --no-progress drmemory.portable
  43. }
  44. } catch {
  45. # Print a detailed error message
  46. $FullException = ($_.Exception|format-list -force) | Out-String
  47. Write-Host -ForegroundColor Red "`n------------------ Exception ------------------`n$FullException`n"
  48. [Console]::Out.Flush()
  49. # Wait a bit to make sure appveyor shows the error message
  50. Start-Sleep 10
  51. throw
  52. }