Skip to content

Commit

Permalink
update for qt5
Browse files Browse the repository at this point in the history
  • Loading branch information
devernay committed Mar 30, 2018
1 parent d07d49b commit 1b40ea3
Show file tree
Hide file tree
Showing 2 changed files with 59 additions and 32 deletions.
16 changes: 15 additions & 1 deletion INSTALL_LINUX.md
Original file line number Diff line number Diff line change
Expand Up @@ -285,7 +285,7 @@ shiboken {
## Generating Python bindings

This is not required as generated files are already in the repository. You would need to run it if you were to extend or modify the Python bindings via the
typesystem.xml file. See the documentation of shiboken-2.7 for an explanation of the command line arguments.
typesystem.xml file. See the documentation of shiboken for an explanation of the command line arguments.

```Shell
SDK_PREFIX=/opt/Natron-sdk
Expand All @@ -299,5 +299,19 @@ shiboken --avoid-protected-hack --enable-pyside-extensions --include-paths=../En
tools/utils/runPostShiboken.sh
```

If using PySide2 for Qt5, the command-line would be:

```Shell
SDK_PREFIX=/opt/Natron-sdk
PYSIDE_PREFIX=/opt/Natron-sdk
rm Engine/NatronEngine/* Gui/NatronGui/*

shiboken2 --avoid-protected-hack --enable-pyside-extensions --include-paths=../Engine:../Global:$SDK_PREFIX/include:$PYSIDE_PREFIX/include/PySide2 --typesystem-paths=$PYSIDE_PREFIX/lib/python2.7/site-packages/PySide2/typesystems --output-directory=Engine Engine/Pyside_Engine_Python.h Engine/typesystem_engine.xml

shiboken2 --avoid-protected-hack --enable-pyside-extensions --include-paths=../Engine:../Gui:../Global:$SDK_PREFIX/include:$PYSIDE_PREFIX/include/PySide2 --typesystem-paths=$PYSIDE_PREFIX/lib/python2.7/site-packages/PySide2/typesystems:Engine --output-directory=Gui Gui/Pyside_Gui_Python.h Gui/typesystem_natronGui.xml

tools/utils/runPostShiboken.sh
```

**Note**
Shiboken has a few glitches which needs fixing with some sed commands, run tools/utils/runPostShiboken.sh once shiboken is called
75 changes: 44 additions & 31 deletions global.pri
Original file line number Diff line number Diff line change
Expand Up @@ -339,10 +339,15 @@ win32-g++ {

expat: PKGCONFIG += expat
cairo: PKGCONFIG += cairo
shiboken: PKGCONFIG += shiboken-py2
pyside: PKGCONFIG += pyside-py2
pyside: INCLUDEPATH += $$system(pkg-config --variable=includedir pyside-py2)/QtCore
equals(QT_MAJOR_VERSION, 5) {
shiboken: INCLUDEPATH += $$system(python2 -c "from distutils.sysconfig import get_python_lib; print(get_python_lib())")/PySide2/include/shiboken
pyside: INCLUDEPATH += $$system(python2 -c "from distutils.sysconfig import get_python_lib; print(get_python_lib())")/PySide2/include/PySide2
pyside: INCLUDEPATH += $$system(python2 -c "from distutils.sysconfig import get_python_lib; print(get_python_lib())")/PySide2/include/PySide2/QtCore
}
equals(QT_MAJOR_VERSION, 4) {
shiboken: PKGCONFIG += shiboken-py2
pyside: PKGCONFIG += pyside-py2
pyside: INCLUDEPATH += $$system(pkg-config --variable=includedir pyside-py2)/QtCore
pyside: INCLUDEPATH += $$system(pkg-config --variable=includedir pyside-py2)/QtGui
}
python: PKGCONFIG += python-2.7
Expand Down Expand Up @@ -388,35 +393,43 @@ unix {
INCLUDEPATH *= $$PYTHON_INCLUDEPATH
}

# There may be different pyside.pc/shiboken.pc for different versions of python.
# pkg-config will probably give a bad answer, unless python2 is the system default.
# See for example tools/travis/install_dependencies.sh for a solution that works on Linux,
# using a custom config.pri
shiboken: PKGCONFIG += shiboken
pyside: PKGCONFIG += pyside
# The following hack also works with Homebrew if pyside is installed with option --with-python3
macx {
QMAKE_LFLAGS += '-Wl,-rpath,\'@loader_path/../Frameworks\''
shiboken {
PKGCONFIG -= shiboken
PYSIDE_PKG_CONFIG_PATH = $$system($$PYTHON_CONFIG --exec-prefix)/lib/pkgconfig:$$(PKG_CONFIG_PATH)
INCLUDEPATH += $$system(env PKG_CONFIG_PATH=$$PYSIDE_PKG_CONFIG_PATH pkg-config --variable=includedir shiboken)
# the sed stuff is to work around an Xcode generator bug
LIBS += $$system(env PKG_CONFIG_PATH=$$PYSIDE_PKG_CONFIG_PATH pkg-config --libs shiboken | sed -e s/-undefined\\ dynamic_lookup//)
}
pyside {
PKGCONFIG -= pyside
PYSIDE_PKG_CONFIG_PATH = $$system($$PYTHON_CONFIG --exec-prefix)/lib/pkgconfig:$$(PKG_CONFIG_PATH)
INCLUDEPATH += $$system(env PKG_CONFIG_PATH=$$PYSIDE_PKG_CONFIG_PATH pkg-config --variable=includedir pyside)
INCLUDEPATH += $$system(env PKG_CONFIG_PATH=$$PYSIDE_PKG_CONFIG_PATH pkg-config --variable=includedir pyside)/QtCore
equals(QT_MAJOR_VERSION, 4) {
# QtGui include are needed because it looks for Qt::convertFromPlainText which is defined in
# qtextdocument.h in the QtGui module.
INCLUDEPATH += $$system(env PKG_CONFIG_PATH=$$PYSIDE_PKG_CONFIG_PATH pkg-config --variable=includedir pyside)/QtGui
INCLUDEPATH += $$system(env PKG_CONFIG_PATH=$${QMAKE_LIBDIR_QT}/pkgconfig pkg-config --variable=includedir QtGui)
equals(QT_MAJOR_VERSION, 5) {
shiboken: INCLUDEPATH += $$system(python2 -c "from distutils.sysconfig import get_python_lib; print(get_python_lib())")/PySide2/include/shiboken
pyside: INCLUDEPATH += $$system(python2 -c "from distutils.sysconfig import get_python_lib; print(get_python_lib())")/PySide2/include/PySide2
pyside: INCLUDEPATH += $$system(python2 -c "from distutils.sysconfig import get_python_lib; print(get_python_lib())")/PySide2/include/PySide2/QtCore
}

equals(QT_MAJOR_VERSION, 4) {
# There may be different pyside.pc/shiboken.pc for different versions of python.
# pkg-config will probably give a bad answer, unless python2 is the system default.
# See for example tools/travis/install_dependencies.sh for a solution that works on Linux,
# using a custom config.pri
shiboken: PKGCONFIG += shiboken
pyside: PKGCONFIG += pyside
# The following hack also works with Homebrew if pyside is installed with option --with-python3
macx {
QMAKE_LFLAGS += '-Wl,-rpath,\'@loader_path/../Frameworks\''
shiboken {
PKGCONFIG -= shiboken
PYSIDE_PKG_CONFIG_PATH = $$system($$PYTHON_CONFIG --exec-prefix)/lib/pkgconfig:$$(PKG_CONFIG_PATH)
INCLUDEPATH += $$system(env PKG_CONFIG_PATH=$$PYSIDE_PKG_CONFIG_PATH pkg-config --variable=includedir shiboken)
# the sed stuff is to work around an Xcode generator bug
LIBS += $$system(env PKG_CONFIG_PATH=$$PYSIDE_PKG_CONFIG_PATH pkg-config --libs shiboken | sed -e s/-undefined\\ dynamic_lookup//)
}
pyside {
PKGCONFIG -= pyside
PYSIDE_PKG_CONFIG_PATH = $$system($$PYTHON_CONFIG --exec-prefix)/lib/pkgconfig:$$(PKG_CONFIG_PATH)
INCLUDEPATH += $$system(env PKG_CONFIG_PATH=$$PYSIDE_PKG_CONFIG_PATH pkg-config --variable=includedir pyside)
INCLUDEPATH += $$system(env PKG_CONFIG_PATH=$$PYSIDE_PKG_CONFIG_PATH pkg-config --variable=includedir pyside)/QtCore
equals(QT_MAJOR_VERSION, 4) {
# QtGui include are needed because it looks for Qt::convertFromPlainText which is defined in
# qtextdocument.h in the QtGui module.
INCLUDEPATH += $$system(env PKG_CONFIG_PATH=$$PYSIDE_PKG_CONFIG_PATH pkg-config --variable=includedir pyside)/QtGui
INCLUDEPATH += $$system(env PKG_CONFIG_PATH=$${QMAKE_LIBDIR_QT}/pkgconfig pkg-config --variable=includedir QtGui)
}
LIBS += $$system(env PKG_CONFIG_PATH=$$PYSIDE_PKG_CONFIG_PATH pkg-config --libs pyside)
}
}
LIBS += $$system(env PKG_CONFIG_PATH=$$PYSIDE_PKG_CONFIG_PATH pkg-config --libs pyside)
}
}
} #unix

Expand Down

0 comments on commit 1b40ea3

Please sign in to comment.