Search share/renderdoc/pylibs for python libs.

* This is only relevant for static qrenderdoc builds where the python
  used isn't the system python, so it needs to locate its libs.
  Otherwise the system libpython3.so and libs will be used.
This commit is contained in:
baldurk
2017-04-19 18:07:56 +01:00
parent 9441e15ebc
commit 8824e18b0a
2 changed files with 19 additions and 3 deletions
@@ -41,7 +41,9 @@ PyTypeObject **SbkPySide2_QtWidgetsTypes = NULL;
#include <QApplication>
#include <QDebug>
#include <QDir>
#include <QFile>
#include <QFileInfo>
#include <QThread>
#include <QTimer>
#include "PythonContext.h"
@@ -112,6 +114,7 @@ static inline QString ToQStr(PyObject *value)
}
static wchar_t program_name[] = L"qrenderdoc";
static wchar_t python_home[1024] = {0};
struct OutputRedirector
{
@@ -207,6 +210,19 @@ void PythonContext::GlobalInit()
PyImport_AppendInittab("_renderdoc", &PyInit__renderdoc);
PyImport_AppendInittab("_qrenderdoc", &PyInit__qrenderdoc);
#if defined(STATIC_QRENDERDOC)
// add the location where our libs will be for statically-linked python installs
{
QDir bin = QFileInfo(QCoreApplication::applicationFilePath()).absoluteDir();
QString pylibs = QDir::cleanPath(bin.absoluteFilePath("../share/renderdoc/pylibs"));
pylibs.toWCharArray(python_home);
Py_SetPythonHome(python_home);
}
#endif
Py_SetProgramName(program_name);
Py_Initialize();