aboutsummaryrefslogtreecommitdiffstats
path: root/examples/scriptableapplication/scriptableapplication.pro
diff options
context:
space:
mode:
authorFriedemann Kleint <Friedemann.Kleint@qt.io>2018-01-05 15:58:35 +0100
committerFriedemann Kleint <Friedemann.Kleint@qt.io>2018-01-12 12:28:10 +0000
commit9f2a9aba3aff73e31ea15eb4a7a04b0e50f4ee4e (patch)
tree92dcb0c4f64df8a8375af2e1a9bb1170068c36b2 /examples/scriptableapplication/scriptableapplication.pro
parent26c046e521c38bbfc3a263782a3bb74a7c1bf937 (diff)
Move examples from submodule to pyside-setup
Move PySide2 examples that are owned by the Qt Company to a new examples directory. Done-with: Venugopal Shivashankar <Venugopal.Shivashankar@qt.io> Task-number: PYSIDE-363 Change-Id: I14099764d9eef2bc35e067086121427955862e3a Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
Diffstat (limited to 'examples/scriptableapplication/scriptableapplication.pro')
-rw-r--r--examples/scriptableapplication/scriptableapplication.pro92
1 files changed, 92 insertions, 0 deletions
diff --git a/examples/scriptableapplication/scriptableapplication.pro b/examples/scriptableapplication/scriptableapplication.pro
new file mode 100644
index 000000000..2719160f3
--- /dev/null
+++ b/examples/scriptableapplication/scriptableapplication.pro
@@ -0,0 +1,92 @@
+TEMPLATE = app
+CONFIG += no_keywords # avoid clash with slots in Python.h
+CONFIG += console force_debug_info
+QT += widgets
+
+include(pyside2.pri)
+
+WRAPPED_HEADER = wrappedclasses.h
+WRAPPER_DIR = $$OUT_PWD/AppLib
+TYPESYSTEM_FILE = scriptableapplication.xml
+
+QT_INCLUDEPATHS = -I$$[QT_INSTALL_HEADERS] -I$$[QT_INSTALL_HEADERS]/QtCore \
+ -I$$[QT_INSTALL_HEADERS]/QtGui -I$$[QT_INSTALL_HEADERS]/QtWidgets
+
+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
+
+# MSVC does not honor #define protected public...
+win32:SHIBOKEN_OPTIONS += --avoid-protected-hack
+
+# Prepare the shiboken tool
+QT_TOOL.shiboken.binary = $$system_path($$PYSIDE2/shiboken2)
+win32 {
+ # Add the libclang/bin subdir to PATH.
+ CLANG_PATH.name = PATH
+ CLANG_PATH.value = $$CLANG_BIN_DIR
+ CLANG_PATH.CONFIG += prepend
+ exists($$CLANG_PATH.value): QT_TOOL_ENV = CLANG_PATH
+}
+qtPrepareTool(SHIBOKEN, shiboken)
+QT_TOOL_ENV =
+
+# Shiboken run that adds the module wrapper to GENERATED_SOURCES
+shiboken.output = $$WRAPPER_DIR/applib_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
+
+# A dummy command that pretends to produce the class wrappers from the headers
+# depending on the module wrapper
+WRAPPED_CLASSES = mainwindow.h
+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/applib_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)
+}
+
+# Create hardlinks to the PySide2 shared libraries, so the example can be executed without manually
+# setting the PATH.
+win32 {
+ out_dir = $$getOutDir()
+ # no_link tell not to link to the output files, target_predeps forces the command to actually
+ # execute, explicit_dependencies is a magic value that tells qmake not to run the commands
+ # if the output files already exist.
+ hard_link_libraries.CONFIG = no_link target_predeps explicit_dependencies
+ hard_link_libraries.output = $$out_dir/${QMAKE_FILE_BASE}${QMAKE_FILE_EXT}
+ hard_link_libraries.commands = mklink /H $$shell_path($$out_dir/${QMAKE_FILE_BASE}${QMAKE_FILE_EXT}) $$shell_path(${QMAKE_FILE_IN})
+ hard_link_libraries.input = PYSIDE2_SHARED_LIBRARIES
+}
+
+QMAKE_EXTRA_COMPILERS += shiboken module_wrapper_dummy_command
+win32:QMAKE_EXTRA_COMPILERS += hard_link_libraries
+
+INCLUDEPATH += $$WRAPPER_DIR
+
+# fixme: Hack to find wrappers
+PACKAGE_DIR = $$PWD/../../pyside_package/PySide2
+
+INCLUDEPATH += $$PACKAGE_DIR/include/PySide2/QtWidgets \
+ $$PACKAGE_DIR/include/PySide2/QtGui $$PACKAGE_DIR/include/PySide2/QtCore
+
+SOURCES += \
+ main.cpp \
+ mainwindow.cpp \
+ pythonutils.cpp
+
+HEADERS += \
+ mainwindow.h \
+ pythonutils.h
+
+OTHER_FILES += $$TYPESYSTEM_FILE $$WRAPPED_HEADER pyside2_config.py README.txt