appveyor.yml 7.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178
  1. # shallow clone
  2. clone_depth: 10
  3. cache:
  4. - C:\ProgramData\chocolatey\bin -> appveyor.yml
  5. - C:\ProgramData\chocolatey\lib -> appveyor.yml
  6. os: Visual Studio 2017
  7. environment:
  8. # Tell msys2 to add mingw64 to the path
  9. MSYSTEM: MINGW64
  10. # Tell msys2 to inherit the current directory when starting the shell
  11. CHERE_INVOKING: 1
  12. matrix:
  13. - BUILD_TYPE: msvc
  14. - BUILD_TYPE: mingw
  15. platform:
  16. - x64
  17. configuration:
  18. - Release
  19. install:
  20. - git submodule update --init --recursive
  21. - ps: |
  22. if ($env:BUILD_TYPE -eq 'mingw') {
  23. $dependencies = "mingw64/mingw-w64-x86_64-cmake",
  24. "mingw64/mingw-w64-x86_64-qt5",
  25. "mingw64/mingw-w64-x86_64-SDL2"
  26. # redirect err to null to prevent warnings from becoming errors
  27. # workaround to prevent pacman from failing due to cyclical dependencies
  28. C:\msys64\usr\bin\bash -lc "pacman --noconfirm -S mingw64/mingw-w64-x86_64-freetype mingw64/mingw-w64-x86_64-fontconfig" 2> $null
  29. C:\msys64\usr\bin\bash -lc "pacman --noconfirm -S $dependencies" 2> $null
  30. }
  31. before_build:
  32. - mkdir %BUILD_TYPE%_build
  33. - cd %BUILD_TYPE%_build
  34. - ps: |
  35. $COMPAT = if ($env:ENABLE_COMPATIBILITY_REPORTING -eq $null) {0} else {$env:ENABLE_COMPATIBILITY_REPORTING}
  36. if ($env:BUILD_TYPE -eq 'msvc') {
  37. # redirect stderr and change the exit code to prevent powershell from cancelling the build if cmake prints a warning
  38. cmd /C 'cmake -G "Visual Studio 15 2017 Win64" -DYUZU_USE_BUNDLED_QT=1 -DYUZU_USE_BUNDLED_SDL2=1 -DYUZU_USE_BUNDLED_UNICORN=1 -DYUZU_USE_QT_WEB_ENGINE=ON -DENABLE_COMPATIBILITY_LIST_DOWNLOAD=ON -DYUZU_ENABLE_COMPATIBILITY_REPORTING=${COMPAT} -DUSE_DISCORD_PRESENCE=ON .. 2>&1 && exit 0'
  39. } else {
  40. C:\msys64\usr\bin\bash.exe -lc "cmake -G 'MSYS Makefiles' -DYUZU_BUILD_UNICORN=1 -DCMAKE_BUILD_TYPE=Release -DENABLE_COMPATIBILITY_LIST_DOWNLOAD=ON -DYUZU_ENABLE_COMPATIBILITY_REPORTING=${COMPAT} -DUSE_DISCORD_PRESENCE=ON .. 2>&1"
  41. }
  42. - cd ..
  43. build_script:
  44. - ps: |
  45. if ($env:BUILD_TYPE -eq 'msvc') {
  46. # https://www.appveyor.com/docs/build-phase
  47. msbuild msvc_build/yuzu.sln /maxcpucount /logger:"C:\Program Files\AppVeyor\BuildAgent\Appveyor.MSBuildLogger.dll"
  48. } else {
  49. C:\msys64\usr\bin\bash.exe -lc 'mingw32-make -C mingw_build/ 2>&1'
  50. }
  51. after_build:
  52. - ps: |
  53. $GITDATE = $(git show -s --date=short --format='%ad') -replace "-",""
  54. $GITREV = $(git show -s --format='%h')
  55. # Find out which kind of release we are producing by tag name
  56. if ($env:APPVEYOR_REPO_TAG_NAME) {
  57. $RELEASE_DIST, $RELEASE_VERSION = $env:APPVEYOR_REPO_TAG_NAME.split('-')
  58. } else {
  59. # There is no repo tag - make assumptions
  60. $RELEASE_DIST = "head"
  61. }
  62. if ($env:BUILD_TYPE -eq 'msvc') {
  63. # Where are these spaces coming from? Regardless, let's remove them
  64. $MSVC_BUILD_ZIP = "yuzu-windows-msvc-$GITDATE-$GITREV.zip" -replace " ", ""
  65. $MSVC_BUILD_PDB = "yuzu-windows-msvc-$GITDATE-$GITREV-debugsymbols.zip" -replace " ", ""
  66. $MSVC_SEVENZIP = "yuzu-windows-msvc-$GITDATE-$GITREV.7z" -replace " ", ""
  67. # set the build names as env vars so the artifacts can upload them
  68. $env:BUILD_ZIP = $MSVC_BUILD_ZIP
  69. $env:BUILD_SYMBOLS = $MSVC_BUILD_PDB
  70. $env:BUILD_UPDATE = $MSVC_SEVENZIP
  71. $BUILD_DIR = ".\msvc_build\bin\Release"
  72. # Make a debug symbol upload
  73. mkdir pdb
  74. Get-ChildItem "$BUILD_DIR\" -Recurse -Filter "*.pdb" | Copy-Item -destination .\pdb
  75. 7z a -tzip $MSVC_BUILD_PDB .\pdb\*.pdb
  76. rm "$BUILD_DIR\*.pdb"
  77. mkdir $RELEASE_DIST
  78. # get rid of extra exes by copying everything over, then deleting all the exes, then copying just the exes we want
  79. Copy-Item "$BUILD_DIR\*" -Destination $RELEASE_DIST -Recurse
  80. rm "$RELEASE_DIST\*.exe"
  81. Get-ChildItem "$BUILD_DIR" -Recurse -Filter "yuzu*.exe" | Copy-Item -destination $RELEASE_DIST
  82. Get-ChildItem "$BUILD_DIR" -Recurse -Filter "QtWebEngineProcess*.exe" | Copy-Item -destination $RELEASE_DIST
  83. Copy-Item .\license.txt -Destination $RELEASE_DIST
  84. Copy-Item .\README.md -Destination $RELEASE_DIST
  85. 7z a -tzip $MSVC_BUILD_ZIP $RELEASE_DIST\*
  86. 7z a $MSVC_SEVENZIP $RELEASE_DIST
  87. } else {
  88. $MINGW_BUILD_ZIP = "yuzu-windows-mingw-$GITDATE-$GITREV.zip" -replace " ", ""
  89. $MINGW_SEVENZIP = "yuzu-windows-mingw-$GITDATE-$GITREV.7z" -replace " ", ""
  90. # not going to bother adding separate debug symbols for mingw, so just upload a README for it
  91. # if someone wants to add them, change mingw to compile with -g and use objdump and strip to separate the symbols from the binary
  92. $MINGW_NO_DEBUG_SYMBOLS = "README_No_Debug_Symbols.txt"
  93. Set-Content -Path $MINGW_NO_DEBUG_SYMBOLS -Value "This is a workaround for Appveyor since msvc has debug symbols but mingw doesnt" -Force
  94. # store the build information in env vars so we can use them as artifacts
  95. $env:BUILD_ZIP = $MINGW_BUILD_ZIP
  96. $env:BUILD_SYMBOLS = $MINGW_NO_DEBUG_SYMBOLS
  97. $env:BUILD_UPDATE = $MINGW_SEVENZIP
  98. $CMAKE_SOURCE_DIR = "$env:APPVEYOR_BUILD_FOLDER"
  99. $CMAKE_BINARY_DIR = "$CMAKE_SOURCE_DIR/mingw_build/bin"
  100. $RELEASE_DIST = $RELEASE_DIST + "-mingw"
  101. mkdir $RELEASE_DIST
  102. mkdir $RELEASE_DIST/platforms
  103. mkdir $RELEASE_DIST/styles
  104. mkdir $RELEASE_DIST/imageformats
  105. # copy the compiled binaries and other release files to the release folder
  106. Get-ChildItem "$CMAKE_BINARY_DIR" -Filter "yuzu*.exe" | Copy-Item -destination $RELEASE_DIST
  107. Copy-Item -path "$CMAKE_SOURCE_DIR/license.txt" -destination $RELEASE_DIST
  108. Copy-Item -path "$CMAKE_SOURCE_DIR/README.md" -destination $RELEASE_DIST
  109. # copy the qt windows plugin dll to platforms
  110. Copy-Item -path "C:/msys64/mingw64/share/qt5/plugins/platforms/qwindows.dll" -force -destination "$RELEASE_DIST/platforms"
  111. # copy the qt windows vista style dll to platforms
  112. Copy-Item -path "C:/msys64/mingw64/share/qt5/plugins/styles/qwindowsvistastyle.dll" -force -destination "$RELEASE_DIST/styles"
  113. # copy the qt jpeg imageformat dll to platforms
  114. Copy-Item -path "C:/msys64/mingw64/share/qt5/plugins/imageformats/qjpeg.dll" -force -destination "$RELEASE_DIST/imageformats"
  115. # copy all the dll dependencies to the release folder
  116. . "./.appveyor/UtilityFunctions.ps1"
  117. $DLLSearchPath = "C:\msys64\mingw64\bin;$env:PATH"
  118. $MingwDLLs = RecursivelyGetDeps $DLLSearchPath "$RELEASE_DIST\yuzu.exe"
  119. $MingwDLLs += RecursivelyGetDeps $DLLSearchPath "$RELEASE_DIST\yuzu_cmd.exe"
  120. $MingwDLLs += RecursivelyGetDeps $DLLSearchPath "$RELEASE_DIST\imageformats\qjpeg.dll"
  121. Write-Host "Detected the following dependencies:"
  122. Write-Host $MingwDLLs
  123. foreach ($file in $MingwDLLs) {
  124. Copy-Item -path "$file" -force -destination "$RELEASE_DIST"
  125. }
  126. 7z a -tzip $MINGW_BUILD_ZIP $RELEASE_DIST\*
  127. 7z a $MINGW_SEVENZIP $RELEASE_DIST
  128. }
  129. test_script:
  130. - cd %BUILD_TYPE%_build
  131. - ps: |
  132. if ($env:BUILD_TYPE -eq 'msvc') {
  133. ctest -VV -C Release
  134. } else {
  135. C:\msys64\usr\bin\bash.exe -lc "ctest -VV -C Release"
  136. }
  137. - cd ..
  138. artifacts:
  139. - path: $(BUILD_ZIP)
  140. name: build
  141. type: zip
  142. deploy:
  143. provider: GitHub
  144. release: $(appveyor_repo_tag_name)
  145. auth_token:
  146. secure: QqePPnXbkzmXct5c8hZ2X5AbsthbI6cS1Sr+VBzcD8oUOIjfWJJKXVAQGUbQAbb0
  147. artifact: update,build
  148. draft: false
  149. prerelease: false
  150. on:
  151. appveyor_repo_tag: true