appveyor.yml 7.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175
  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. mkdir $RELEASE_DIST/styles
  102. # copy the compiled binaries and other release files to the release folder
  103. Get-ChildItem "$CMAKE_BINARY_DIR" -Filter "yuzu*.exe" | Copy-Item -destination $RELEASE_DIST
  104. Copy-Item -path "$CMAKE_SOURCE_DIR/license.txt" -destination $RELEASE_DIST
  105. Copy-Item -path "$CMAKE_SOURCE_DIR/README.md" -destination $RELEASE_DIST
  106. # copy all the dll dependencies to the release folder
  107. . "./.appveyor/UtilityFunctions.ps1"
  108. $DLLSearchPath = "C:\msys64\mingw64\bin;$env:PATH"
  109. $MingwDLLs = RecursivelyGetDeps $DLLSearchPath "$RELEASE_DIST\yuzu.exe"
  110. $MingwDLLs += RecursivelyGetDeps $DLLSearchPath "$RELEASE_DIST\yuzu_cmd.exe"
  111. Write-Host "Detected the following dependencies:"
  112. Write-Host $MingwDLLs
  113. foreach ($file in $MingwDLLs) {
  114. Copy-Item -path "$file" -force -destination "$RELEASE_DIST"
  115. }
  116. # copy the qt windows plugin dll to platforms
  117. Copy-Item -path "C:/msys64/mingw64/share/qt5/plugins/platforms/qwindows.dll" -force -destination "$RELEASE_DIST/platforms"
  118. # copy the qt windows vista style dll to platforms
  119. Copy-Item -path "C:/msys64/mingw64/share/qt5/plugins/styles/qwindowsvistastyle.dll" -force -destination "$RELEASE_DIST/styles"
  120. 7z a -tzip $MINGW_BUILD_ZIP $RELEASE_DIST\*
  121. 7z a $MINGW_SEVENZIP $RELEASE_DIST
  122. }
  123. test_script:
  124. - cd %BUILD_TYPE%_build
  125. - ps: |
  126. if ($env:BUILD_TYPE -eq 'msvc') {
  127. ctest -VV -C Release
  128. } else {
  129. C:\msys64\usr\bin\bash.exe -lc "ctest -VV -C Release"
  130. }
  131. - cd ..
  132. artifacts:
  133. - path: $(BUILD_ZIP)
  134. name: build
  135. type: zip
  136. - path: $(BUILD_SYMBOLS)
  137. name: debugsymbols
  138. - path: $(BUILD_UPDATE)
  139. name: update
  140. deploy:
  141. provider: GitHub
  142. release: $(appveyor_repo_tag_name)
  143. auth_token:
  144. secure: QqePPnXbkzmXct5c8hZ2X5AbsthbI6cS1Sr+VBzcD8oUOIjfWJJKXVAQGUbQAbb0
  145. artifact: update,build
  146. draft: false
  147. prerelease: false
  148. on:
  149. appveyor_repo_tag: true