[External] Re: building code already generated by sip-build

Phil Thompson phil at riverbankcomputing.com
Fri Nov 17 16:08:36 GMT 2023


On 17/11/2023 13:29, Edward A. Pier wrote:
> Just running make was my first thought, but I don't see a Makefile (or
> equivalent for any other build system) anywhere. I only see the
> generated .cpp and .h files and the .o files in the build directory.
> Poking around the sip Python code, it seems like the compilation and
> linking are orchestrated there. In theory I could roll my own
> Makefile, but that is unappealing, giving the number of compiler
> flags.

If you are wrapping Qt code then I assumed you would be building on top 
of PyQt and using PyQt-builder rather than plain SIP. In which case you 
would get Makefiles and a --no-make option.

> Any other ideas? A different approach would be if there was a way to
> inject code into the sipAPIxxx.h file.

There a several ways (ie. directives) but they may not put the code in 
the right place for what you want.

Phil

> ________________________________
> From: Phil Thompson <phil at riverbankcomputing.com>
> Sent: Thursday, November 16, 2023 11:53 PM
> To: Edward A. Pier <epier at oceanit.com>
> Cc: pyqt at riverbankcomputing.com <pyqt at riverbankcomputing.com>
> Subject: [External] Re: building code already generated by sip-build
> 
> [You don't often get email from phil at riverbankcomputing.com. Learn why
> this is important at https://aka.ms/LearnAboutSenderIdentification ]
> 
> On 16/11/2023 14:12, Edward A. Pier wrote:
>> I am using sip to wrap some Qt-related C++ code in Python. I am
>> running sip-build 6.7.12 under MSYS2 on Windows.
>> 
>> The project compilation fails with a long spew of errors coming from
>> the qmetatype.h header file which is included by sipAPIxxx.h (I
>> substituted xxx for the project name).
>> 
>> The includes at the top of that file look like this:
>> 
>> #include "sip.h"
>> 
>> #include <QMetaType>
>> #include <QThread>
>> 
>> I find that if I swap the order of the QMetaType and QThread includes,
>> it compiles.
>> 
>> While it would be nice to understand and fix the ultimate cause of
>> this problem, I would settle for a workaround where I generate the
>> code, then modify the generated code, and then compile. I see there is
>> a --no-compile option on sip-build that would handle the first thing,
>> but I don't see a way to just compile already generated code with all
>> the necessary compiler flags.
>> 
>> Thanx for your help, and let me know if you need any more info.
> 
> Just run make?
> 
> Phil


More information about the PyQt mailing list