summaryrefslogtreecommitdiffstats
path: root/appveyor.yml
blob: 954be4e8ffdeda11fe8cc2b3a128a475da40f245 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
# shallow clone
clone_depth: 10

cache:
  - C:\ProgramData\chocolatey\bin -> appveyor.yml
  - C:\ProgramData\chocolatey\lib -> appveyor.yml

os: Visual Studio 2017

environment:
  # Tell msys2 to add mingw64 to the path
  MSYSTEM: MINGW64
  # Tell msys2 to inherit the current directory when starting the shell
  CHERE_INVOKING: 1
  matrix:
    - BUILD_TYPE: mingw
    - BUILD_TYPE: msvc

platform:
  - x64

configuration:
  - Release

install:
  - git submodule update --init --recursive
  - ps: |
        if ($env:BUILD_TYPE -eq 'mingw') {
          $dependencies = "mingw64/mingw-w64-x86_64-cmake",
                          "mingw64/mingw-w64-x86_64-qt5",
                          "mingw64/mingw-w64-x86_64-SDL2"
          # redirect err to null to prevent warnings from becoming errors
          # workaround to prevent pacman from failing due to cyclical dependencies
          C:\msys64\usr\bin\bash -lc "pacman --noconfirm -S mingw64/mingw-w64-x86_64-freetype mingw64/mingw-w64-x86_64-fontconfig" 2> $null
          C:\msys64\usr\bin\bash -lc "pacman --noconfirm -S $dependencies" 2> $null
        }

before_build:
  - mkdir %BUILD_TYPE%_build
  - cd %BUILD_TYPE%_build
  - ps: |
        if ($env:BUILD_TYPE -eq 'msvc') {
          # redirect stderr and change the exit code to prevent powershell from cancelling the build if cmake prints a warning
          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'
        } else {
          C:\msys64\usr\bin\bash.exe -lc "cmake -G 'MSYS Makefiles' -DYUZU_BUILD_UNICORN=1 -DCMAKE_BUILD_TYPE=Release .. 2>&1"
        }
  - cd ..

build_script:
  - ps: |
        if ($env:BUILD_TYPE -eq 'msvc') {
          # https://www.appveyor.com/docs/build-phase
          msbuild msvc_build/yuzu.sln /maxcpucount /logger:"C:\Program Files\AppVeyor\BuildAgent\Appveyor.MSBuildLogger.dll"
        } else {
          C:\msys64\usr\bin\bash.exe -lc 'mingw32-make -C mingw_build/ 2>&1'
        }

after_build:
  - ps: |
        $GITDATE = $(git show -s --date=short --format='%ad') -replace "-",""
        $GITREV = $(git show -s --format='%h')

        # Find out which kind of release we are producing by tag name
        if ($env:APPVEYOR_REPO_TAG_NAME) {
          $RELEASE_DIST, $RELEASE_VERSION = $env:APPVEYOR_REPO_TAG_NAME.split('-')
        } else {
          # There is no repo tag - make assumptions
          $RELEASE_DIST = "head"
        }

        if ($env:BUILD_TYPE -eq 'msvc') {
          # Where are these spaces coming from? Regardless, let's remove them
          $MSVC_BUILD_ZIP = "yuzu-windows-msvc-$GITDATE-$GITREV.zip" -replace " ", ""
          $MSVC_BUILD_PDB = "yuzu-windows-msvc-$GITDATE-$GITREV-debugsymbols.zip" -replace " ", ""
          $MSVC_SEVENZIP = "yuzu-windows-msvc-$GITDATE-$GITREV.7z" -replace " ", ""

          # set the build names as env vars so the artifacts can upload them
          $env:BUILD_ZIP = $MSVC_BUILD_ZIP
          $env:BUILD_SYMBOLS = $MSVC_BUILD_PDB
          $env:BUILD_UPDATE = $MSVC_SEVENZIP

          mkdir pdb
          Get-ChildItem ".\msvc_build\bin\" -Recurse -Filter "*.pdb" | Copy-Item -destination .\pdb
          7z a -tzip $MSVC_BUILD_PDB .\pdb\*.pdb

          mkdir $RELEASE_DIST
          Get-ChildItem ".\msvc_build\bin\" -Recurse -Filter "yuzu*.exe" | Copy-Item -destination $RELEASE_DIST
          Copy-Item .\license.txt -Destination $RELEASE_DIST
          Copy-Item .\README.md -Destination $RELEASE_DIST
          7z a -tzip $MSVC_BUILD_ZIP $RELEASE_DIST\*
          7z a $MSVC_SEVENZIP $RELEASE_DIST
        } else {
          $MINGW_BUILD_ZIP = "yuzu-windows-mingw-$GITDATE-$GITREV.zip" -replace " ", ""
          $MINGW_SEVENZIP = "yuzu-windows-mingw-$GITDATE-$GITREV.7z" -replace " ", ""
          # not going to bother adding separate debug symbols for mingw, so just upload a README for it
          # if someone wants to add them, change mingw to compile with -g and use objdump and strip to separate the symbols from the binary
          $MINGW_NO_DEBUG_SYMBOLS = "README_No_Debug_Symbols.txt"
          Set-Content -Path $MINGW_NO_DEBUG_SYMBOLS -Value "This is a workaround for Appveyor since msvc has debug symbols but mingw doesnt" -Force

          # store the build information in env vars so we can use them as artifacts
          $env:BUILD_ZIP = $MINGW_BUILD_ZIP
          $env:BUILD_SYMBOLS = $MINGW_NO_DEBUG_SYMBOLS
          $env:BUILD_UPDATE = $MINGW_SEVENZIP

          $CMAKE_SOURCE_DIR = "$env:APPVEYOR_BUILD_FOLDER"
          $CMAKE_BINARY_DIR = "$CMAKE_SOURCE_DIR/mingw_build/bin"
          $RELEASE_DIST = $RELEASE_DIST + "-mingw"

          mkdir $RELEASE_DIST
          mkdir $RELEASE_DIST/platforms

          # copy the compiled binaries and other release files to the release folder
          Get-ChildItem "$CMAKE_BINARY_DIR" -Filter "yuzu*.exe" | Copy-Item -destination $RELEASE_DIST
          Copy-Item -path "$CMAKE_SOURCE_DIR/license.txt" -destination $RELEASE_DIST
          Copy-Item -path "$CMAKE_SOURCE_DIR/README.md" -destination $RELEASE_DIST
          # copy all the dll dependencies to the release folder
          # hardcoded list because we don't build static and determining the list of dlls from the binary is a pain.
          $MingwDLLs = "Qt5Core.dll","Qt5Widgets.dll","Qt5Gui.dll","Qt5OpenGL.dll",
                       # QT dll dependencies
                       "libbz2-*.dll","libicudt*.dll","libicuin*.dll","libicuuc*.dll","libffi-*.dll",
                       "libfreetype-*.dll","libglib-*.dll","libgobject-*.dll","libgraphite2.dll","libiconv-*.dll",
                       "libharfbuzz-*.dll","libintl-*.dll","libpcre-*.dll","libpcre2-16-*.dll","libpcre16-*.dll","libpng16-*.dll",
                       # Runtime/Other dependencies
                       "libgcc_s_seh-*.dll","libstdc++-*.dll","libwinpthread-*.dll","SDL2.dll","zlib1.dll"
          foreach ($file in $MingwDLLs) {
            Copy-Item -path "C:/msys64/mingw64/bin/$file" -force -destination "$RELEASE_DIST"
          }
          # the above list copies a few extra debug dlls that aren't needed (thanks globbing patterns!)
          # so we can remove them by hardcoding another list of extra dlls to remove
          $DebugDLLs = "libicudtd*.dll","libicuind*.dll","libicuucd*.dll"
          foreach ($file in $DebugDLLs) {
            Remove-Item -path "$RELEASE_DIST/$file"
          }

          # copy the qt windows plugin dll to platforms
          Copy-Item -path "C:/msys64/mingw64/share/qt5/plugins/platforms/qwindows.dll" -force -destination "$RELEASE_DIST/platforms"

          7z a -tzip $MINGW_BUILD_ZIP $RELEASE_DIST\*
          7z a $MINGW_SEVENZIP $RELEASE_DIST
        }

test_script:
  - cd %BUILD_TYPE%_build
  - ps: |
        if ($env:BUILD_TYPE -eq 'msvc') {
          ctest -VV -C Release
        } else {
          C:\msys64\usr\bin\bash.exe -lc "ctest -VV -C Release"
        }
  - cd ..

artifacts:
  - path: $(BUILD_ZIP)
    name: build
    type: zip
  - path: $(BUILD_SYMBOLS)
    name: debugsymbols
  - path: $(BUILD_UPDATE)
    name: update

deploy:
  provider: GitHub
  release: $(appveyor_repo_tag_name)
  auth_token:
    secure: "argb6oi2TYLB4wDy+HoCC8PuGAmsnocSk12CQ5614XAPO+NVPndlkLv1utnDFfg2"
  artifact: update,build
  draft: false
  prerelease: false
  on:
    appveyor_repo_tag: true