PySide Shiboken Tutorial

From Qt Wiki
Revision as of 10:43, 24 February 2015 by Maintenance script (talk | contribs)
Jump to navigation Jump to search


Simple Shiboken Binding Tutorial

This is sample demonstration how to generate simple bindings with shiboken python binding generator. This tutorial was written by Roman Lacko in a recent "mailing list":http://lists.qt.io/pipermail/pyside/2013-January/001009.html.

  • FooLib project contains the library for which we want to generate the bindings
  • FooLibBinding project contains the generated binding sources

Software used:

Notes:

  • Update the paths to python libs and includes in FooLibBinding\FooLibBinding.pro. In this tutorial, it's assumed that python is installed in C:27_64.
<br />INCLUDEPATH ''= ../pyside/include/PySide  ../pyside/include/PySide/QtCore  ../pyside/include/shiboken  c:/Python27_64/include  ../FooLib
<br />LIBS''= c:/Python27_64/libs/python27.lib  ../pyside/shiboken-python2.7.lib  ../FooLib-build-Desktop-Release/release/FooLib.lib<br />
  • Also update the path where you have installed Qt on your system in the files below
    • Replace this "c:–4.8.4-msvc2010-x64&quot; with your path
<br />pyside\include\PySide\pyside_global.h<br />FooLib\generate_binding.bat<br />
  • Note that if you decide to experiment with using mingw, you will need to change the .lib extension to .a

To generate and test the bindings do the following:

  1. Install PySide
  2. Copy content of C:27\Lib\site-packages\PySide to BindingTest\PySide folder
  3. Compile FooLib project
  4. Run FooLib\generate_binding.bat
  5. Compile FooLibBinding project
  6. Run FooLibBinding\make_package.bat