appveyor.yml 7.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179
  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. # Install Ninja
  33. - set NINJA_URL="https://github.com/ninja-build/ninja/releases/download/v1.8.2/ninja-win.zip"
  34. - appveyor DownloadFile %NINJA_URL% -FileName ninja.zip
  35. - 7z x ninja.zip -oC:\projects\deps\ninja > nul
  36. - set PATH=C:\projects\deps\ninja;%PATH%
  37. - ninja --version
  38. - call "C:\Program Files (x86)\Microsoft Visual Studio\2017\Community\VC\Auxiliary\Build\vcvarsall.bat" x64
  39. - mkdir %BUILD_TYPE%_build
  40. - cd %BUILD_TYPE%_build
  41. - ps: |
  42. if ($env:BUILD_TYPE -eq 'msvc') {
  43. # redirect stderr and change the exit code to prevent powershell from cancelling the build if cmake prints a warning
  44. cmd /C 'cmake -G "Ninja" -DCMAKE_BUILD_TYPE=Release -DYUZU_USE_BUNDLED_QT=1 -DYUZU_USE_BUNDLED_SDL2=1 -DYUZU_USE_BUNDLED_UNICORN=1 .. 2>&1 && exit 0'
  45. } else {
  46. C:\msys64\usr\bin\bash.exe -lc "cmake -G 'MSYS Makefiles' -DYUZU_BUILD_UNICORN=1 -DCMAKE_BUILD_TYPE=Release .. 2>&1"
  47. }
  48. - cd ..
  49. build_script:
  50. - ps: |
  51. if ($env:BUILD_TYPE -eq 'msvc') {
  52. # https://www.appveyor.com/docs/build-phase
  53. ninja -C msvc_build
  54. } else {
  55. C:\msys64\usr\bin\bash.exe -lc 'mingw32-make -C mingw_build/ 2>&1'
  56. }
  57. after_build:
  58. - ps: |
  59. $GITDATE = $(git show -s --date=short --format='%ad') -replace "-",""
  60. $GITREV = $(git show -s --format='%h')
  61. # Find out which kind of release we are producing by tag name
  62. if ($env:APPVEYOR_REPO_TAG_NAME) {
  63. $RELEASE_DIST, $RELEASE_VERSION = $env:APPVEYOR_REPO_TAG_NAME.split('-')
  64. } else {
  65. # There is no repo tag - make assumptions
  66. $RELEASE_DIST = "head"
  67. }
  68. if ($env:BUILD_TYPE -eq 'msvc') {
  69. # Where are these spaces coming from? Regardless, let's remove them
  70. $MSVC_BUILD_ZIP = "yuzu-windows-msvc-$GITDATE-$GITREV.zip" -replace " ", ""
  71. $MSVC_BUILD_PDB = "yuzu-windows-msvc-$GITDATE-$GITREV-debugsymbols.zip" -replace " ", ""
  72. $MSVC_SEVENZIP = "yuzu-windows-msvc-$GITDATE-$GITREV.7z" -replace " ", ""
  73. # set the build names as env vars so the artifacts can upload them
  74. $env:BUILD_ZIP = $MSVC_BUILD_ZIP
  75. $env:BUILD_SYMBOLS = $MSVC_BUILD_PDB
  76. $env:BUILD_UPDATE = $MSVC_SEVENZIP
  77. $BUILD_DIR = ".\msvc_build\bin"
  78. # Make a debug symbol upload
  79. mkdir pdb
  80. Get-ChildItem "$BUILD_DIR\" -Recurse -Filter "*.pdb" | Copy-Item -destination .\pdb
  81. 7z a -tzip $MSVC_BUILD_PDB .\pdb\*.pdb
  82. rm "$BUILD_DIR\*.pdb"
  83. mkdir $RELEASE_DIST
  84. # get rid of extra exes by copying everything over, then deleting all the exes, then copying just the exes we want
  85. Copy-Item "$BUILD_DIR\*" -Destination $RELEASE_DIST -Recurse
  86. rm "$RELEASE_DIST\*.exe"
  87. Get-ChildItem "$BUILD_DIR" -Recurse -Filter "yuzu*.exe" | Copy-Item -destination $RELEASE_DIST
  88. Copy-Item .\license.txt -Destination $RELEASE_DIST
  89. Copy-Item .\README.md -Destination $RELEASE_DIST
  90. 7z a -tzip $MSVC_BUILD_ZIP $RELEASE_DIST\*
  91. 7z a $MSVC_SEVENZIP $RELEASE_DIST
  92. } else {
  93. $MINGW_BUILD_ZIP = "yuzu-windows-mingw-$GITDATE-$GITREV.zip" -replace " ", ""
  94. $MINGW_SEVENZIP = "yuzu-windows-mingw-$GITDATE-$GITREV.7z" -replace " ", ""
  95. # not going to bother adding separate debug symbols for mingw, so just upload a README for it
  96. # if someone wants to add them, change mingw to compile with -g and use objdump and strip to separate the symbols from the binary
  97. $MINGW_NO_DEBUG_SYMBOLS = "README_No_Debug_Symbols.txt"
  98. Set-Content -Path $MINGW_NO_DEBUG_SYMBOLS -Value "This is a workaround for Appveyor since msvc has debug symbols but mingw doesnt" -Force
  99. # store the build information in env vars so we can use them as artifacts
  100. $env:BUILD_ZIP = $MINGW_BUILD_ZIP
  101. $env:BUILD_SYMBOLS = $MINGW_NO_DEBUG_SYMBOLS
  102. $env:BUILD_UPDATE = $MINGW_SEVENZIP
  103. $CMAKE_SOURCE_DIR = "$env:APPVEYOR_BUILD_FOLDER"
  104. $CMAKE_BINARY_DIR = "$CMAKE_SOURCE_DIR/mingw_build/bin"
  105. $RELEASE_DIST = $RELEASE_DIST + "-mingw"
  106. mkdir $RELEASE_DIST
  107. mkdir $RELEASE_DIST/platforms
  108. # copy the compiled binaries and other release files to the release folder
  109. Get-ChildItem "$CMAKE_BINARY_DIR" -Filter "yuzu*.exe" | Copy-Item -destination $RELEASE_DIST
  110. Copy-Item -path "$CMAKE_SOURCE_DIR/license.txt" -destination $RELEASE_DIST
  111. Copy-Item -path "$CMAKE_SOURCE_DIR/README.md" -destination $RELEASE_DIST
  112. # copy all the dll dependencies to the release folder
  113. . "./.appveyor/UtilityFunctions.ps1"
  114. $DLLSearchPath = "C:\msys64\mingw64\bin;$env:PATH"
  115. $MingwDLLs = RecursivelyGetDeps $DLLSearchPath "$RELEASE_DIST\yuzu.exe"
  116. $MingwDLLs += RecursivelyGetDeps $DLLSearchPath "$RELEASE_DIST\yuzu_cmd.exe"
  117. Write-Host "Detected the following dependencies:"
  118. Write-Host $MingwDLLs
  119. foreach ($file in $MingwDLLs) {
  120. Copy-Item -path "$file" -force -destination "$RELEASE_DIST"
  121. }
  122. # copy the qt windows plugin dll to platforms
  123. Copy-Item -path "C:/msys64/mingw64/share/qt5/plugins/platforms/qwindows.dll" -force -destination "$RELEASE_DIST/platforms"
  124. 7z a -tzip $MINGW_BUILD_ZIP $RELEASE_DIST\*
  125. 7z a $MINGW_SEVENZIP $RELEASE_DIST
  126. }
  127. test_script:
  128. - cd %BUILD_TYPE%_build
  129. - ps: |
  130. if ($env:BUILD_TYPE -eq 'msvc') {
  131. ctest -VV -C Release
  132. } else {
  133. C:\msys64\usr\bin\bash.exe -lc "ctest -VV -C Release"
  134. }
  135. - cd ..
  136. artifacts:
  137. - path: $(BUILD_ZIP)
  138. name: build
  139. type: zip
  140. - path: $(BUILD_SYMBOLS)
  141. name: debugsymbols
  142. - path: $(BUILD_UPDATE)
  143. name: update
  144. deploy:
  145. provider: GitHub
  146. release: $(appveyor_repo_tag_name)
  147. auth_token:
  148. secure: QqePPnXbkzmXct5c8hZ2X5AbsthbI6cS1Sr+VBzcD8oUOIjfWJJKXVAQGUbQAbb0
  149. artifact: update,build
  150. draft: false
  151. prerelease: false
  152. on:
  153. appveyor_repo_tag: true