appveyor.yml 7.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173
  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: mingw
  14. - BUILD_TYPE: msvc
  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-curl",
  26. "mingw64/mingw-w64-x86_64-SDL2"
  27. # redirect err to null to prevent warnings from becoming errors
  28. # workaround to prevent pacman from failing due to cyclical dependencies
  29. C:\msys64\usr\bin\bash -lc "pacman --noconfirm -S mingw64/mingw-w64-x86_64-freetype mingw64/mingw-w64-x86_64-fontconfig" 2> $null
  30. C:\msys64\usr\bin\bash -lc "pacman --noconfirm -S $dependencies" 2> $null
  31. }
  32. before_build:
  33. - mkdir %BUILD_TYPE%_build
  34. - cd %BUILD_TYPE%_build
  35. - ps: |
  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 -DCMAKE_USE_OPENSSL=0 .. 2>&1 && exit 0'
  39. } else {
  40. C:\msys64\usr\bin\bash.exe -lc "cmake -G 'MSYS Makefiles' -DUSE_SYSTEM_CURL=1 -DYUZU_USE_BUNDLED_CURL=1 -DCMAKE_BUILD_TYPE=Release .. 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. 7z a -tzip $MSVC_BUILD_PDB .\msvc_build\bin\release\*.pdb
  72. rm .\msvc_build\bin\release\*.pdb
  73. mkdir $RELEASE_DIST
  74. Copy-Item .\msvc_build\bin\release\* -Destination $RELEASE_DIST -Recurse
  75. Copy-Item .\license.txt -Destination $RELEASE_DIST
  76. Copy-Item .\README.md -Destination $RELEASE_DIST
  77. 7z a -tzip $MSVC_BUILD_ZIP $RELEASE_DIST\*
  78. 7z a $MSVC_SEVENZIP $RELEASE_DIST
  79. } else {
  80. $MINGW_BUILD_ZIP = "yuzu-windows-mingw-$GITDATE-$GITREV.zip" -replace " ", ""
  81. $MINGW_SEVENZIP = "yuzu-windows-mingw-$GITDATE-$GITREV.7z" -replace " ", ""
  82. # not going to bother adding separate debug symbols for mingw, so just upload a README for it
  83. # if someone wants to add them, change mingw to compile with -g and use objdump and strip to separate the symbols from the binary
  84. $MINGW_NO_DEBUG_SYMBOLS = "README_No_Debug_Symbols.txt"
  85. Set-Content -Path $MINGW_NO_DEBUG_SYMBOLS -Value "This is a workaround for Appveyor since msvc has debug symbols but mingw doesnt" -Force
  86. # store the build information in env vars so we can use them as artifacts
  87. $env:BUILD_ZIP = $MINGW_BUILD_ZIP
  88. $env:BUILD_SYMBOLS = $MINGW_NO_DEBUG_SYMBOLS
  89. $env:BUILD_UPDATE = $MINGW_SEVENZIP
  90. $CMAKE_SOURCE_DIR = "$env:APPVEYOR_BUILD_FOLDER"
  91. $CMAKE_BINARY_DIR = "$CMAKE_SOURCE_DIR/mingw_build"
  92. $RELEASE_DIST = $RELEASE_DIST + "-mingw"
  93. mkdir $RELEASE_DIST
  94. mkdir $RELEASE_DIST/platforms
  95. # copy the compiled binaries and other release files to the release folder
  96. Get-ChildItem "$CMAKE_BINARY_DIR" -Recurse -Filter "yuzu*.exe" | Copy-Item -destination $RELEASE_DIST
  97. # copy the libcurl dll
  98. Get-ChildItem "$CMAKE_BINARY_DIR" -Recurse -Filter "libcurl.dll" | Copy-Item -destination $RELEASE_DIST
  99. Copy-Item -path "$CMAKE_SOURCE_DIR/license.txt" -destination $RELEASE_DIST
  100. Copy-Item -path "$CMAKE_SOURCE_DIR/README.md" -destination $RELEASE_DIST
  101. # copy all the dll dependencies to the release folder
  102. # hardcoded list because we don't build static and determining the list of dlls from the binary is a pain.
  103. $MingwDLLs = "Qt5Core.dll","Qt5Widgets.dll","Qt5Gui.dll","Qt5OpenGL.dll",
  104. # QT dll dependencies
  105. "libbz2-*.dll","libicudt*.dll","libicuin*.dll","libicuuc*.dll","libffi-*.dll",
  106. "libfreetype-*.dll","libglib-*.dll","libgobject-*.dll","libgraphite2.dll","libiconv-*.dll",
  107. "libharfbuzz-*.dll","libintl-*.dll","libpcre-*.dll","libpcre16-*.dll","libpng16-*.dll",
  108. # Runtime/Other dependencies
  109. "libgcc_s_seh-*.dll","libstdc++-*.dll","libwinpthread-*.dll","SDL2.dll","zlib1.dll"
  110. foreach ($file in $MingwDLLs) {
  111. Copy-Item -path "C:/msys64/mingw64/bin/$file" -force -destination "$RELEASE_DIST"
  112. }
  113. # the above list copies a few extra debug dlls that aren't needed (thanks globbing patterns!)
  114. # so we can remove them by hardcoding another list of extra dlls to remove
  115. $DebugDLLs = "libicudtd*.dll","libicuind*.dll","libicuucd*.dll"
  116. foreach ($file in $DebugDLLs) {
  117. Remove-Item -path "$RELEASE_DIST/$file"
  118. }
  119. # copy the qt windows plugin dll to platforms
  120. Copy-Item -path "C:/msys64/mingw64/share/qt5/plugins/platforms/qwindows.dll" -force -destination "$RELEASE_DIST/platforms"
  121. 7z a -tzip $MINGW_BUILD_ZIP $RELEASE_DIST\*
  122. 7z a $MINGW_SEVENZIP $RELEASE_DIST
  123. }
  124. test_script:
  125. - cd %BUILD_TYPE%_build
  126. - ps: |
  127. if ($env:BUILD_TYPE -eq 'msvc') {
  128. ctest -VV -C Release
  129. } else {
  130. C:\msys64\usr\bin\bash.exe -lc "ctest -VV -C Release"
  131. }
  132. - cd ..
  133. artifacts:
  134. - path: $(BUILD_ZIP)
  135. name: build
  136. type: zip
  137. - path: $(BUILD_SYMBOLS)
  138. name: debugsymbols
  139. - path: $(BUILD_UPDATE)
  140. name: update
  141. deploy:
  142. provider: GitHub
  143. release: $(appveyor_repo_tag_name)
  144. auth_token:
  145. secure: "dbpsMC/MgPKWFNJCXpQl4cR8FYhepkPLjgNp/pRMktZ8oLKTqPYErfreaIxb/4P1"
  146. artifact: update,build
  147. draft: false
  148. prerelease: false
  149. on:
  150. appveyor_repo_tag: true