From 249e5d41d2492dd3af9cfc7c4633b9c424ba8d2d Mon Sep 17 00:00:00 2001 From: Sean Link Date: Tue, 19 Mar 2024 10:59:53 -0600 Subject: [PATCH 1/2] qt6.qtdeclarative: add mingw support Part of a larger effort to add mingw support for qtmultimedia. --- .../libraries/qt-6/modules/qtdeclarative.nix | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) diff --git a/pkgs/development/libraries/qt-6/modules/qtdeclarative.nix b/pkgs/development/libraries/qt-6/modules/qtdeclarative.nix index 697556e30edc..d9c0e2bb9a07 100644 --- a/pkgs/development/libraries/qt-6/modules/qtdeclarative.nix +++ b/pkgs/development/libraries/qt-6/modules/qtdeclarative.nix @@ -3,16 +3,28 @@ , qtlanguageserver , qtshadertools , openssl +, stdenv , python3 +, lib +, pkgsBuildBuild }: qtModule { pname = "qtdeclarative"; - propagatedBuildInputs = [ qtbase qtlanguageserver qtshadertools openssl python3 ]; + strictDeps = true; + propagatedBuildInputs = [ qtbase qtlanguageserver qtshadertools openssl ]; + nativeBuildInputs = [ python3 ]; patches = [ # prevent headaches from stale qmlcache data ../patches/qtdeclarative-default-disable-qmlcache.patch # add version specific QML import path ../patches/qtdeclarative-qml-paths.patch ]; + cmakeFlags = [ + "-DQt6ShaderToolsTools_DIR=${pkgsBuildBuild.qt6.qtshadertools}/lib/cmake/Qt6ShaderTools" + ] + # Conditional is required to prevent infinite recursion during a cross build + ++ lib.optionals (!stdenv.buildPlatform.canExecute stdenv.hostPlatform) [ + "-DQt6QmlTools_DIR=${pkgsBuildBuild.qt6.qtdeclarative}/lib/cmake/Qt6QmlTools" + ]; } From bd8bafe359711874a822511b387e6c0f96b8d617 Mon Sep 17 00:00:00 2001 From: Sean Link Date: Wed, 20 Mar 2024 11:23:36 -0600 Subject: [PATCH 2/2] qt6.qtmultimedia: add mingw support --- .../libraries/qt-6/modules/qtmultimedia.nix | 17 +++++++++-- ...multimedia-windows-no-uppercase-libs.patch | 13 ++++++++ ...imedia-windows-resolve-function-name.patch | 30 +++++++++++++++++++ 3 files changed, 57 insertions(+), 3 deletions(-) create mode 100644 pkgs/development/libraries/qt-6/patches/qtmultimedia-windows-no-uppercase-libs.patch create mode 100644 pkgs/development/libraries/qt-6/patches/qtmultimedia-windows-resolve-function-name.patch diff --git a/pkgs/development/libraries/qt-6/modules/qtmultimedia.nix b/pkgs/development/libraries/qt-6/modules/qtmultimedia.nix index 5c9a0e58a82c..974f8f98bdc0 100644 --- a/pkgs/development/libraries/qt-6/modules/qtmultimedia.nix +++ b/pkgs/development/libraries/qt-6/modules/qtmultimedia.nix @@ -22,18 +22,29 @@ , libunwind , orc , VideoToolbox +, pkgsBuildBuild }: qtModule { pname = "qtmultimedia"; nativeBuildInputs = [ pkg-config ]; - buildInputs = [ libunwind orc ffmpeg_6 ] + buildInputs = [ ffmpeg_6 ] + ++ lib.optionals (!stdenv.hostPlatform.isMinGW) [ libunwind orc ] ++ lib.optionals stdenv.hostPlatform.isLinux [ libpulseaudio elfutils alsa-lib wayland libXrandr libva ]; - propagatedBuildInputs = [ qtbase qtdeclarative qtsvg qtshadertools qtquick3d ] + propagatedBuildInputs = [ qtbase qtdeclarative qtsvg qtshadertools ] + ++ lib.optionals (!stdenv.hostPlatform.isMinGW) [ qtquick3d ] ++ lib.optionals stdenv.hostPlatform.isLinux [ gstreamer gst-plugins-base gst-plugins-good gst-libav gst-vaapi ] ++ lib.optionals stdenv.hostPlatform.isDarwin [ VideoToolbox ]; - cmakeFlags = [ "-DENABLE_DYNAMIC_RESOLVE_VAAPI_SYMBOLS=0" ]; + patches = lib.optionals stdenv.hostPlatform.isMinGW [ + ../patches/qtmultimedia-windows-no-uppercase-libs.patch + ../patches/qtmultimedia-windows-resolve-function-name.patch + ]; + + cmakeFlags = [ + "-DENABLE_DYNAMIC_RESOLVE_VAAPI_SYMBOLS=0" + "-DQt6ShaderToolsTools_DIR=${pkgsBuildBuild.qt6.qtshadertools}/lib/cmake/Qt6ShaderToolsTools" + ]; env.NIX_CFLAGS_COMPILE = lib.optionalString stdenv.hostPlatform.isDarwin "-include AudioToolbox/AudioToolbox.h"; diff --git a/pkgs/development/libraries/qt-6/patches/qtmultimedia-windows-no-uppercase-libs.patch b/pkgs/development/libraries/qt-6/patches/qtmultimedia-windows-no-uppercase-libs.patch new file mode 100644 index 000000000000..05f009bacdad --- /dev/null +++ b/pkgs/development/libraries/qt-6/patches/qtmultimedia-windows-no-uppercase-libs.patch @@ -0,0 +1,13 @@ +diff --git a/src/plugins/multimedia/ffmpeg/qffmpegscreencapture_dxgi.cpp b/src/plugins/multimedia/ffmpeg/qffmpegscreencapture_dxgi.cpp +index c0fbb53..3c82085 100644 +--- a/src/plugins/multimedia/ffmpeg/qffmpegscreencapture_dxgi.cpp ++++ b/src/plugins/multimedia/ffmpeg/qffmpegscreencapture_dxgi.cpp +@@ -14,7 +14,7 @@ + #include + #include + +-#include "D3d11.h" ++#include "d3d11.h" + #include "dxgi1_2.h" + + #include diff --git a/pkgs/development/libraries/qt-6/patches/qtmultimedia-windows-resolve-function-name.patch b/pkgs/development/libraries/qt-6/patches/qtmultimedia-windows-resolve-function-name.patch new file mode 100644 index 000000000000..681e36e0c513 --- /dev/null +++ b/pkgs/development/libraries/qt-6/patches/qtmultimedia-windows-resolve-function-name.patch @@ -0,0 +1,30 @@ +diff --git a/src/plugins/multimedia/ffmpeg/qwincapturablewindows.cpp b/src/plugins/multimedia/ffmpeg/qwincapturablewindows.cpp +index aac77ae..71ffed6 100644 +--- a/src/plugins/multimedia/ffmpeg/qwincapturablewindows.cpp ++++ b/src/plugins/multimedia/ffmpeg/qwincapturablewindows.cpp +@@ -42,11 +42,7 @@ static QString windowTitle(HWND hwnd) { + return QString::fromStdWString(buffer); + } + +-QList QWinCapturableWindows::windows() const +-{ +- QList result; +- +- auto windowHandler = [](HWND hwnd, LPARAM lParam) { ++static int __stdcall windowHandler(HWND hwnd, LPARAM lParam) { + if (!canCaptureWindow(hwnd)) + return TRUE; // Ignore window and continue enumerating + +@@ -58,7 +54,11 @@ QList QWinCapturableWindows::windows() const + windows.push_back(windowData.release()->create()); + + return TRUE; +- }; ++} ++ ++QList QWinCapturableWindows::windows() const ++{ ++ QList result; + + ::EnumWindows(windowHandler, reinterpret_cast(&result)); +