EsoErik

Tuesday, April 8, 2014

 

C++ PyQt5 Extension

The old sipconfig mechanism has been on its way out since Riverbank Software added configure-ng.py to the PyQt4 distribution.  Because pyqtconfig depends on sipconfig, pyqtconfig has also been on the way out, and is gone from PyQt5.  In lieu of the pyqtconfig method for building the Python .so/.dll/.dylib documented here, there is... roll your own.

Rolling your own is tough if you're handed a tray of eighty different tobaccos and you don't know whether you're supposed to be making a cigar, bidi, or cigarette.  So, here is an example of the end product blended to my simple but very particular tastes.  At the risk of suffocating in this metaphor: a more complex blend may include Python wrapping paper...

The most import bit:

#!/usr/bin/env bash

set -x

cd /home/ehvatum/zplrepo/ris_widget && \
rm -fv sipris_*.cpp sipAPIris_widget.h ris_widget.so ris_widget.sbf && \
sip -c . -b ris_widget.sbf -I /usr/share/sip/PyQt5 -x VendorID -t WS_X11 -t Qt_5_2_0 -g ris_widget.sip && \
g++ -O2 -fPIC -std=c++0x -march=native -Wall -W -D_REENTRANT -DQT_NO_DEBUG -DQT_WIDGETS_LIB -DQT_GUI_LIB -DQT_CORE_LIB \
-I/usr/lib64/qt5/mkspecs/linux-g++ -I. -I/usr/include/qt5 -I/usr/include/qt5/QtWidgets -I/usr/include/qt5/QtGui \
-I/usr/include/qt5/QtCore -I/usr/include/qt5/QtOpenGL -I/usr/include/python3.3 -I/usr/local/glm -Wl,-O1 -std=c++0x \
-shared -lQt5Widgets -lQt5Gui -lQt5Core -lQt5OpenGL -lGL -lpthread *.cpp cpp/*.o -o ris_widget.so
The rest of the example.

Note that the example code is a small subset RisWidget, of one of my open source projects.
Comments:

Post a Comment

Subscribe to Post Comments [Atom]





<< Home

Archives

July 2009   August 2009   September 2009   October 2009   November 2009   December 2009   January 2010   September 2010   December 2010   January 2011   February 2011   April 2011   June 2011   August 2011   February 2012   June 2012   July 2012   August 2012   October 2012   November 2012   January 2014   April 2014   June 2014   August 2014   September 2014   October 2014   January 2015   March 2015   April 2015   June 2015   November 2015   December 2015   January 2016   June 2016   August 2016   January 2017   March 2017  

This page is powered by Blogger. Isn't yours?

Subscribe to Posts [Atom]