From f07a83888365faff286faf0720e7dc3c73b5e97f Mon Sep 17 00:00:00 2001 From: Rafael Kitover Date: Sat, 22 Aug 2020 21:31:12 +0000 Subject: [PATCH] Another hack to work-around broken vcpkg upgrades. Add a function to check if libogg is installed but libvorbis isn't, this means it failed to upgrade libvorbis because libogg wasn't upgraded to the newest port revision supporting pkg-config, see: https://github.com/microsoft/vcpkg/issues/13037 In this case, remove libogg recursively and allow the install action to reinstall SFML and all deps. This will also fix building link support on appveyor for the time being. Signed-off-by: Rafael Kitover --- cmake/Set-Toolchain-vcpkg.cmake | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) diff --git a/cmake/Set-Toolchain-vcpkg.cmake b/cmake/Set-Toolchain-vcpkg.cmake index d5bdb933..4bf7fda3 100644 --- a/cmake/Set-Toolchain-vcpkg.cmake +++ b/cmake/Set-Toolchain-vcpkg.cmake @@ -67,6 +67,25 @@ function(vcpkg_get_first_upgrade vcpkg_exe) set(first_upgrade ${first_upgrade} PARENT_SCOPE) endfunction() +function(vcpkg_deps_fixup vcpkg_exe) + # Get installed list. + execute_process( + COMMAND ${vcpkg_exe} list + OUTPUT_VARIABLE pkg_list + OUTPUT_STRIP_TRAILING_WHITESPACE + ERROR_QUIET + WORKING_DIRECTORY ${VCPKG_ROOT} + ) + + # If libvorbis is NOT installed but libogg is, remove libvorbis recursively. + if(pkg_list MATCHES libogg AND (NOT pkg_list MATCHES libvorbis)) + execute_process( + COMMAND "${vcpkg_exe}" remove --recurse libogg:${VCPKG_TARGET_TRIPLET} + WORKING_DIRECTORY ${VCPKG_ROOT} + ) + endif() +endfunction() + function(vcpkg_set_toolchain) if(NOT DEFINED ENV{VCPKG_ROOT}) if(WIN32) @@ -193,6 +212,8 @@ function(vcpkg_set_toolchain) # Limit total installation time to 30 minutes to not overrun CI time limit. math(EXPR time_limit "${began} + (30 * 60)") + vcpkg_deps_fixup("${vcpkg_exe}") + # Install core deps. execute_process( COMMAND ${vcpkg_exe} install ${VCPKG_DEPS_QUALIFIED}