Update vcpkg based Windows CI Pipeline (#892)

This commit is contained in:
Tom M 2021-05-23 13:02:04 +02:00 committed by GitHub
parent a28a5e6d20
commit bf884758cb
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -13,10 +13,17 @@ trigger:
- '.cirrus.yml'
- 'README.md'
parameters:
- name: UseCache
displayName: Use Dependency Cache
type: boolean
default: true
variables:
toolset: 'v142'
generator: 'Visual Studio 16 2019'
VCPKG_DIR: 'C:\vcpkg'
configuration: 'RelWithDebInfo'
VCPKG_REVISION: 'e6dcc079c81161786eb7b052209a2047e79f2c6c'
jobs:
- job: vcpkg
@ -25,70 +32,109 @@ jobs:
strategy:
matrix:
ARM:
platform: 'ARM'
platform: 'arm'
cmake_platform: 'ARM'
configuration: 'Release'
ARM64:
platform: 'arm64'
cmake_platform: 'ARM64'
x86:
platform: 'x86'
cmake_platform: 'Win32'
configuration: 'Release'
x64:
platform: 'x64'
cmake_platform: 'x64'
configuration: 'Release'
pool:
vmImage: 'windows-2019'
steps:
- script: |
@ECHO ON
echo $(generator)
echo $(toolset)
REM choco upgrade ninja -y
REM ninja --version
cmake --version
REM manually update vcpkg
REM cd "$(VCPKG_DIR)" || exit -1
REM git pull || exit -1
REM .\bootstrap-vcpkg.bat || exit -1
REM cd $(Build.SourcesDirectory)
where vcpkg.exe
vcpkg install --only-downloads glib:$(platform)-windows
displayName: 'Prerequisites'
- task: Cache@2
displayName: "Cache vcpkg's packages"
condition: and(not(in(variables['Build.Reason'], 'Schedule')), ${{ parameters.useCache }})
inputs:
key: $(VCPKG_DIR)\downloads\glib* | "$(platform)"
path: "$(VCPKG_DIR)"
key: $(VCPKG_REVISION) | "$(platform)"
path: '$(VCPKG_INSTALLATION_ROOT)\installed'
cacheHitVar: CACHE_RESTORED
- script: |
@ECHO ON
vcpkg install glib:$(platform)-windows
displayName: 'vcpkg build glib'
condition: ne(variables.CACHE_RESTORED, 'true')
- script: |
@ECHO ON
- bash: |
set -ex
echo $(generator)
echo $(toolset)
# choco upgrade ninja -y
# ninja --version
cmake --version
rm -rf C:/Strawberry/perl/bin/pkg-config*
choco install --svc --sdc -i pkgconfiglite &
chocoTask=$!
# manually update vcpkg
cd $VCPKG_INSTALLATION_ROOT
# git checkout master
git fetch origin
git checkout $(VCPKG_REVISION)
sed -i 's/arm64/arm/g' ports/glib/portfile.cmake
./bootstrap-vcpkg.sh
wait $chocoTask
which pkg-config
displayName: 'Update vcpkg'
- task: DownloadBuildArtifacts@0
inputs:
buildType: specific
# https://dev.azure.com/tommbrt/_apis/projects?api-version=5.0
project: 'd3638885-de4a-4ce7-afe7-f237ae461c07'
pipeline: 1
artifactName: libinstpatch-$(cmake_platform)
downloadPath: '$(Agent.TempDirectory)'
displayName: 'Get libinstpatch'
condition: and(succeeded(), and(ne(variables['platform'], 'arm'), ne(variables['platform'], 'arm64')))
- task: CopyFiles@2
inputs:
SourceFolder: '$(Agent.TempDirectory)\libinstpatch-$(cmake_platform)'
Contents: '**'
TargetFolder: '$(VCPKG_INSTALLATION_ROOT)\installed\$(platform)-windows'
displayName: 'Install libinstpatch'
condition: and(succeeded(), and(ne(variables['platform'], 'arm'), ne(variables['platform'], 'arm64')))
- bash: |
set -ex
vcpkg install glib:$(platform)-windows libsndfile:$(platform)-windows
displayName: 'vcpkg build Dependencies'
condition: and(succeeded(), ne(variables.CACHE_RESTORED, 'true'))
- bash: |
set -ex
cd $VCPKG_INSTALLATION_ROOT/installed/$(platform)-windows/
pwd
rm -rf include/FLAC* include/ffi* include/iconv* include/opus tools share
ls -Rg .
pkg-config --list-all
pkg-config --cflags libinstpatch-1.0 || true
displayName: 'Cleanup dependencies'
condition: and(succeeded(), ne(variables.CACHE_RESTORED, 'true'))
- bash: |
set -ex
mkdir build
cd build
cmake -Werror=dev -G "$(generator)" -A "$(cmake_platform)" -T "$(toolset)" -Denable-pkgconfig=0 -Denable-jack=0 -Denable-pulseaudio=0 -Denable-ladspa=0 -Denable-dbus=0 -Denable-readline=0 -Denable-sdl2=0 -Denable-libinstpatch=0 -DCMAKE_TOOLCHAIN_FILE=C:/vcpkg/scripts/buildsystems/vcpkg.cmake -DCMAKE_INSTALL_PREFIX=$(Build.ArtifactStagingDirectory) -DCMAKE_VERBOSE_MAKEFILE=1 -DNO_GUI=1 .. || exit -1
REM build libfluidsynth and fluidsynth exec
cmake --build . --config $(configuration) --parallel 3 || exit -1
cmake -Werror=dev -G "$(generator)" -A "$(cmake_platform)" -T "$(toolset)" -Denable-readline=0 -DCMAKE_TOOLCHAIN_FILE=$VCPKG_INSTALLATION_ROOT/scripts/buildsystems/vcpkg.cmake -DCMAKE_INSTALL_PREFIX=$VCPKG_INSTALLATION_ROOT/installed/$(platform)-windows -DCMAKE_VERBOSE_MAKEFILE=1 -DNO_GUI=1 ..
cmake --build . --config $(configuration) --parallel 3
displayName: 'Compile fluidsynth'
- script: |
@ECHO ON
REM build and exec unittests, unless when cross-compiling
if not "%platform%"=="ARM" ( cmake --build build --config $(configuration) --target check --parallel 3 )
- bash: |
set -ex
cmake --build build --config $(configuration) --target check --parallel 3
displayName: 'Execute Unittests'
condition: and(succeeded(), and(ne(variables['platform'], 'arm'), ne(variables['platform'], 'arm64')))
- script: |
@ECHO ON
cd build
cmake --build . --config $(configuration) --target install || exit -1
REM del $(Build.ArtifactStagingDirectory)\bin\concrt*.dll
REM del bin\concrt*.dll
REM del $(Build.ArtifactStagingDirectory)\bin\vcruntime*.dll
REM del $(Build.ArtifactStagingDirectory)\bin\msvcp*.dll
REM del $(Build.ArtifactStagingDirectory)\lib\instpatch*.lib
REM del $(Build.ArtifactStagingDirectory)\lib\pkgconfig\libinstpatch*.pc
REM rd $(Build.ArtifactStagingDirectory)\include\libinstpatch-2 /s /q
displayName: 'Copy Artifacts'
displayName: 'fluidsynth install'
- task: CopyFiles@2
inputs:
SourceFolder: '$(VCPKG_INSTALLATION_ROOT)/installed/$(platform)-windows/'
Contents: '**'
TargetFolder: '$(Build.ArtifactStagingDirectory)'
CleanTargetFolder: true
displayName: 'Copy Binaries to Artifact Dir'
- task: PublishBuildArtifacts@1
inputs:
pathtoPublish: $(Build.ArtifactStagingDirectory)