blob: 1324187a5db39e8c1c46127e586489ee1fa7dc6e (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
|
# 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
SOURCES += \
pythonextensionsplugin.cpp \
pyutil.cpp
HEADERS += \
pythonextensionsplugin.h \
pythonextensions_global.h \
pyutil.h
# Qt Creator linking
# Shared QtCreator sources and build destination
# (these are shared by this and the optional bindings)
include(qtcreator.pri)
include($$IDE_SOURCE_TREE/src/qtcreatorplugin.pri)
# Shiboken stuff
# This setup is currently only tested on Linux
WRAPPED_HEADER = wrappedclasses.h
WRAPPER_DIR = $$OUT_PWD/PythonExtension/QtCreator
TYPESYSTEM_FILE = typesystem_qtcreator.xml
include(pyside2.pri)
# Qt include paths
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
## option.
WRAPPED_CLASSES = \
bindingheaders/pythonextensions.h \
bindingheaders/pythonextensions_internal.h \
bindingheaders/pythonextensions_internal_pythonextensionsplugin.h \
bindingheaders/core.h \
bindingheaders/core_actioncontainer.h \
bindingheaders/core_actionmanager.h \
bindingheaders/core_command.h \
bindingheaders/core_constants.h \
bindingheaders/core_icontext.h \
bindingheaders/core_icore.h \
bindingheaders/core_id.h \
bindingheaders/core_context.h \
bindingheaders/core_editormanager.h \
bindingheaders/core_ieditor.h \
bindingheaders/core_idocument.h \
bindingheaders/core_documentmanager.h \
bindingheaders/core_documentmodel.h \
bindingheaders/core_fileutils.h \
bindingheaders/core_messagemanager.h \
bindingheaders/utils.h \
bindingheaders/utils_macroexpander.h \
bindingheaders/utils_filename.h \
bindingheaders/extensionsystem.h \
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
## Get the path component to the active config build folder
defineReplace(getOutDir) {
out_dir = $$OUT_PWD
CONFIG(release, debug|release): out_dir = $$out_dir/release
else:out_dir = $$out_dir/debug
return($$out_dir)
}
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
}
|