aboutsummaryrefslogtreecommitdiffstats
path: root/optional
diff options
context:
space:
mode:
authorEike Ziller <eike.ziller@qt.io>2018-09-13 15:09:00 +0200
committerEike Ziller <eike.ziller@qt.io>2018-09-14 09:46:34 +0000
commitebbaa352fcfac361479c56192ac6cba4dcc87efb (patch)
tree7390aa5f34d376c7444960b4eff170a28e2690ad /optional
parentd3714d329c292f4930fea8c0d9aa33ed59b12f38 (diff)
Add optional bindings to regular build
Change-Id: I47e02299707e59dc5417e965a2bbcf2a6b5d0428 Reviewed-by: Friedemann Kleint <Friedemann.Kleint@qt.io>
Diffstat (limited to 'optional')
-rw-r--r--optional/README.md17
-rw-r--r--optional/binding/binding.h (renamed from optional/template/binding.h)0
-rw-r--r--optional/binding/binding.pri15
-rw-r--r--optional/optional.pro5
-rw-r--r--optional/projectexplorer/projectexplorer.pro (renamed from optional/projectexplorer/binding_custom.pri)25
-rw-r--r--optional/setup.py139
-rw-r--r--optional/template/binding.pro79
-rw-r--r--optional/texteditor/texteditor.pro (renamed from optional/texteditor/binding_custom.pri)28
8 files changed, 34 insertions, 274 deletions
diff --git a/optional/README.md b/optional/README.md
index 2c5af5d..96ab614 100644
--- a/optional/README.md
+++ b/optional/README.md
@@ -9,23 +9,6 @@ that are shared for each binding.
## Documentation
-### Building
-If your environment is setup correctly (i.e. you can build the Python Extensions plugin), all that
-you should need to do is run:
-
-```
-python setup.py --qmake=/path/to/your/qmake
-```
-
-and the optional bindings should build and be installed. To clean the build files after a build,
-just run:
-
-```
-python setup.py clean
-```
-
-For problems and possible solutions, please refer to the main `README.md`.
-
### Writing optional binding libraries
**NOTICE:** Please refer to the `pyutil.h` header file for anything that is not explained
here.
diff --git a/optional/template/binding.h b/optional/binding/binding.h
index 9b397a1..9b397a1 100644
--- a/optional/template/binding.h
+++ b/optional/binding/binding.h
diff --git a/optional/binding/binding.pri b/optional/binding/binding.pri
new file mode 100644
index 0000000..8c0a0c8
--- /dev/null
+++ b/optional/binding/binding.pri
@@ -0,0 +1,15 @@
+DEFINES += PYTHONEXTENSIONS_LIBRARY
+
+# PythonExtensions files
+
+SOURCES += \
+ binding.cpp
+
+HEADERS += \
+ $$PWD/binding.h
+
+INCLUDEPATH *= $$PWD
+
+QTC_PLUGIN_DIRS += $$PWD/../../plugins
+include(../../plugins/pythonextensions/qtcreator.pri)
+include($$IDE_SOURCE_TREE/src/qtcreatorplugin.pri)
diff --git a/optional/optional.pro b/optional/optional.pro
new file mode 100644
index 0000000..1b4b363
--- /dev/null
+++ b/optional/optional.pro
@@ -0,0 +1,5 @@
+TEMPLATE = subdirs
+
+SUBDIRS = \
+ texteditor \
+ projectexplorer
diff --git a/optional/projectexplorer/binding_custom.pri b/optional/projectexplorer/projectexplorer.pro
index b9e3faf..a60ac99 100644
--- a/optional/projectexplorer/binding_custom.pri
+++ b/optional/projectexplorer/projectexplorer.pro
@@ -1,11 +1,3 @@
-# Additional sources
-
-SOURCES += \
- # optional
-
-HEADERS += \
- # optional
-
# Declare dependencies and name
@@ -23,22 +15,17 @@ QTC_PLUGIN_DEPENDS += \
QTC_PLUGIN_RECOMMENDS += \
# optional plugin dependencies. nothing here at this time
+include(../binding/binding.pri)
+
+INCLUDEPATH *= $$IDE_SOURCE_TREE/src/plugins/projectexplorer
# Shiboken binding generation setup
-WRAPPED_HEADER = wrappedclasses.h
+WRAPPED_HEADER = $$PWD/wrappedclasses.h
WRAPPER_DIR = $$OUT_PWD/QtCreatorBindingProjectExplorer
TYPESYSTEM_FILE = typesystem_projectexplorer.xml
-
TYPESYSTEM_NAME = qtcreatorbindingprojectexplorer
-
-## Include additional QtCreator paths
-QT_INCLUDEPATHS += \
- -I"$$IDE_SOURCE_TREE/src/plugins/projectexplorer"
-
-INCLUDEPATH += \
- $$IDE_SOURCE_TREE/src/plugins/projectexplorer \
- $$IDE_SOURCE_TREE/src/libs/utils
+SHIBOKEN_QT = core gui widgets network
## 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
@@ -55,3 +42,5 @@ WRAPPED_CLASSES = \
bindingheaders/utils.h \
bindingheaders/utils_filename.h \
# Sentinel line
+
+include(../../shiboken.pri)
diff --git a/optional/setup.py b/optional/setup.py
deleted file mode 100644
index c0f6f43..0000000
--- a/optional/setup.py
+++ /dev/null
@@ -1,139 +0,0 @@
-#############################################################################
-##
-## Copyright (C) 2018 The Qt Company Ltd.
-## Contact: http://www.qt.io/licensing/
-##
-## This file is part of the Python Extensions Plugin for QtCreator.
-##
-## $QT_BEGIN_LICENSE:BSD$
-## You may use this file under the terms of the BSD license as follows:
-##
-## "Redistribution and use in source and binary forms, with or without
-## modification, are permitted provided that the following conditions are
-## met:
-## * Redistributions of source code must retain the above copyright
-## notice, this list of conditions and the following disclaimer.
-## * Redistributions in binary form must reproduce the above copyright
-## notice, this list of conditions and the following disclaimer in
-## the documentation and/or other materials provided with the
-## distribution.
-## * Neither the name of The Qt Company Ltd nor the names of its
-## contributors may be used to endorse or promote products derived
-## from this software without specific prior written permission.
-##
-##
-## THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
-## "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
-## LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
-## A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
-## OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
-## SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
-## LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
-## DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
-## THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
-## (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
-## OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE."
-##
-## $QT_END_LICENSE$
-##
-#############################################################################
-
-# Assemble the binding projects and build them
-
-# You need to specify the correct qmake when running:
-# $ python setup.py --qmake=/path/to/qmake
-# (defaults to "qmake")
-
-# You can also specify a binding to build:
-# $ python setup.py --only=bindingname
-# (default is to build all)
-
-# You can clean the build directories with
-# $ python setup.py clean
-
-import os, shutil, subprocess, sys
-
-
-def qmake():
- for arg in sys.argv:
- if arg.split("=")[0] == "--qmake":
- return arg.split("=")[-1]
- return "qmake"
-
-def only():
- for arg in sys.argv:
- if arg.split("=")[0] == "--only":
- return arg.split("=")[-1]
- return False
-
-def copytree(src, dst, symlinks=False, ignore=None):
- for item in os.listdir(src):
- s = os.path.join(src, item)
- d = os.path.join(dst, item)
- if os.path.isdir(s):
- shutil.copytree(s, d, symlinks, ignore)
- else:
- shutil.copy2(s, d)
-
-def generate_build_deps():
- if os.path.exists("build_deps"):
- shutil.rmtree("build_deps")
- # Plugin dependencies .pri file
- os.makedirs("build_deps/pythonextensions")
- shutil.copy2(
- "../plugins/pythonextensions/pythonextensions_dependencies.pri",
- "build_deps/pythonextensions/pythonextensions_dependencies.pri"
- )
-
-def generate_build_dir(binding_name):
- build_dir = "build_{}".format(binding_name)
- if os.path.exists(build_dir):
- shutil.rmtree(build_dir)
- os.makedirs(build_dir)
- copytree("template", build_dir)
- copytree(binding_name, build_dir)
-
-def run_build(binding_name):
- build_dir = "build_{}".format(binding_name)
- if os.path.exists(build_dir):
- try:
- subprocess.check_call(qmake(), cwd=build_dir)
- subprocess.check_call("make", cwd=build_dir)
- except Exception as e:
- print("Got exception when building {}:".format(binding_name), e)
- return False
- return True
- return False
-
-def clean_build_dirs():
- for build_dir in os.scandir():
- if build_dir.is_dir() and build_dir.name.split("_")[0] == "build":
- shutil.rmtree(build_dir.name)
- print("Removing {}".format(build_dir.name))
-
-def main():
- generate_build_deps()
- if only():
- generate_build_dir(only())
- if run_build(only()):
- print("Built {}".format(only()))
- else:
- print("Error building {}".format(only()))
- print("Skipping other builds")
- return
- final_message = "Summary:"
- for binding in os.scandir():
- if binding.is_dir() and binding.name != "template" and binding.name.split("_")[0] != "build":
- generate_build_dir(binding.name)
- if run_build(binding.name):
- final_message += "\nBuilt {}".format(binding.name)
- else:
- final_message += "\nError building {}".format(binding.name)
- print(final_message)
-
-
-if __name__ == "__main__":
- if "clean" in sys.argv:
- clean_build_dirs()
- else:
- main()
diff --git a/optional/template/binding.pro b/optional/template/binding.pro
deleted file mode 100644
index e7f71a1..0000000
--- a/optional/template/binding.pro
+++ /dev/null
@@ -1,79 +0,0 @@
-# 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
-}
diff --git a/optional/texteditor/binding_custom.pri b/optional/texteditor/texteditor.pro
index 361da10..e1a5e2e 100644
--- a/optional/texteditor/binding_custom.pri
+++ b/optional/texteditor/texteditor.pro
@@ -1,11 +1,3 @@
-# Additional sources
-
-SOURCES += \
- # optional
-
-HEADERS += \
- # optional
-
# Declare dependencies and name
@@ -23,25 +15,17 @@ QTC_PLUGIN_DEPENDS += \
QTC_PLUGIN_RECOMMENDS += \
# optional plugin dependencies. nothing here at this time
+include(../binding/binding.pri)
+
+INCLUDEPATH *= $$IDE_SOURCE_TREE/src/plugins/texteditor
# Shiboken binding generation setup
-WRAPPED_HEADER = wrappedclasses.h
+WRAPPED_HEADER = $$PWD/wrappedclasses.h
WRAPPER_DIR = $$OUT_PWD/QtCreatorBindingTextEditor
TYPESYSTEM_FILE = typesystem_texteditor.xml
-
TYPESYSTEM_NAME = qtcreatorbindingtexteditor
-
-## Include additional QtCreator paths
-QT_INCLUDEPATHS += \
- -I"$$IDE_SOURCE_TREE/src/plugins/texteditor"
-
-INCLUDEPATH += \
- $$IDE_SOURCE_TREE/src/plugins/coreplugin \
- $$IDE_SOURCE_TREE/src/plugins/coreplugin/editormanager \
- $$IDE_SOURCE_TREE/src/plugins/coreplugin/find \
- $$IDE_SOURCE_TREE/src/plugins/texteditor \
- $$IDE_SOURCE_TREE/src/libs/utils
+SHIBOKEN_QT = core gui widgets
## 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
@@ -49,3 +33,5 @@ INCLUDEPATH += \
WRAPPED_CLASSES = \
bindingheaders/texteditor.h \
# Sentinel line
+
+include(../../shiboken.pri)