aboutsummaryrefslogtreecommitdiff
path: root/appveyor.yml
blob: f61aad004c758043421c1d4196fc40814c11419b (plain)
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
os: Visual Studio 2015

shallow_clone: true

environment:
  CONFIG: Release
  matrix:
    - BUILD: Kodi
    # - ADDONS: audiodecoder
    # - ADDONS: audioencoder
    # - ADDONS: pvr
    # - ADDONS: screensaver
    # - ADDONS: visualization

init:
  - ps: iex ((new-object net.webclient).DownloadString('https://raw.githubusercontent.com/appveyor/ci/master/scripts/enable-rdp.ps1'))

install:
  - SET PATH=C:\Program Files (x86)\CMake\bin;C:\msys64\bin;C:\msys64\usr\bin;%PATH%
  - bash -lc "pacman --needed --noconfirm -Sy"
  - mklink /j %APPVEYOR_BUILD_FOLDER%\project\BuildDependencies\msys64 C:\msys64

build_script:
  # Setup Visual Studio compiler environment 
  - ps: $ErrorActionPreference= 'silentlycontinue'
  
  # Setup Visual Studio compiler environment 
  - call "%VS140COMNTOOLS%..\..\VC\bin\vcvars32.bat"
  
  #
  # Build Kodi
  #
  - ps: |
      if ($env:BUILD -eq "Kodi") {
        # Download dependencies
        cd $env:APPVEYOR_BUILD_FOLDER\project\BuildDependencies
        & .\DownloadBuildDeps.bat
        
        # We are using AppVeyor's already installed msys64 environment,
        # no need to install msys/mingw environment.
        
        # Download precompiled mingw32 libraries
        # To run make-mingwlibs.bat on AppVeyor takes too long, 
        # we must use precompiled libs to speed up build
        bash -c "wget -O - http://repo.msys2.org/mingw/i686/mingw-w64-i686-ffmpeg-3.3-1-any.pkg.tar.xz | tar xJv"
        bash -c "wget -O - http://repo.msys2.org/mingw/i686/mingw-w64-i686-libdvdcss-1.4.0-1-any.pkg.tar.xz | tar xJv"
        bash -c "wget -O - http://repo.msys2.org/mingw/i686/mingw-w64-i686-libdvdnav-5.0.3-1-any.pkg.tar.xz | tar xJv"
        bash -c "wget -O - http://repo.msys2.org/mingw/i686/mingw-w64-i686-libdvdread-5.0.3-1-any.pkg.tar.xz | tar xJv"
        # Rename all precompiled lib*.dll.a -> *.lib, so MSVC will find them
        Get-ChildItem mingw32\lib\lib*.dll.a | %{
          $new_name = $_.Name.SubString(3) -replace ".dll.a", ".lib"
          $new_fullname = Join-Path $_.DirectoryName $new_name
          Rename-Item $_.FullName $new_fullname
        }
        # Copy all libs and includes under Kodi's dependencies folder
        xcopy /s /y mingw32\*.* .
        xcopy /s /y mingw32\bin\*.dll $env:APPVEYOR_BUILD_FOLDER\system\
        # Build  
        mkdir $env:APPVEYOR_BUILD_FOLDER\kodi-build
        cd $env:APPVEYOR_BUILD_FOLDER\kodi-build
        cmd /c 'cmake -G "Visual Studio 14" .. 2>&1'
        cmd /c 'cmake --build . --target all_build --config RelWithDebInfo 2>&1'
      }
  
  #
  # Build Addons
  #
  - ps: |
      if ($env:ADDONS.length -ne 0 -and $env:BUILD -ne "Kodi") {
        # Bootstrap
        cd $env:APPVEYOR_BUILD_FOLDER\tools\buildsteps\win32
        & .\bootstrap-addons.bat
        
        # Create build folder
        md -Force $env:APPVEYOR_BUILD_FOLDER\build | out-null
        cd $env:APPVEYOR_BUILD_FOLDER\build
        # Configure
        cmake -DADDONS_TO_BUILD="$env:ADDONS".* `
              -G "NMake Makefiles" `
              -DCMAKE_BUILD_TYPE="$env:CONFIG" `
              -DCMAKE_INSTALL_PREFIX="$env:APPVEYOR_BUILD_FOLDER"\addons `
              $env:APPVEYOR_BUILD_FOLDER\cmake\addons
        # Build selected addons one by one
        $addons_success=""
        $addons_failed=""
        nmake supported_addons | %{
          if ($_ -like "ALL_ADDONS_BUILDING: *") {
            $_.SubString(21).Split(" ") | %{
              Write-Host "Building " $_
              nmake $_
              if ($LASTEXITCODE -eq 0) {
                $addons_success += $_ + " "
              } else {
                $addons_failed += $_  + " "
              }
            }
          }
        }
        # Print succesful and failed addons
        Write-Host "--------------------------------------------------"
        if ($addons_success -ne "") {
          $addons_success.Split(" ") | %{
            if ($_ -ne "") { 
              Write-Host [SUCCESS] $_ -ForegroundColor Green 
            }
          }
        }
        if ($addons_failed -ne "") {
          $addons_failed.Split(" ") | %{
            if ($_ -ne "") { 
              Write-Host [ ERROR ] $_ -ForegroundColor Red
            }
          } 
          exit 1
        }
      }

test: off