aboutsummaryrefslogtreecommitdiffstats
path: root/optional/template/binding.pro
blob: e7f71a16fd903077798a8e3f9b71532b347d7790 (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
# 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 += \
    binding.cpp

HEADERS += \
    binding.h


# Qt Creator linking

# Shared QtCreator sources and build destination
# (these are shared with the main plugin)
include(../../plugins/pythonextensions/qtcreator.pri)

## Include Qt and QtCreator paths
QT_INCLUDEPATHS = -I"$$[QT_INSTALL_HEADERS]" -I"$$[QT_INSTALL_HEADERS]/QtCore" \
    -I"$$[QT_INSTALL_HEADERS]/QtGui" -I"$$[QT_INSTALL_HEADERS]/QtWidgets" \
    -I"$$[QT_INSTALL_HEADERS]/QtNetwork" \
    -I"$$IDE_SOURCE_TREE/src/plugins" \
    -I"$$IDE_SOURCE_TREE/src/libs"

# Custom Buildsystem setup per binding
include(binding_custom.pri)

# Add the build dependencies directory, which will contain dependencies
# related to the python extensions plugin
QTC_PLUGIN_DIRS += $${WRAPPER_DIR}/../../build_deps/
include($$IDE_SOURCE_TREE/src/qtcreatorplugin.pri)

# Shiboken stuff

# This setup is currently only tested on Linux

include(../../plugins/pythonextensions/pyside2.pri)

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

## 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 $$PWD/$$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

# Include paths for Shiboken generated files
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) {
    INCLUDEPATH += $$i/QtWidgets $$i/QtGui $$i/QtCore $$i/QtNetwork
}