diff options
Diffstat (limited to 'optional/template')
-rw-r--r-- | optional/template/binding.h | 30 | ||||
-rw-r--r-- | optional/template/binding.pro | 87 |
2 files changed, 117 insertions, 0 deletions
diff --git a/optional/template/binding.h b/optional/template/binding.h new file mode 100644 index 0000000..9b397a1 --- /dev/null +++ b/optional/template/binding.h @@ -0,0 +1,30 @@ +/**************************************************************************** +** +** Copyright (C) 2018 The Qt Company Ltd. +** Contact: https://www.qt.io/licensing/ +** +** This file is part of the Python Extensions Plugin for QtCreator. +** +** Commercial License Usage +** Licensees holding valid commercial Qt licenses may use this file in +** accordance with the commercial license agreement provided with the +** Software or, alternatively, in accordance with the terms contained in +** a written agreement between you and The Qt Company. For licensing terms +** and conditions see https://www.qt.io/terms-conditions. For further +** information use the contact form at https://www.qt.io/contact-us. +** +** GNU General Public License Usage +** Alternatively, this file may be used under the terms of the GNU +** General Public License version 3 as published by the Free Software +** Foundation with exceptions as appearing in the file LICENSE.GPL3-EXCEPT +** included in the packaging of this file. Please review the following +** information to ensure the GNU General Public License requirements will +** be met: https://www.gnu.org/licenses/gpl-3.0.html. +** +****************************************************************************/ + +#pragma once + +#include <QtGlobal> + +extern "C" Q_DECL_EXPORT void bind(); diff --git a/optional/template/binding.pro b/optional/template/binding.pro new file mode 100644 index 0000000..57be22b --- /dev/null +++ b/optional/template/binding.pro @@ -0,0 +1,87 @@ +# 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 + +## 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 + +# 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 +} |