aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorFriedemann Kleint <Friedemann.Kleint@qt.io>2018-08-21 13:55:51 +0200
committerFriedemann Kleint <Friedemann.Kleint@qt.io>2018-08-21 12:57:30 +0000
commit220a6c5c759278fcf9b80a1ce3f90608d1f407a9 (patch)
tree235f478eaf960b2618caa26348257261c7581867
parent7586c0bf5dc027465d1e33cbdfddf06150966e38 (diff)
First fixes for Windows
- Clean the paths - Make g++ specific options depending on compiler - ifdef out dlopen of the Python libraries - Do not use protected hack Change-Id: I979ed9362e55481a1452c0d7a6e8eba2355c6df4 Reviewed-by: hjk <hjk@qt.io>
-rw-r--r--plugins/pythonextensions/pyside2.pri9
-rw-r--r--plugins/pythonextensions/pythonextensions.pro2
-rw-r--r--plugins/pythonextensions/pyutil.cpp6
-rw-r--r--plugins/pythonextensions/qtcreator.pri4
4 files changed, 15 insertions, 6 deletions
diff --git a/plugins/pythonextensions/pyside2.pri b/plugins/pythonextensions/pyside2.pri
index 3e6cc23..62acd30 100644
--- a/plugins/pythonextensions/pyside2.pri
+++ b/plugins/pythonextensions/pyside2.pri
@@ -3,6 +3,7 @@
PYSIDE_CONFIG = ../../tools/pyside2_config.py
PYSIDE2 = $$system($$PYTHON $$PYSIDE_CONFIG --pyside2)
+PYSIDE2 = $$clean_path($$PYSIDE2)
isEmpty(PYSIDE2): error(Unable to locate the PySide2 package location)
PYTHON_INCLUDE = $$system($$PYTHON $$PYSIDE_CONFIG --python-include)
@@ -37,6 +38,8 @@ LIBS += -ldl
# Suppress non-relevant warnings from
# Shiboken generated code
-QMAKE_CXXFLAGS += \
- -Wno-missing-field-initializers \
- -Wno-unused-parameter
+*g++* {
+ QMAKE_CXXFLAGS += \
+ -Wno-missing-field-initializers \
+ -Wno-unused-parameter
+}
diff --git a/plugins/pythonextensions/pythonextensions.pro b/plugins/pythonextensions/pythonextensions.pro
index 26db752..eb24db6 100644
--- a/plugins/pythonextensions/pythonextensions.pro
+++ b/plugins/pythonextensions/pythonextensions.pro
@@ -45,6 +45,8 @@ SHIBOKEN_OPTIONS = --generator-set=shiboken --enable-parent-ctor-heuristic \
--enable-pyside-extensions --enable-return-value-heuristic --use-isnull-as-nb_nonzero \
$$QT_INCLUDEPATHS -I$$PWD -T$$PWD -T$$PYSIDE2/typesystems --output-directory=$$OUT_PWD
+win32: SHIBOKEN_OPTIONS += --avoid-protected-hack
+
## Prepare the shiboken tool
QT_TOOL.shiboken.binary = $$system_path($$PYSIDE2/shiboken2)
qtPrepareTool(SHIBOKEN, shiboken)
diff --git a/plugins/pythonextensions/pyutil.cpp b/plugins/pythonextensions/pyutil.cpp
index 56f7c03..8f2728f 100644
--- a/plugins/pythonextensions/pyutil.cpp
+++ b/plugins/pythonextensions/pyutil.cpp
@@ -25,7 +25,9 @@
#include "pyutil.h"
-#include <dlfcn.h> // dlopen
+#ifdef Q_OS_UNIX
+# include <dlfcn.h> // dlopen
+#endif
#include <QtCore/QByteArray>
#include <QtCore/QCoreApplication>
@@ -94,12 +96,14 @@ State init()
// Python's shared libraries don't work properly if included from other
// shared libraries. See https://mail.python.org/pipermail/new-bugs-announce/2008-November/003322.html
+#ifdef Q_OS_UNIX
#if PY_MAJOR_VERSION >= 3
std::string version = "libpython"+std::to_string(PY_MAJOR_VERSION)+"."+std::to_string(PY_MINOR_VERSION)+"m.so";
#else
std::string version = "libpython"+std::to_string(PY_MAJOR_VERSION)+"."+std::to_string(PY_MINOR_VERSION)+".so";
#endif
dlopen(version.c_str(), RTLD_LAZY | RTLD_GLOBAL);
+#endif
Py_Initialize();
qAddPostRoutine(cleanup);
diff --git a/plugins/pythonextensions/qtcreator.pri b/plugins/pythonextensions/qtcreator.pri
index cb58e20..499fda2 100644
--- a/plugins/pythonextensions/qtcreator.pri
+++ b/plugins/pythonextensions/qtcreator.pri
@@ -3,11 +3,11 @@
## Either set the IDE_SOURCE_TREE when running qmake,
## or set the QTC_SOURCE environment variable, to override the default setting
-isEmpty(IDE_SOURCE_TREE): IDE_SOURCE_TREE = $$(QTC_SOURCE)
+isEmpty(IDE_SOURCE_TREE): IDE_SOURCE_TREE = $$clean_path($$(QTC_SOURCE))
## Either set the IDE_BUILD_TREE when running qmake,
## or set the QTC_BUILD environment variable, to override the default setting
-isEmpty(IDE_BUILD_TREE): IDE_BUILD_TREE = $$(QTC_BUILD)
+isEmpty(IDE_BUILD_TREE): IDE_BUILD_TREE = $$clean_path($$(QTC_BUILD))
# KEEP this line and DON'T edit it!
# (if you NEED to change it, have a look at tools/build.py)