Recent

Author Topic: How the Qt5 binding was made?  (Read 2884 times)

JiaXing

  • Jr. Member
  • **
  • Posts: 75
How the Qt5 binding was made?
« on: April 18, 2020, 06:34:13 pm »
Today I forked the qt5 interface cbindings (the code used to build libQt5Pas) and tried to adapt it to CopperSpice. To my surprise it's a beast with 707 source files under src dir. CodeBlocks failed to process such a number of files, it crashed after some find and replace and rebuild. I have to ask for the help of Eclipse CDT. It ate all of my RAM but it didn't crash and still responsive. You know, Java application is not always bad! My job is straight forward, replacing header name, delete removed macros, processing (by hand) SLOT and SIGNAL (CopperSpice removed MOC so they use a macro, CS_Object, it needs a class name, unlike the Q_Object doesn't need a class name). C++ compilation is very slow but thanks to Eclipse CDT very much for it incremental build I could rebuild the whole project regularly without took too much time. But after I encountered incompatibility between CopperSpice and Qt5 my job slowed down very much. I have to read CopperSpice's API reference and do trial and error util the source file compile and jump to the next source file that has error. It took me 3 hrs and and only processed 1/3 of the source files! The job requires too much effort! I finally have to quit because I know it's impossible to do the job myself without help from other people. But I saw near no one interested so I deleted the eclipse workspace and took a rest!

I wanted to know how the Qt5 binding was made. He should use a tool like Swig to generate it. If he did it himself without any tool he is indeed superman! That I see very likely, as the code generated by Swig would not as clean as that. If it's doing by hand how could we keep up with changes made by newer Qt5 release? I tried to compile this library with Qt 5.11 on my system and failed. Qmake doesn't know the x11extras module and I myself can't found the x11info header on my system. It seemed Qt 5.11 has removed them. But I still found the x11info header on CopperSpice.

p/s: It's interesting. I found CopperSpice has no QPrintSupport library but indeed they keep the QAbstractPrintDialog (if I recall correctly) on the QtGui header and when we link with CsGui we do not need QPrintSupport library anymore. Porting to CopperSpice is completely possible if we have people cooperate with each other. It's not as impossible as it might seems at all!
I'm subscribed to the church of 440bx. Say no to OOP  :P

zeljko

  • Hero Member
  • *****
  • Posts: 1591
    • http://wiki.lazarus.freepascal.org/User:Zeljan
Re: How the Qt5 binding was made?
« Reply #1 on: April 18, 2020, 06:42:06 pm »
First libQt5Pas has been made by Den, and he is doing it via his own scripts which he did not want to publish. Rest is done manually by me .... no time to learn and patch Swig

JiaXing

  • Jr. Member
  • **
  • Posts: 75
Re: How the Qt5 binding was made?
« Reply #2 on: April 18, 2020, 06:46:12 pm »
First libQt5Pas has been made by Den, and he is doing it via his own scripts which he did not want to publish. Rest is done manually by me .... no time to learn and patch Swig

Do you successful to build libQt5Pas with Qt 5.11 or above? I have never possible to build it.

p/s: Do you interested in a CopperSpice port?
I'm subscribed to the church of 440bx. Say no to OOP  :P

zeljko

  • Hero Member
  • *****
  • Posts: 1591
    • http://wiki.lazarus.freepascal.org/User:Zeljan
Re: How the Qt5 binding was made?
« Reply #3 on: April 18, 2020, 06:47:40 pm »
Yes, just rebuilded with Qt-5.12.5 on Fedora 30 64bit

JiaXing

  • Jr. Member
  • **
  • Posts: 75
Re: How the Qt5 binding was made?
« Reply #4 on: April 20, 2020, 05:10:16 pm »
Yes, just rebuilded with Qt-5.12.5 on Fedora 30 64bit

I think I should check the development packages on my system. I use Windows 7 x64 and recently dual boot with Mint LMDE (Debian 10). On Mint I installed qt5-default and qmake said it didn't found the x11extras module. Remove this module from the .pro file allowed it to continue to build, but very soon later it will hit another problems. In summary, it's never a straight forward experience and it's never worked for me.

p/s: How long does it take to build? My machine is an 4 cores 8 threads system with 8G ram and SSD drive, but C++ build speed for me is terrible. Or it just because Eclipse CDT build is not parallel. make -j4 seemed to be fast. I have tried to build wxwidgets for gtk3 and it took about 16 mins to be done.
I'm subscribed to the church of 440bx. Say no to OOP  :P

zeljko

  • Hero Member
  • *****
  • Posts: 1591
    • http://wiki.lazarus.freepascal.org/User:Zeljan
Re: How the Qt5 binding was made?
« Reply #5 on: April 20, 2020, 06:25:32 pm »
In virtual machine it needs more than one hour (I'm using vmware and Fedora 24 64bit as virtual machine since it have Qt-5.6.2 as default Qt lib and it's our minimium requirement), on pure hardware maybe 20 minutes (i5 32GB RAM, Fedora 30 64bit). You must install qt devel packages to build libQt5Pas.

JiaXing

  • Jr. Member
  • **
  • Posts: 75
Re: How the Qt5 binding was made?
« Reply #6 on: April 21, 2020, 07:48:41 am »
In virtual machine it needs more than one hour (I'm using vmware and Fedora 24 64bit as virtual machine since it have Qt-5.6.2 as default Qt lib and it's our minimium requirement), on pure hardware maybe 20 minutes (i5 32GB RAM, Fedora 30 64bit). You must install qt devel packages to build libQt5Pas.

Finally I have figured it out. On Debian based system we need to install libqt5x11extras5-dev alongside with qt5-default. I have successfully compiled the latest version of Qt5Pas from git.

The compilation speed is not bad. make -j4 really does the trick. It's slow on Eclipse CDT because it doesn't use parallel build.
« Last Edit: April 22, 2020, 10:41:38 am by JiaXing »
I'm subscribed to the church of 440bx. Say no to OOP  :P

JiaXing

  • Jr. Member
  • **
  • Posts: 75
Re: How the Qt5 binding was made?
« Reply #7 on: April 22, 2020, 10:47:13 am »
What is the different between Qt4Pas library source and split build system library source, zeljko? I know this thread is about Qt5Pas but I want to play a bit with Qt4Pas, though. I noticed after unpacked the split build system library source has about twice the number of source files on the normal library source, and there is no C_EXPORT before function names.

http://users.telenet.be/Jan.Van.hijfte/qtforfpc/fpcqt4.html
I'm subscribed to the church of 440bx. Say no to OOP  :P

zeljko

  • Hero Member
  • *****
  • Posts: 1591
    • http://wiki.lazarus.freepascal.org/User:Zeljan
Re: How the Qt5 binding was made?
« Reply #8 on: April 22, 2020, 11:15:44 am »
Really don't know

JiaXing

  • Jr. Member
  • **
  • Posts: 75
Re: How the Qt5 binding was made?
« Reply #9 on: April 23, 2020, 03:22:50 pm »
I picked the split build version and have done playing with it. It's easier to start with Qt4Pas than Qt5Pas when porting to CopperSpice. But it's not really easy at all! The CopperSpice folks have changed too much from Qt that make it too difficult to adapt the code if you are not really understand it. May be I was too underestimated it and thought just find and replace were enough. Anyway, I have given up any efforts of porting to CopperSpice.
« Last Edit: April 23, 2020, 03:25:20 pm by JiaXing »
I'm subscribed to the church of 440bx. Say no to OOP  :P

 

TinyPortal © 2005-2018