Helpful bits & pieces for C++20, Qt6, etc.

Here's the place for discussion related to coding in FreeCAD, C++ or Python. Design, interfaces and structures.
Forum rules
Be nice to others! Respect the FreeCAD code of conduct!
Post Reply
ElliotLee
Posts: 18
Joined: Wed Mar 20, 2019 10:20 pm

Helpful bits & pieces for C++20, Qt6, etc.

Post by ElliotLee »

Hi all,

I was thinking of taking on a Windows add-on project so I first started trying to get the software to build on Windows. I didn't use Libpack or Conda (Libpack didn't have Python 3.10, Conda just caused more problems than it solved), but installed the latest versions of dependencies manually instead. And I worked to get FreeCAD to build with it all, and patched as I went.

The changes you can find at
https://github.com/FreeCAD/FreeCAD/comp ... CAD:master ,
with most of it in commit c063009398a6a49f9d2b82bf9f7fc54fa01233d0

The patch does four main things:
1. Gets FreeCAD to build with a C++20 compiler (adding 'const' in all those places, and a few other changes)
2. Gets FreeCAD to build with Qt6 (except the TechDraw WB). I suspect @wmayer will want this part of the patch.
3. Gets FreeCAD to build with xerces 4.0.0
4. Gets FreeCAD/src/Fem to partially build with SALOME 9.9.0.
5. Gets FreeCAD to build with [insert latest version of favorite package here].

With the patch, I can at least get FreeCAD to basically run.
My build environment:
MS Visual Studio 2022
Qt 6.4.2
OpenCASCADE 7.7.0+blobfish
xerces 4.0.0
boost 1.81.0
SALOME 9.9.0
Python 3.10.9
cmake 3.24.2
vtk 9.2
eigen 3.4.90 (aka git latest)
PCL 1.13.0.99
I noticed in general that FreeCAD and the libpack have old versions of quite a few 3rd party packages.

I don't expect anyone to commit these changes as-is, and unfortunately I have run out of time to work on this, so I am posting it here in case anyone comes along in six months and wants some hints on how to make this stuff build. I'm happy to try to answer questions.

Hope this helps,
Elliot
xtemp09
Posts: 72
Joined: Tue Jul 12, 2022 2:16 pm

Re: Helpful bits & pieces for C++20, Qt6, etc.

Post by xtemp09 »

May I ask how you dealt with QWinTaskbarProgress removal?

What do you think about update to the latest zipios? (or even use of submodules for boost/fmt/zipios)

Can FreeCAD be distributed with Qt 5.15.13?
User avatar
onekk
Veteran
Posts: 6146
Joined: Sat Jan 17, 2015 7:48 am
Contact:

Re: Helpful bits & pieces for C++20, Qt6, etc.

Post by onekk »

xtemp09 wrote: Sat Mar 18, 2023 8:52 am May I ask how you dealt with QWinTaskbarProgress removal?

What do you think about update to the latest zipios? (or even use of submodules for boost/fmt/zipios)

Can FreeCAD be distributed with Qt 5.15.13?
FreeCAD has to run on three Platform, so some decision to use a library version instead on another have to take in account that it must have a minimal requirement to compile on three Platform to have a compatibility (most appreciated is long term stability).

So every advancement must take in account the actual state of the art of tools available on three platform, if one of these is not meet in a platform probably the limit should be lowered.

This has been discussed before on development forum, so it is an accepted behaviour and periodically there are some advancement in "minimal versions" of library to follow the pace of modernization among the three plaform, as example some C++20 adaptations were not implemented as one of the three Platform lack of a proper implementation of such functions, so FreeCAD will not compile on it.

You could always compile your own taylored version of FreeCAD, but your files and your carefully written WB will work if not tested on a stock FreeCAD installation?

Old habits is to think that exist only one OS and everyone is using it, but probably in a world ruled by Linux Servers that will provide almost all the internet services thinking that only Windows exist is quite a "blind assumption" as MS sells his services using Linux Servers "Azure".

Regards

Carlo D.
Last edited by onekk on Sat Mar 18, 2023 9:35 pm, edited 1 time in total.
GitHub page: https://github.com/onekk/freecad-doc.
- In deep articles on FreeCAD.
- Learning how to model with scripting.
- Various other stuffs.

Blog: https://okkmkblog.wordpress.com/
User avatar
adrianinsaval
Veteran
Posts: 5541
Joined: Thu Apr 05, 2018 5:15 pm

Re: Helpful bits & pieces for C++20, Qt6, etc.

Post by adrianinsaval »

IIRC minimum qt version for 0.21 is 5.12
xtemp09
Posts: 72
Joined: Tue Jul 12, 2022 2:16 pm

Re: Helpful bits & pieces for C++20, Qt6, etc.

Post by xtemp09 »

The question was not about minimum supported version. The Qt Company made LTS commercial; it's GPL-licensed, but I don't really know if it is legal to take the code, recompile and distribute. KDE backports Qt 6 code to Qt 5 and distributes it.

Transition to Qt 6 will drop Windows 7 support, which is really disturbing, especially while mingw-w64 still supports Windows 7, i.e. we have the latest gcc, the latest mingw-w64, the latest Qt 5 still [officially] supporting Windows 7.
User avatar
adrianinsaval
Veteran
Posts: 5541
Joined: Thu Apr 05, 2018 5:15 pm

Re: Helpful bits & pieces for C++20, Qt6, etc.

Post by adrianinsaval »

xtemp09 wrote: Sat Mar 18, 2023 6:36 pm it's GPL-licensed, but I don't really know if it is legal to take the code, recompile and distribute.
It is legal however you must distribute your copy as GPL then, so no proprietary or non GPL compatible addons or software that use freecad as library are allowed.

If you want accurate answer you should make well articulated questions and explain the context of the question
Post Reply