mirror of https://github.com/microsoft/vcpkg.git
[libvpx] Fix build failure with VS 2022 17.14+ (#51694)
Co-authored-by: Victor Romero <romerosanchezv@gmail.com>
This commit is contained in:
parent
c39260ff4e
commit
70bb701082
|
|
@ -0,0 +1,11 @@
|
|||
--- a/build/make/gen_msvs_vcxproj.sh
|
||||
+++ b/build/make/gen_msvs_vcxproj.sh
|
||||
@@ -209,7 +209,7 @@
|
||||
;;
|
||||
-l*) libs="${libs}${libs:+ }${opt##-l}.lib"
|
||||
;;
|
||||
- -*) die_unknown $opt
|
||||
+ -*) : # Ignore unknown flags (e.g. -O3 leaked from GCC CFLAGS)
|
||||
;;
|
||||
*)
|
||||
# The paths in file_list are fixed outside of the loop.
|
||||
|
|
@ -0,0 +1,79 @@
|
|||
--- a/build/make/configure.sh 2026-05-13 08:17:31.764191365 +0200
|
||||
+++ b/build/make/configure.sh 2026-05-13 08:18:26.744873378 +0200
|
||||
@@ -298,37 +298,71 @@
|
||||
"$@" >>${logfile} 2>&1
|
||||
}
|
||||
|
||||
+# Emit the compiler/linker output flag for the given file.
|
||||
+# cl.exe (and clang-cl when driven in cl mode) require -Fo<obj> / -Fe<exe> with no separating space;
|
||||
+# every other compiler uses the GCC-style -o <file>.
|
||||
+_cc_basename() {
|
||||
+ local _cc="${1##*/}"
|
||||
+ _cc="${_cc##*\\}"
|
||||
+ echo "${_cc%.exe}"
|
||||
+}
|
||||
+
|
||||
+# Convert a path to native Windows form when the compiler is MSVC.
|
||||
+# MSYS2 temporary paths like /tmp/vpx-conf-1234.o get translated by the MSYS layer to D:\tmp\... which does not exist.
|
||||
+# cygpath -w produces the real Windows path (e.g. C:\msys64\tmp\...).
|
||||
+_native_output_path() {
|
||||
+ case "$(_cc_basename "${1}")" in
|
||||
+ cl|clang-cl|link) cygpath -w "$2" ;;
|
||||
+ *) echo "$2" ;;
|
||||
+ esac
|
||||
+}
|
||||
+
|
||||
+cc_obj_flag() {
|
||||
+ case "$(_cc_basename "${CC}")" in
|
||||
+ cl|clang-cl) echo "-Fo$(_native_output_path "${CC}" "$1")" ;;
|
||||
+ *) echo "-o $1" ;;
|
||||
+ esac
|
||||
+}
|
||||
+
|
||||
+cc_exe_flag() {
|
||||
+ case "$(_cc_basename "${LD:-${CC}}")" in
|
||||
+ cl|clang-cl) echo "-Fe$(_native_output_path "${LD:-${CC}}" "$1")" ;;
|
||||
+ link) echo "/OUT:$(_native_output_path "${LD:-${CC}}" "$1")" ;;
|
||||
+ *) echo "-o $1" ;;
|
||||
+ esac
|
||||
+}
|
||||
+
|
||||
check_cc() {
|
||||
log check_cc "$@"
|
||||
cat >${TMP_C}
|
||||
log_file ${TMP_C}
|
||||
- check_cmd ${CC} ${CFLAGS} "$@" -c -o ${TMP_O} ${TMP_C}
|
||||
+ check_cmd ${CC} ${CFLAGS} "$@" -c $(cc_obj_flag ${TMP_O}) ${TMP_C}
|
||||
}
|
||||
|
||||
check_cxx() {
|
||||
log check_cxx "$@"
|
||||
cat >${TMP_CC}
|
||||
log_file ${TMP_CC}
|
||||
- check_cmd ${CXX} ${CXXFLAGS} "$@" -c -o ${TMP_O} ${TMP_CC}
|
||||
+ check_cmd ${CXX} ${CXXFLAGS} "$@" -c $(cc_obj_flag ${TMP_O}) ${TMP_CC}
|
||||
}
|
||||
|
||||
check_cpp() {
|
||||
log check_cpp "$@"
|
||||
cat > ${TMP_C}
|
||||
log_file ${TMP_C}
|
||||
- check_cmd ${CC} ${CFLAGS} "$@" -E -o ${TMP_O} ${TMP_C}
|
||||
+ check_cmd ${CC} ${CFLAGS} "$@" -E $(cc_obj_flag ${TMP_O}) ${TMP_C}
|
||||
}
|
||||
|
||||
check_ld() {
|
||||
log check_ld "$@"
|
||||
check_cc $@ \
|
||||
- && check_cmd ${LD} ${LDFLAGS} "$@" -o ${TMP_X} ${TMP_O} ${extralibs}
|
||||
+ && check_cmd ${LD} ${LDFLAGS} "$@" $(cc_exe_flag ${TMP_X}) ${TMP_O} ${extralibs}
|
||||
}
|
||||
|
||||
check_lib() {
|
||||
log check_lib "$@"
|
||||
check_cc $@ \
|
||||
- && check_cmd ${LD} ${LDFLAGS} -o ${TMP_X} ${TMP_O} "$@" ${extralibs}
|
||||
+ && check_cmd ${LD} ${LDFLAGS} $(cc_exe_flag ${TMP_X}) ${TMP_O} "$@" ${extralibs}
|
||||
}
|
||||
|
||||
check_header(){
|
||||
|
|
@ -8,6 +8,10 @@ vcpkg_from_github(
|
|||
0003-add-uwp-v142-and-v143-support.patch
|
||||
0004-remove-library-suffixes.patch
|
||||
0005-dont-expect-gnu-diff.patch
|
||||
0006-gen-vcxproj-ignore-unknown-flags.patch
|
||||
# Candidate upstream fix: makes configure-time toolchain probes use -Fo/-Fe when CC/LD is cl.exe or clang-cl.
|
||||
# Once upstream picks this up (or once we drop --enable-external-build), the MSVC arm64 SVE workaround below can also be removed.
|
||||
0007-msvc-use-Fo-in-toolchain-probe.patch
|
||||
)
|
||||
|
||||
if(CMAKE_HOST_WIN32)
|
||||
|
|
@ -30,6 +34,12 @@ endif()
|
|||
if(VCPKG_TARGET_IS_WINDOWS AND NOT VCPKG_TARGET_IS_MINGW)
|
||||
|
||||
file(REMOVE_RECURSE "${CURRENT_BUILDTREES_DIR}/${TARGET_TRIPLET}-tmp")
|
||||
# Remove stale vpx-* dist directories from previous builds to avoid picking old artifacts.
|
||||
file(GLOB _vpx_stale_dirs "${CURRENT_BUILDTREES_DIR}/${TARGET_TRIPLET}-rel/vpx-*")
|
||||
if(_vpx_stale_dirs)
|
||||
file(REMOVE_RECURSE ${_vpx_stale_dirs})
|
||||
endif()
|
||||
|
||||
|
||||
if(VCPKG_CRT_LINKAGE STREQUAL static)
|
||||
set(LIBVPX_CRT_LINKAGE --enable-static-msvcrt)
|
||||
|
|
@ -68,14 +78,26 @@ if(VCPKG_TARGET_IS_WINDOWS AND NOT VCPKG_TARGET_IS_MINGW)
|
|||
set(LIBVPX_TARGET_VS "vs15")
|
||||
endif()
|
||||
|
||||
set(OPTIONS "--disable-examples --disable-tools --disable-docs --enable-pic")
|
||||
set(OPTIONS --disable-examples --disable-tools --disable-docs --enable-pic --disable-dependency-tracking)
|
||||
|
||||
# Force VS generation to avoids Unix-style rules that break with cl/ar semantics
|
||||
list(APPEND OPTIONS --enable-external-build)
|
||||
|
||||
# Disable SVE/SVE2 probe to avoids missing `<arm_sve.h>` in pure-MSVC.
|
||||
if(VCPKG_TARGET_ARCHITECTURE STREQUAL arm64)
|
||||
vcpkg_cmake_get_vars(_libvpx_cmake_vars_file)
|
||||
include("${_libvpx_cmake_vars_file}")
|
||||
if(VCPKG_DETECTED_CMAKE_C_COMPILER_ID STREQUAL "MSVC")
|
||||
list(APPEND OPTIONS --disable-sve --disable-sve2)
|
||||
endif()
|
||||
endif()
|
||||
|
||||
if("realtime" IN_LIST FEATURES)
|
||||
set(OPTIONS "${OPTIONS} --enable-realtime-only")
|
||||
list(APPEND OPTIONS --enable-realtime-only)
|
||||
endif()
|
||||
|
||||
if("highbitdepth" IN_LIST FEATURES)
|
||||
set(OPTIONS "${OPTIONS} --enable-vp9-highbitdepth")
|
||||
list(APPEND OPTIONS --enable-vp9-highbitdepth)
|
||||
endif()
|
||||
|
||||
message(STATUS "Generating makefile")
|
||||
|
|
@ -103,13 +125,18 @@ if(VCPKG_TARGET_IS_WINDOWS AND NOT VCPKG_TARGET_IS_MINGW)
|
|||
PROJECT_SUBPATH vpx.vcxproj
|
||||
)
|
||||
|
||||
if (VCPKG_TARGET_ARCHITECTURE STREQUAL arm64)
|
||||
set(LIBVPX_INCLUDE_DIR "${CURRENT_BUILDTREES_DIR}/${TARGET_TRIPLET}-rel/vpx-vp8-vp9-nopost-nodocs-${LIBVPX_TARGET_ARCH}${LIBVPX_CRT_SUFFIX}-${LIBVPX_TARGET_VS}-v${VERSION}/include/vpx")
|
||||
elseif (VCPKG_TARGET_ARCHITECTURE STREQUAL arm)
|
||||
set(LIBVPX_INCLUDE_DIR "${CURRENT_BUILDTREES_DIR}/${TARGET_TRIPLET}-rel/vpx-vp8-vp9-nopost-nomt-nodocs-${LIBVPX_TARGET_ARCH}${LIBVPX_CRT_SUFFIX}-${LIBVPX_TARGET_VS}-v${VERSION}/include/vpx")
|
||||
else()
|
||||
set(LIBVPX_INCLUDE_DIR "${CURRENT_BUILDTREES_DIR}/${TARGET_TRIPLET}-rel/vpx-vp8-vp9-nodocs-${LIBVPX_TARGET_ARCH}${LIBVPX_CRT_SUFFIX}-${LIBVPX_TARGET_VS}-v${VERSION}/include/vpx")
|
||||
# libvpx's make dist creates a directory with the pattern:
|
||||
# vpx-[CODEC_FEATURES]-[ARCH][CRT]-[VS]-v[VERSION]
|
||||
# GLOB to find the actual directory.
|
||||
file(GLOB LIBVPX_INCLUDE_DIR_CANDIDATES
|
||||
"${CURRENT_BUILDTREES_DIR}/${TARGET_TRIPLET}-rel/vpx-*${LIBVPX_TARGET_ARCH}${LIBVPX_CRT_SUFFIX}-${LIBVPX_TARGET_VS}-v${VERSION}/include/vpx")
|
||||
list(LENGTH LIBVPX_INCLUDE_DIR_CANDIDATES _vpx_n)
|
||||
if(_vpx_n EQUAL 0)
|
||||
message(FATAL_ERROR "libvpx: no dist include directory found under ${CURRENT_BUILDTREES_DIR}/${TARGET_TRIPLET}-rel/")
|
||||
elseif(_vpx_n GREATER 1)
|
||||
message(FATAL_ERROR "libvpx: found ${_vpx_n} candidate dist directories; expected exactly one")
|
||||
endif()
|
||||
list(GET LIBVPX_INCLUDE_DIR_CANDIDATES 0 LIBVPX_INCLUDE_DIR)
|
||||
file(
|
||||
INSTALL
|
||||
"${LIBVPX_INCLUDE_DIR}"
|
||||
|
|
|
|||
|
|
@ -1,7 +1,7 @@
|
|||
{
|
||||
"name": "libvpx",
|
||||
"version": "1.16.0",
|
||||
"port-version": 1,
|
||||
"port-version": 2,
|
||||
"description": "The reference software implementation for the video coding formats VP8 and VP9.",
|
||||
"homepage": "https://github.com/webmproject/libvpx",
|
||||
"license": "BSD-3-Clause",
|
||||
|
|
|
|||
|
|
@ -5870,7 +5870,7 @@
|
|||
},
|
||||
"libvpx": {
|
||||
"baseline": "1.16.0",
|
||||
"port-version": 1
|
||||
"port-version": 2
|
||||
},
|
||||
"libwandio": {
|
||||
"baseline": "4.2.6-1",
|
||||
|
|
|
|||
|
|
@ -1,5 +1,10 @@
|
|||
{
|
||||
"versions": [
|
||||
{
|
||||
"git-tree": "6ceb7c67ef2fd1729a37204404ef21fc5647154f",
|
||||
"version": "1.16.0",
|
||||
"port-version": 2
|
||||
},
|
||||
{
|
||||
"git-tree": "5bd5e772e786f6c6c223e2ad94e5a4de30415246",
|
||||
"version": "1.16.0",
|
||||
|
|
|
|||
Loading…
Reference in New Issue