aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorEike Ziller <eike.ziller@qt.io>2018-09-13 13:38:35 +0200
committerEike Ziller <eike.ziller@qt.io>2018-09-14 09:46:31 +0000
commitd3714d329c292f4930fea8c0d9aa33ed59b12f38 (patch)
tree8ac5ca427a487837cd0df2e4257e261ec936ce6f
parent876ff8853f42b4ea6fae60adf994f531898cba57 (diff)
Move shiboken setup to reusable file
Change-Id: I4f832fdeedb07105806dce4f673afb5cf679ed9f Reviewed-by: Friedemann Kleint <Friedemann.Kleint@qt.io>
-rw-r--r--plugins/pythonextensions/pythonextensions.pro64
-rw-r--r--shiboken.pri63
2 files changed, 68 insertions, 59 deletions
diff --git a/plugins/pythonextensions/pythonextensions.pro b/plugins/pythonextensions/pythonextensions.pro
index 7f0c2b2..c8fe73d 100644
--- a/plugins/pythonextensions/pythonextensions.pro
+++ b/plugins/pythonextensions/pythonextensions.pro
@@ -1,7 +1,3 @@
-# NOTE: This is not yet properly tested on general systems
-# and will (if at all) probably only work on a linux environment
-
-PYTHON = python
DEFINES += PYTHONEXTENSIONS_LIBRARY
# PythonExtensions files
@@ -15,6 +11,7 @@ HEADERS += \
pythonextensions_global.h \
pyutil.h
+INCLUDEPATH += $$PWD
# Qt Creator linking
@@ -24,44 +21,13 @@ include(qtcreator.pri)
include($$IDE_SOURCE_TREE/src/qtcreatorplugin.pri)
-# Shiboken stuff
-
-# This setup is currently only tested on Linux
+# Qt Creator Core bindings
-WRAPPED_HEADER = wrappedclasses.h
+WRAPPED_HEADER = $$PWD/wrappedclasses.h
WRAPPER_DIR = $$OUT_PWD/PythonExtension/QtCreator
TYPESYSTEM_FILE = typesystem_qtcreator.xml
-
-include(pyside2.pri)
-
-# Qt include paths
+TYPESYSTEM_NAME = qtcreator
SHIBOKEN_QT = core gui widgets
-for (qt, SHIBOKEN_QT) {
- SHIBOKEN_INCLUDEPATHS *= $$eval(QT.$${qt}.includes)
- SHIBOKEN_FRAMEWORKPATHS *= $$eval(QT.$${qt}.frameworks)
-}
-
-# Qt Creator include paths
-SHIBOKEN_INCLUDEPATHS *= $$INCLUDEPATH
-for (path, SHIBOKEN_INCLUDEPATHS): SHIBOKEN_CXXFLAGS *= -I$$path
-for (path, SHIBOKEN_FRAMEWORKPATHS): SHIBOKEN_CXXFLAGS *= -F$$path
-
-SHIBOKEN_OPTIONS = --generator-set=shiboken --enable-parent-ctor-heuristic \
- --enable-pyside-extensions --enable-return-value-heuristic --use-isnull-as-nb_nonzero \
- $$SHIBOKEN_CXXFLAGS -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)
-
-## Shiboken run that adds the module wrapper to GENERATED_SOURCES
-shiboken.output = $$WRAPPER_DIR/qtcreator_module_wrapper.cpp
-shiboken.commands = $$SHIBOKEN $$SHIBOKEN_OPTIONS $$PWD/wrappedclasses.h ${QMAKE_FILE_IN}
-shiboken.input = TYPESYSTEM_FILE
-shiboken.dependency_type = TYPE_C
-shiboken.variable_out = GENERATED_SOURCES
## These headers are needed so the generated wrappers are added to the
## build. Right now they are empty files, however there might be a more elegant
@@ -93,24 +59,4 @@ WRAPPED_CLASSES = \
bindingheaders/extensionsystem_iplugin.h
# Sentinel line
-module_wrapper_dummy_command.output = $$WRAPPER_DIR/${QMAKE_FILE_BASE}_wrapper.cpp
-module_wrapper_dummy_command.commands = echo ${QMAKE_FILE_IN}
-module_wrapper_dummy_command.depends = $$WRAPPER_DIR/qtcreator_module_wrapper.cpp
-module_wrapper_dummy_command.input = WRAPPED_CLASSES
-module_wrapper_dummy_command.dependency_type = TYPE_C
-module_wrapper_dummy_command.variable_out = GENERATED_SOURCES
-
-QMAKE_EXTRA_COMPILERS += shiboken module_wrapper_dummy_command
-
-# TODO: Fix some more of these hardcoded include paths
-INCLUDEPATH += $$WRAPPER_DIR \
- "$$IDE_SOURCE_TREE/src/plugins/coreplugin" \
- "$$IDE_SOURCE_TREE/src/plugins/coreplugin/actionmanager" \
- "$$IDE_SOURCE_TREE/src/plugins/coreplugin/editormanager" \
- "$$IDE_SOURCE_TREE/src/libs/extensionsystem" \
- "$$IDE_SOURCE_TREE/src/libs/utils" \
- "$$PWD"
-
-for(i, PYSIDE2_INCLUDE) {
- INCLUDEPATH += $$i/QtWidgets $$i/QtGui $$i/QtCore
-}
+include(../../shiboken.pri)
diff --git a/shiboken.pri b/shiboken.pri
new file mode 100644
index 0000000..29e81b9
--- /dev/null
+++ b/shiboken.pri
@@ -0,0 +1,63 @@
+# Usage: Define variables (details below) and include this pri file afterwards.
+#
+# WRAPPED_HEADER
+# WRAPPER_DIR
+# TYPESYSTEM_FILE
+# TYPESYSTEM_NAME
+# SHIBOKEN_QT
+# WRAPPED_CLASSES
+
+PYTHON = python
+
+include(plugins/pythonextensions/pyside2.pri)
+
+# Qt include paths
+for (qt, SHIBOKEN_QT) {
+ SHIBOKEN_INCLUDEPATHS *= $$eval(QT.$${qt}.includes)
+ SHIBOKEN_FRAMEWORKPATHS *= $$eval(QT.$${qt}.frameworks)
+}
+
+# Qt Creator include paths
+SHIBOKEN_INCLUDEPATHS *= $$INCLUDEPATH
+for (path, SHIBOKEN_INCLUDEPATHS): SHIBOKEN_CXXFLAGS *= -I$$path
+for (path, SHIBOKEN_FRAMEWORKPATHS): SHIBOKEN_CXXFLAGS *= -F$$path
+
+SHIBOKEN_OPTIONS = --generator-set=shiboken --enable-parent-ctor-heuristic \
+ --enable-pyside-extensions --enable-return-value-heuristic --use-isnull-as-nb_nonzero \
+ $$SHIBOKEN_CXXFLAGS -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)
+
+## Shiboken run that adds the module wrapper to GENERATED_SOURCES
+shiboken.output = $$WRAPPER_DIR/$${TYPESYSTEM_NAME}_module_wrapper.cpp
+shiboken.commands = $$SHIBOKEN $$SHIBOKEN_OPTIONS $$WRAPPED_HEADER ${QMAKE_FILE_IN}
+shiboken.input = TYPESYSTEM_FILE
+shiboken.dependency_type = TYPE_C
+shiboken.variable_out = GENERATED_SOURCES
+
+module_wrapper_dummy_command.output = $$WRAPPER_DIR/${QMAKE_FILE_BASE}_wrapper.cpp
+module_wrapper_dummy_command.commands = echo ${QMAKE_FILE_IN}
+module_wrapper_dummy_command.depends = $$WRAPPER_DIR/$${TYPESYSTEM_NAME}_module_wrapper.cpp
+module_wrapper_dummy_command.input = WRAPPED_CLASSES
+module_wrapper_dummy_command.dependency_type = TYPE_C
+module_wrapper_dummy_command.variable_out = GENERATED_SOURCES
+
+QMAKE_EXTRA_COMPILERS += shiboken module_wrapper_dummy_command
+
+# TODO: Fix some more of these hardcoded include paths
+INCLUDEPATH += $$WRAPPER_DIR \
+ $$WRAPPER_DIR/../../../plugins/pythonextensions \
+ $$WRAPPER_DIR/../../../plugins/pythonextensions/PythonExtension/QtCreator \
+ "$$IDE_SOURCE_TREE/src/plugins/coreplugin" \
+ "$$IDE_SOURCE_TREE/src/plugins/coreplugin/actionmanager" \
+ "$$IDE_SOURCE_TREE/src/plugins/coreplugin/editormanager" \
+ "$$IDE_SOURCE_TREE/src/libs/extensionsystem" \
+ "$$IDE_SOURCE_TREE/src/libs/utils"
+
+for(i, PYSIDE2_INCLUDE) {
+ for (qt, SHIBOKEN_QT): INCLUDEPATH += $$i/$$eval(QT.$${qt}.name)
+}