Fix macos build failure

This commit is contained in:
Matthias Kuhn 2025-08-20 17:14:34 +02:00
parent 5fd8d6d898
commit 654cef5e27
9 changed files with 376 additions and 0 deletions

View File

@ -0,0 +1,13 @@
diff --git a/src/multimedia/windows/qwindowsaudiosink.cpp b/src/multimedia/windows/qwindowsaudiosink.cpp
index 157172c..2ba6319 100644
--- a/src/multimedia/windows/qwindowsaudiosink.cpp
+++ b/src/multimedia/windows/qwindowsaudiosink.cpp
@@ -285,7 +285,7 @@
}
uint32_t requiredDataSize = m_format.bytesForFrames(requiredFrames);
- auto hostBufferSpan = as_writable_bytes(QSpan{ hostBuffer, requiredDataSize });
+ auto hostBufferSpan = as_writable_bytes(QSpan{ hostBuffer, qsizetype(requiredDataSize) });
uint64_t consumedFrames = QPlatformAudioSinkStream::process(hostBufferSpan, requiredFrames);
DWORD flags = consumedFrames != 0 ? 0 : AUDCLNT_BUFFERFLAGS_SILENT;

View File

@ -0,0 +1,13 @@
diff --git a/src/plugins/multimedia/ffmpeg/CMakeLists.txt b/src/plugins/multimedia/ffmpeg/CMakeLists.txt
index 77c459a..af5229e 100644
--- a/src/plugins/multimedia/ffmpeg/CMakeLists.txt
+++ b/src/plugins/multimedia/ffmpeg/CMakeLists.txt
@@ -273,7 +273,7 @@ if(BUILD_SHARED_LIBS)
else()
foreach(ffmpeg_lib IN LISTS ffmpeg_libs)
qt_internal_add_target_include_dirs(FFmpegMediaPluginImplPrivate ${ffmpeg_lib})
- target_include_directories(FFmpegMediaPluginImplPrivate PUBLIC
+ target_compile_definitions(FFmpegMediaPluginImplPrivate PUBLIC
"$<TARGET_PROPERTY:${ffmpeg_lib},INTERFACE_COMPILE_DEFINITIONS>")
endforeach()
endif()

View File

@ -0,0 +1,26 @@
diff --git a/cmake/FindFFmpeg.cmake b/cmake/FindFFmpeg.cmake
index 0aa3ff9..b651472 100644
--- a/cmake/FindFFmpeg.cmake
+++ b/cmake/FindFFmpeg.cmake
@@ -287,13 +287,15 @@ function(__ffmpeg_internal_set_dependencies _component)
set(prefix_l "(^| )\\-l")
set(suffix_lib "\\.lib($| )")
- string(REGEX REPLACE ".*Libs:([^\n\r]+).*" "\\1" out "${pcfile}")
+ string(REGEX MATCH "Libs:([^\n\r]+)" match "${pcfile}")
+ set(out "${CMAKE_MATCH_1}")
- string(REGEX MATCHALL "${prefix_l}[^ ]+" libs_dependency ${out})
- string(REGEX MATCHALL "[^ ]+${suffix_lib}" libs_dependency_lib ${out})
+ string(REGEX MATCHALL "${prefix_l}[^ ]+" libs_dependency "${out}")
+ string(REGEX MATCHALL "[^ ]+${suffix_lib}" libs_dependency_lib "${out}")
- string(REGEX REPLACE ".*Libs.private:([^\n\r]+).*" "\\1" out "${pcfile}")
+ string(REGEX MATCH "Libs.private:([^\n\r]+)" match "${pcfile}")
+ set(out "${CMAKE_MATCH_1}")
- string(REGEX MATCHALL "${prefix_l}[^ ]+" libs_private_dependency ${out})
- string(REGEX MATCHALL "[^ ]+${suffix_lib}" libs_private_dependency_lib ${out})
+ string(REGEX MATCHALL "${prefix_l}[^ ]+" libs_private_dependency "${out}")
+ string(REGEX MATCHALL "[^ ]+${suffix_lib}" libs_private_dependency_lib "${out}")
list(APPEND deps_no_suffix ${libs_dependency} ${libs_private_dependency})
foreach(dependency ${deps_no_suffix})

View File

@ -0,0 +1,12 @@
diff --git a/src/plugins/multimedia/darwin/CMakeLists.txt b/src/plugins/multimedia/darwin/CMakeLists.txt
index a1a0cb1..242ceac 100644
--- a/src/plugins/multimedia/darwin/CMakeLists.txt
+++ b/src/plugins/multimedia/darwin/CMakeLists.txt
@@ -34,6 +34,6 @@ qt_internal_add_plugin(QDarwinMediaPlugin
${FWMetal}
${FWQuartzCore}
- AVFoundation::AVFoundation
+ ${FWAVFoundation}
)
qt_internal_extend_target(QDarwinMediaPlugin CONDITION NOT TVOS AND NOT VISIONOS

View File

@ -0,0 +1,30 @@
From 5fea89d9de0409e8495528b3cb03c4f25a24d19b Mon Sep 17 00:00:00 2001
From: Tim Blechmann <tim.blechmann@qt.io>
Date: Fri, 27 Jun 2025 09:55:46 +0800
Subject: [PATCH] darwin: include missing header
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
Fixes: QTBUG-138060
Pick-to: 6.8 6.9 6.10
Change-Id: Id0433597842c9e5b25101bf2f426b890db2f6e95
Reviewed-by: Tim Blechmann <tim.blechmann@qt.io>
Reviewed-by: Nils Petter Skålerud <nils.petter.skalerud@qt.io>
---
src/plugins/multimedia/darwin/mediaplayer/avfdisplaylink.mm | 2 ++
1 file changed, 2 insertions(+)
diff --git a/src/plugins/multimedia/darwin/mediaplayer/avfdisplaylink.mm b/src/plugins/multimedia/darwin/mediaplayer/avfdisplaylink.mm
index 8c375403af..1e707a1132 100644
--- a/src/plugins/multimedia/darwin/mediaplayer/avfdisplaylink.mm
+++ b/src/plugins/multimedia/darwin/mediaplayer/avfdisplaylink.mm
@@ -4,6 +4,8 @@
#include "avfdisplaylink_p.h"
#include <QtCore/qcoreapplication.h>
+#include <mutex>
+
#ifdef QT_DEBUG_AVF
#include <QtCore/qdebug.h>
#endif

View File

@ -0,0 +1,75 @@
set(SCRIPT_PATH "${CURRENT_INSTALLED_DIR}/share/qtbase")
include("${SCRIPT_PATH}/qt_install_submodule.cmake")
set(${PORT}_PATCHES
static_find_modules.patch
fix_avfoundation_target.patch
remove-static-ssl-stub.patch
ffmpeg-compile-def.patch
ffmpeg.patch
9c33ede.diff
macos_missing_include.patch
)
vcpkg_check_features(OUT_FEATURE_OPTIONS FEATURE_OPTIONS
FEATURES
"qml" CMAKE_REQUIRE_FIND_PACKAGE_Qt6Quick
"widgets" CMAKE_REQUIRE_FIND_PACKAGE_Qt6Widgets
INVERTED_FEATURES
"qml" CMAKE_DISABLE_FIND_PACKAGE_Qt6Quick
"widgets" CMAKE_DISABLE_FIND_PACKAGE_Qt6Widgets
"gstreamer" CMAKE_DISABLE_FIND_PACKAGE_GStreamer
"ffmpeg" CMAKE_DISABLE_FIND_PACKAGE_FFmpeg
# Features not yet added in the manifest:
"vaapi" CMAKE_DISABLE_FIND_PACKAGE_VAAPI # not in vpckg
)
set(unused "")
if("gstreamer" IN_LIST FEATURES)
list(APPEND FEATURE_OPTIONS "-DINPUT_gstreamer='yes'")
else()
list(APPEND FEATURE_OPTIONS "-DINPUT_gstreamer='no'")
list(APPEND unused INPUT_gstreamer_gl INPUT_gstreamer_photography)
endif()
list(APPEND FEATURE_OPTIONS "-DINPUT_gstreamer_gl='no'")
list(APPEND FEATURE_OPTIONS "-DINPUT_gstreamer_photography='no'")
if(VCPKG_TARGET_IS_WINDOWS)
list(APPEND FEATURE_OPTIONS "-DFEATURE_wmf=ON")
else()
list(APPEND FEATURE_OPTIONS "-DFEATURE_wmf=OFF")
endif()
if("ffmpeg" IN_LIST FEATURES)
# Note: Requires pulsadio on linux and wmfsdk on windows
list(APPEND FEATURE_OPTIONS "-DINPUT_ffmpeg='yes'")
if(VCPKG_TARGET_IS_WINDOWS OR VCPKG_TARGET_IS_OSX OR VCPKG_TARGET_IS_ANDROID)
list(APPEND FEATURE_OPTIONS "-DINPUT_pulseaudio='no'")
else()
list(APPEND FEATURE_OPTIONS "-DINPUT_pulseaudio='yes'")
endif()
else()
list(APPEND FEATURE_OPTIONS "-DINPUT_ffmpeg='no'")
list(APPEND FEATURE_OPTIONS "-DINPUT_pulseaudio='no'")
endif()
# alsa is not ready
if(NOT "ffmpeg" IN_LIST FEATURES AND NOT "gstreamer" IN_LIST FEATURES AND VCPKG_TARGET_IS_LINUX)
#list(APPEND FEATURE_OPTIONS "-DFEATURE_alsa=ON") # alsa is experimental so don't activate it (also missing the dep on it.)
message(FATAL_ERROR "You need to activate at least one backend.")
else()
list(APPEND FEATURE_OPTIONS "-DFEATURE_alsa=OFF")
endif()
qt_install_submodule(PATCHES ${${PORT}_PATCHES}
CONFIGURE_OPTIONS
${FEATURE_OPTIONS}
-DCMAKE_FIND_PACKAGE_TARGETS_GLOBAL=ON
CONFIGURE_OPTIONS_RELEASE
CONFIGURE_OPTIONS_DEBUG
CONFIGURE_OPTIONS_MAYBE_UNUSED ${unused}
)
if("gstreamer" IN_LIST FEATURES AND VCPKG_LIBRARY_LINKAGE STREQUAL "static")
vcpkg_replace_string("${CURRENT_PACKAGES_DIR}/share/Qt6Multimedia/Qt6QGstreamerMediaPluginDependencies.cmake" "GStreamer\;FALSE\;\;\;;GStreamer\;FALSE\;\;App\;;GStreamer\;FALSE\;\;\;Gl" "GStreamer\;FALSE\;\;\;;GStreamer\;FALSE\;\;App\;;GStreamer\;FALSE\;\;\;Gl;EGL\;FALSE\;\;\;" IGNORE_UNCHANGED)
endif()

View File

@ -0,0 +1,26 @@
diff --git a/src/plugins/multimedia/ffmpeg/cmake/QtAddFFmpegStubs.cmake b/src/plugins/multimedia/ffmpeg/cmake/QtAddFFmpegStubs.cmake
index 5778ae4d23..8c0df4b44d 100644
--- a/src/plugins/multimedia/ffmpeg/cmake/QtAddFFmpegStubs.cmake
+++ b/src/plugins/multimedia/ffmpeg/cmake/QtAddFFmpegStubs.cmake
@@ -70,7 +70,10 @@ macro(qt_internal_multimedia_find_openssl_soversion)
if (NOT OPENSSL_SSL_LIBRARY)
message(FATAL_ERROR "OPENSSL_SSL_LIBRARY is not found")
endif()
-
+ set(openssl_is_shared ON)
+ if(OPENSSL_SSL_LIBRARY MATCHES "${CMAKE_STATIC_LIBRARY_SUFFIX}$")
+ set(openssl_is_shared OFF)
+ endif()
get_filename_component(ssl_lib_realpath "${OPENSSL_SSL_LIBRARY}" REALPATH)
string(REGEX MATCH "[0-9]+(\\.[0-9]+)*[a-z]?$" ssl_soversion "${ssl_lib_realpath}")
@@ -187,6 +190,9 @@ function(qt_internal_multimedia_add_ffmpeg_stubs)
if (ffmpeg_has_openssl)
qt_internal_multimedia_find_openssl_soversion()
+ if(NOT openssl_is_shared)
+ list(REMOVE_ITEM FFMPEG_STUBS ssl crypto)
+ endif()
endif()
foreach (stub ${FFMPEG_STUBS})

View File

@ -0,0 +1,82 @@
diff --git a/cmake/FindFFmpeg.cmake b/cmake/FindFFmpeg.cmake
index 47d8769..46a5c9b 100644
--- a/cmake/FindFFmpeg.cmake
+++ b/cmake/FindFFmpeg.cmake
@@ -215,7 +215,7 @@ foreach (_component ${FFmpeg_FIND_COMPONENTS})
find_component(${_component} "lib${library}" ${library} "lib${library}/${library}.h")
if (${_component}_FOUND)
- list(APPEND FFMPEG_LIBRARIES ${${_component}_LIBRARY_NAME})
+ list(APPEND FFMPEG_LIBRARIES ${${_component}_LIBRARY})
list(APPEND FFMPEG_DEFINITIONS ${${_component}_DEFINITIONS})
list(APPEND FFMPEG_INCLUDE_DIRS ${${_component}_INCLUDE_DIR})
list(APPEND FFMPEG_LIBRARY_DIRS ${${_component}_LIBRARY_DIR})
@@ -306,18 +306,19 @@ endfunction()
string(TOLOWER ${_component} _lowerComponent)
if (NOT TARGET FFmpeg::${_lowerComponent})
- add_library(FFmpeg::${_lowerComponent} INTERFACE IMPORTED)
+ add_library(FFmpeg::${_lowerComponent} UNKNOWN IMPORTED)
set_target_properties(FFmpeg::${_lowerComponent} PROPERTIES
INTERFACE_COMPILE_OPTIONS "${${_component}_DEFINITIONS}"
INTERFACE_INCLUDE_DIRECTORIES ${${_component}_INCLUDE_DIR}
- INTERFACE_LINK_LIBRARIES "${${_component}_LIBRARY_NAME}"
- INTERFACE_LINK_DIRECTORIES "${${_component}_LIBRARY_DIR}"
+ IMPORTED_LOCATION "${${_component}_LIBRARY}"
)
__ffmpeg_internal_set_dependencies(${_component})
- target_link_libraries(FFmpeg::${_lowerComponent} INTERFACE "${${_component}_LIBRARY_NAME}")
+ if(WIN32 AND _lowerComponent STREQUAL "avutil")
+ target_link_libraries(FFmpeg::${_lowerComponent} INTERFACE "Bcrypt.lib")
+ endif()
if (UNIX AND NOT APPLE)
target_link_options(FFmpeg::${_lowerComponent} INTERFACE "-Wl,--exclude-libs=lib${_lowerComponent}")
endif ()
endif()
endif()
endforeach ()
@@ -361,14 +364,18 @@ if (shared_libs_desired AND NOT FFMPEG_SHARED_COMPONENTS)
endif()
if (NOT TARGET FFmpeg::FFmpeg)
- add_library(FFmpeg INTERFACE)
+ add_library(FFmpeg INTERFACE IMPORTED)
set_target_properties(FFmpeg PROPERTIES
INTERFACE_COMPILE_OPTIONS "${FFMPEG_DEFINITIONS}"
INTERFACE_INCLUDE_DIRECTORIES "${FFMPEG_INCLUDE_DIRS}"
- INTERFACE_LINK_LIBRARIES "${FFMPEG_LIBRARIES}"
INTERFACE_LINK_DIRECTORIES "${FFMPEG_LIBRARY_DIRS}"
)
+ target_link_libraries(FFmpeg INTERFACE ${FFMPEG_LIBRARIES})
- add_library(FFmpeg::FFmpeg ALIAS FFmpeg)
+ if(WIN32)
+ target_link_libraries(FFmpeg INTERFACE "Bcrypt.lib")
+ endif()
+ add_library(FFmpeg::FFmpeg INTERFACE IMPORTED)
+ target_link_libraries(FFmpeg::FFmpeg INTERFACE FFmpeg)
endif()
# Compile the list of required vars
diff --git a/cmake/FindGObject.cmake b/cmake/FindGObject.cmake
index 19a8a67..09e95d1 100644
--- a/cmake/FindGObject.cmake
+++ b/cmake/FindGObject.cmake
@@ -13,8 +13,8 @@
# ``GObject::GObject``
# The gobject-2.0 library
-include(CMakeFindDependencyMacro)
-find_dependency(GLIB2)
+find_package(GLIB2)
+find_package(libffi)
qt_internal_disable_find_package_global_promotion(GLIB2::GLIB2)
if(NOT TARGET GObject::GObject)
@@ -40,6 +40,7 @@ if(NOT TARGET GObject::GObject)
target_link_libraries(GObject::GObject INTERFACE
${GObject_LIBRARY}
GLIB2::GLIB2
+ libffi
)
endif()
include(FindPackageHandleStandardArgs)

View File

@ -0,0 +1,99 @@
{
"name": "qtmultimedia",
"version": "6.9.1",
"description": "Qt Multimedia is an add-on module that provides a rich set of QML types and C++ classes to handle multimedia content.",
"homepage": "https://www.qt.io/",
"license": null,
"dependencies": [
{
"name": "qtbase",
"default-features": false,
"features": [
"concurrent",
"gui",
"network"
]
},
{
"name": "qtshadertools",
"default-features": false
}
],
"default-features": [
{
"name": "gstreamer",
"platform": "linux"
},
"widgets"
],
"features": {
"ffmpeg": {
"description": "Build with ffmpeg",
"dependencies": [
{
"name": "ffmpeg",
"default-features": false,
"features": [
"avcodec",
"avdevice",
"avformat",
"swresample",
"swscale"
]
},
{
"name": "pulseaudio",
"platform": "linux"
},
{
"name": "qtdeclarative",
"default-features": false
},
{
"name": "qtmultimedia",
"default-features": false,
"features": [
"qml"
],
"platform": "linux"
}
]
},
"gstreamer": {
"description": "Build with gstreamer",
"supports": "linux",
"dependencies": [
"egl",
{
"name": "gstreamer",
"default-features": false,
"features": [
"plugins-bad",
"plugins-base"
]
}
]
},
"qml": {
"description": "Build QML imports",
"dependencies": [
{
"name": "qtdeclarative",
"default-features": false
}
]
},
"widgets": {
"description": "Build Multimedia Widgets",
"dependencies": [
{
"name": "qtbase",
"default-features": false,
"features": [
"widgets"
]
}
]
}
}
}