Add Qt5Qml.dll stub for 32-bit pyside2 distribution

* When the pyside2 we ship was built it accidentally included a small dependency
  on Qt5Qml, which we don't distribute so the pyside2 libraries wouldn't load.
* We can generate a tiny stub with the right exports and load it manually from
  the PySide2 folder on 32-bit qrenderdoc builds to allow pyside2 to load
  subsequently. The stub source is tiny, and added alongside.
* Putting it in the PySide2 folder means that even if someone puts RenderDoc's
  build folder in their PATH, our stub Qt5Qml won't break anything because it
  won't be loaded. If they put PySide2 in the PATH it might, but then it's their
  fault!
This commit is contained in:
baldurk
2020-08-28 13:01:19 +01:00
parent 0c1b304917
commit 285c4b95df
4 changed files with 42 additions and 0 deletions
Binary file not shown.
@@ -0,0 +1,24 @@
typedef unsigned long DWORD;
typedef void *HANDLE;
typedef void *LPVOID;
class QObject;
class QString;
class QQmlData {
public: __declspec(dllexport) static class QQmlData *__cdecl get(const QObject*,bool) {return 0;}
};
namespace QV4 {
struct Value;
struct ExecutionEngine {
__declspec(dllexport) unsigned __int64 __thiscall throwError(const QString&) {return 0;}
__declspec(dllexport) unsigned __int64 __thiscall throwSyntaxError(const QString&) {return 0;}
__declspec(dllexport) unsigned __int64 __thiscall throwTypeError(const QString&) {return 0;}
};
struct PersistentValueStorage {
__declspec(dllexport) static ExecutionEngine *__cdecl getEngine(Value*) {return 0;}
};
};
extern "C" long __stdcall _DllMainCRTStartup(HANDLE hDllHandle, DWORD dwReason, LPVOID lpreserved) {return 1;}
@@ -56,6 +56,11 @@ PyTypeObject **SbkPySide2_QtWidgetsTypes = NULL;
#endif
#ifdef _MSC_VER
// for the LoadLibrary call on 32-bit windows
#include <windows.h>
#endif
#include <QApplication>
#include <QDebug>
#include <QDir>
@@ -342,6 +347,14 @@ void PythonContext::GlobalInit()
// set up PySide
#if PYSIDE2_ENABLED
{
// hack for win32 builds, where our pyside2 accidentally depends on Qt5Qml.dll for no good
// reason and we ship a stub to allow the dll to load instead of rebuilding the whole of pyside2
// :S
#if defined(_MSC_VER) && !defined(_M_X64)
QString Qt5QmlStub = QApplication::applicationDirPath() + lit("/PySide2/Qt5Qml.dll");
LoadLibraryA(Qt5QmlStub.toUtf8().data());
#endif
Shiboken::AutoDecRef core(Shiboken::Module::import("PySide2.QtCore"));
if(!core.isNull())
SbkPySide2_QtCoreTypes = Shiboken::Module::getTypes(core);
+5
View File
@@ -1712,6 +1712,11 @@ IF %ERRORLEVEL% NEQ 0 (echo ====================================================
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
<Visible>false</Visible>
</Content>
<Content Include="3rdparty\pyside\$(Platform)\PySide2\Qt5Qml.dll" Condition="Exists('$(ProjectDir)3rdparty\pyside\$(Platform)\PySide2\Qt5Qml.dll')">
<Link>PySide2\Qt5Qml.dll</Link>
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
<Visible>false</Visible>
</Content>
<Content Include="3rdparty\pyside\$(Platform)\PySide2\__init__.py" Condition="Exists('$(ProjectDir)3rdparty\pyside\$(Platform)\PySide2\__init__.py')">
<Link>PySide2\__init__.py</Link>
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>