appveyor.yml 7.5 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. if ($env:BUILD_TYPE -eq 'msvc') {
  36. # redirect stderr and change the exit code to prevent powershell from cancelling the build if cmake prints a warning
  37. cmd /C 'cmake -G "Visual Studio 15 2017 Win64" -DYUZU_USE_BUNDLED_QT=1 -DYUZU_USE_BUNDLED_SDL2=1 -DYUZU_USE_BUNDLED_UNICORN=1 .. 2>&1 && exit 0'
  38. } else {
  39. C:\msys64\usr\bin\bash.exe -lc "cmake -G 'MSYS Makefiles' -DYUZU_BUILD_UNICORN=1 -DCMAKE_BUILD_TYPE=Release .. 2>&1"
  40. }
  41. - cd ..
  42. build_script:
  43. - ps: |
  44. if ($env:BUILD_TYPE -eq 'msvc') {
  45. # https://www.appveyor.com/docs/build-phase
  46. msbuild msvc_build/yuzu.sln /maxcpucount /logger:"C:\Program Files\AppVeyor\BuildAgent\Appveyor.MSBuildLogger.dll"
  47. } else {
  48. C:\msys64\usr\bin\bash.exe -lc 'mingw32-make -C mingw_build/ 2>&1'
  49. }
  50. after_build:
  51. - ps: |
  52. $GITDATE = $(git show -s --date=short --format='%ad') -replace "-",""
  53. $GITREV = $(git show -s --format='%h')
  54. # Find out which kind of release we are producing by tag name
  55. if ($env:APPVEYOR_REPO_TAG_NAME) {
  56. $RELEASE_DIST, $RELEASE_VERSION = $env:APPVEYOR_REPO_TAG_NAME.split('-')
  57. } else {
  58. # There is no repo tag - make assumptions
  59. $RELEASE_DIST = "head"
  60. }
  61. if ($env:BUILD_TYPE -eq 'msvc') {
  62. # Where are these spaces coming from? Regardless, let's remove them
  63. $MSVC_BUILD_ZIP = "yuzu-windows-msvc-$GITDATE-$GITREV.zip" -replace " ", ""
  64. $MSVC_BUILD_PDB = "yuzu-windows-msvc-$GITDATE-$GITREV-debugsymbols.zip" -replace " ", ""
  65. $MSVC_SEVENZIP = "yuzu-windows-msvc-$GITDATE-$GITREV.7z" -replace " ", ""
  66. # set the build names as env vars so the artifacts can upload them
  67. $env:BUILD_ZIP = $MSVC_BUILD_ZIP
  68. $env:BUILD_SYMBOLS = $MSVC_BUILD_PDB
  69. $env:BUILD_UPDATE = $MSVC_SEVENZIP
  70. $BUILD_DIR = ".\msvc_build\bin\Release"
  71. # Make a debug symbol upload
  72. mkdir pdb
  73. Get-ChildItem "$BUILD_DIR\" -Recurse -Filter "*.pdb" | Copy-Item -destination .\pdb
  74. 7z a -tzip $MSVC_BUILD_PDB .\pdb\*.pdb
  75. rm "$BUILD_DIR\*.pdb"
  76. mkdir $RELEASE_DIST
  77. # get rid of extra exes by copying everything over, then deleting all the exes, then copying just the exes we want
  78. Copy-Item "$BUILD_DIR\*" -Destination $RELEASE_DIST -Recurse
  79. rm "$RELEASE_DIST\*.exe"
  80. Get-ChildItem "$BUILD_DIR" -Recurse -Filter "yuzu*.exe" | Copy-Item -destination $RELEASE_DIST
  81. Copy-Item .\license.txt -Destination $RELEASE_DIST
  82. Copy-Item .\README.md -Destination $RELEASE_DIST
  83. 7z a -tzip $MSVC_BUILD_ZIP $RELEASE_DIST\*
  84. 7z a $MSVC_SEVENZIP $RELEASE_DIST
  85. } else {
  86. $MINGW_BUILD_ZIP = "yuzu-windows-mingw-$GITDATE-$GITREV.zip" -replace " ", ""
  87. $MINGW_SEVENZIP = "yuzu-windows-mingw-$GITDATE-$GITREV.7z" -replace " ", ""
  88. # not going to bother adding separate debug symbols for mingw, so just upload a README for it
  89. # if someone wants to add them, change mingw to compile with -g and use objdump and strip to separate the symbols from the binary
  90. $MINGW_NO_DEBUG_SYMBOLS = "README_No_Debug_Symbols.txt"
  91. Set-Content -Path $MINGW_NO_DEBUG_SYMBOLS -Value "This is a workaround for Appveyor since msvc has debug symbols but mingw doesnt" -Force
  92. # store the build information in env vars so we can use them as artifacts
  93. $env:BUILD_ZIP = $MINGW_BUILD_ZIP
  94. $env:BUILD_SYMBOLS = $MINGW_NO_DEBUG_SYMBOLS
  95. $env:BUILD_UPDATE = $MINGW_SEVENZIP
  96. $CMAKE_SOURCE_DIR = "$env:APPVEYOR_BUILD_FOLDER"
  97. $CMAKE_BINARY_DIR = "$CMAKE_SOURCE_DIR/mingw_build/bin"
  98. $RELEASE_DIST = $RELEASE_DIST + "-mingw"
  99. mkdir $RELEASE_DIST
  100. mkdir $RELEASE_DIST/platforms
  101. # copy the compiled binaries and other release files to the release folder
  102. Get-ChildItem "$CMAKE_BINARY_DIR" -Filter "yuzu*.exe" | Copy-Item -destination $RELEASE_DIST
  103. Copy-Item -path "$CMAKE_SOURCE_DIR/license.txt" -destination $RELEASE_DIST
  104. Copy-Item -path "$CMAKE_SOURCE_DIR/README.md" -destination $RELEASE_DIST
  105. # copy all the dll dependencies to the release folder
  106. # hardcoded list because we don't build static and determining the list of dlls from the binary is a pain.
  107. $MingwDLLs = "Qt5Core.dll","Qt5Widgets.dll","Qt5Gui.dll","Qt5OpenGL.dll",
  108. # QT dll dependencies
  109. "libbz2-*.dll","libicudt*.dll","libicuin*.dll","libicuuc*.dll","libffi-*.dll",
  110. "libfreetype-*.dll","libglib-*.dll","libgobject-*.dll","libgraphite2.dll","libiconv-*.dll",
  111. "libharfbuzz-*.dll","libintl-*.dll","libpcre-*.dll","libpcre2-16-*.dll","libpcre16-*.dll","libpng16-*.dll",
  112. # Runtime/Other dependencies
  113. "libgcc_s_seh-*.dll","libstdc++-*.dll","libwinpthread-*.dll","SDL2.dll","zlib1.dll"
  114. foreach ($file in $MingwDLLs) {
  115. Copy-Item -path "C:/msys64/mingw64/bin/$file" -force -destination "$RELEASE_DIST"
  116. }
  117. # the above list copies a few extra debug dlls that aren't needed (thanks globbing patterns!)
  118. # so we can remove them by hardcoding another list of extra dlls to remove
  119. $DebugDLLs = "libicudtd*.dll","libicuind*.dll","libicuucd*.dll"
  120. foreach ($file in $DebugDLLs) {
  121. Remove-Item -path "$RELEASE_DIST/$file"
  122. }
  123. # copy the qt windows plugin dll to platforms
  124. Copy-Item -path "C:/msys64/mingw64/share/qt5/plugins/platforms/qwindows.dll" -force -destination "$RELEASE_DIST/platforms"
  125. 7z a -tzip $MINGW_BUILD_ZIP $RELEASE_DIST\*
  126. 7z a $MINGW_SEVENZIP $RELEASE_DIST
  127. }
  128. test_script:
  129. - cd %BUILD_TYPE%_build
  130. - ps: |
  131. if ($env:BUILD_TYPE -eq 'msvc') {
  132. ctest -VV -C Release
  133. } else {
  134. C:\msys64\usr\bin\bash.exe -lc "ctest -VV -C Release"
  135. }
  136. - cd ..
  137. artifacts:
  138. - path: $(BUILD_ZIP)
  139. name: build
  140. type: zip
  141. - path: $(BUILD_SYMBOLS)
  142. name: debugsymbols
  143. - path: $(BUILD_UPDATE)
  144. name: update
  145. deploy:
  146. provider: GitHub
  147. release: $(appveyor_repo_tag_name)
  148. auth_token:
  149. secure: QqePPnXbkzmXct5c8hZ2X5AbsthbI6cS1Sr+VBzcD8oUOIjfWJJKXVAQGUbQAbb0
  150. artifact: update,build
  151. draft: false
  152. prerelease: false
  153. on:
  154. appveyor_repo_tag: true