Building Libs for Windows Debug Version with VS2017/Qt5.12

Having trouble installing or compiling FreeCAD? Get help here.
User avatar
sgrogan
Posts: 5204
Joined: Wed Oct 22, 2014 5:02 pm

Re: Building Libs for Windows Debug Version with VS2017/Qt5.12

Postby sgrogan » Fri Jul 19, 2019 10:44 pm

wmayer wrote:
Thu Jul 18, 2019 12:48 pm
Yes, it also annoys me to always copy these files manually when making a complete fresh build. I have this on my to-do list.
In your normal workflow do you create separate release and debug build directories or do you commingle them? If the later how do you manage the .pdb files?
wmayer
Site Admin
Posts: 14447
Joined: Thu Feb 19, 2009 10:32 am

Re: Building Libs for Windows Debug Version with VS2017/Qt5.12

Postby wmayer » Sat Jul 20, 2019 8:47 am

For some years now I use QtCreator as IDE and there the Debug and Release build directories are completely separate.
If the later how do you manage the .pdb files?
But for testing purposes I use msbuild from the command line which VS internally uses, too. There debug in release libraries are in a common directory. I don't see a problem with .pdb files because debug output files have the suffix "_d" which applies to .dll, .lib, .pdb, ... files.
Syres
Posts: 286
Joined: Thu Aug 09, 2018 11:14 am

Re: Building Libs for Windows Debug Version with VS2017/Qt5.12

Postby Syres » Sat Jul 20, 2019 8:57 pm

Are the contributors here aware of https://forum.freecadweb.org/viewtopic.php?f=8&t=37837 ? It's obviously not a workflow that many end users would carry out but I thought it should be brought to your attention.
User avatar
sgrogan
Posts: 5204
Joined: Wed Oct 22, 2014 5:02 pm

Re: Building Libs for Windows Debug Version with VS2017/Qt5.12

Postby sgrogan » Tue Jul 23, 2019 10:42 pm

Syres wrote:
Sat Jul 20, 2019 8:57 pm
Are the contributors here aware of https://forum.freecadweb.org/viewtopic.php?f=8&t=37837 ? It's obviously not a workflow that many end users would carry out but I thought it should be brought to your attention.
Thanks for the heads up. I responded in the thread.
User avatar
sgrogan
Posts: 5204
Joined: Wed Oct 22, 2014 5:02 pm

Re: Building Libs for Windows Debug Version with VS2017/Qt5.12

Postby sgrogan » Tue Jul 23, 2019 10:47 pm

wmayer wrote:
Sat Jul 20, 2019 8:47 am
For some years now I use QtCreator as IDE and there the Debug and Release build directories are completely separate.
Thanks again for the valuable info.
I'm very interested in making the transition to QTCreator myself. msbuild is open source and only the VS IDE is propriety making this transition would be great.
Any hints on setting up the QTCreator environment (a link would do), I'm short on time presently, but I think this would be a good step forward for the Win toolchain.
wmayer
Site Admin
Posts: 14447
Joined: Thu Feb 19, 2009 10:32 am

Re: Building Libs for Windows Debug Version with VS2017/Qt5.12

Postby wmayer » Wed Jul 24, 2019 8:33 am

Any hints on setting up the QTCreator environment (a link would do), I'm short on time presently, but I think this would be a good step forward for the Win toolchain.
First of all QtCreator is only an IDE without its own compiler, i.e. it uses that what it finds on your system. So, you still have to install the msvc compiler. And to save some space on your HDD you don't have to install the full VS IDE but only its compiler. Therefore download the utility "Visual Studio Installer" and follow the instructions.

Now install QtCreator. Now make sure that the LibPack's bin directory and your cmake is listed in your PATH environment. Start QtCreator and open Tools > Options and go to the first item called Kits. In the second tab "Qt Versions" add a new entry (assuming that the Qt version of the already existing entry doesn't match with Qt of the LibPack) and select qmake.exe of the LibPack.

Go back to the first tab and define the C/C++ compiler versions for the new Qt entry, select the CMake version and most important the generator. Recommended are NMake Makefile JOM or Ninja (don't choose NMake Makefile because it's too slow because it doesn't support parallel builds) and as Extra generator choose CodeBlocks.
Remark: With older QtCreator versions choosing the VS generators never worked, maybe this has changed.

Now configure the project with CMake. You can do that by opening the top-level CMakeLists.txt and running Configure but IMO it's a bit painful to do that inside QtCreator -- I prefer using CMakeGui. Create the two build directories for Debug and Release and choose the same generator as you defined inside QtCreator.

Now open the CMakeLists.txt file in QtCreator and define the already created build directories for Debug and Release.

If you go to File > Sessions > Manage you can create a new session e.g. called FreeCAD which saves all opened files when closing the project. Next time you start QtCreator choose the session FreeCAD.

Every time you load the FreeCAD project it runs CMake which is a bit annoying and it takes some minutes to parse it. No idea whether this behaviour can be changed.
User avatar
Kunda1
Posts: 4778
Joined: Thu Jan 05, 2017 9:03 pm

Re: Building Libs for Windows Debug Version with VS2017/Qt5.12

Postby Kunda1 » Wed Jul 24, 2019 11:51 am

#documentation
Want to contribute back to FC? Checkout:
#lowhangingfruit | Use the Source, Luke. | How to Help FreeCAD | How to report FC bugs and features
wmayer
Site Admin
Posts: 14447
Joined: Thu Feb 19, 2009 10:32 am

Re: Building Libs for Windows Debug Version with VS2017/Qt5.12

Postby wmayer » Wed Jul 24, 2019 1:16 pm

Kunda1 wrote:
Wed Jul 24, 2019 11:51 am
#documentation
This is not considered to be a complete tutorial. So, @sgrogan when you go through these steps you could note the details for a better documentation.
User avatar
sgrogan
Posts: 5204
Joined: Wed Oct 22, 2014 5:02 pm

Re: Building Libs for Windows Debug Version with VS2017/Qt5.12

Postby sgrogan » Wed Jul 24, 2019 10:07 pm

wmayer wrote:
Wed Jul 24, 2019 1:16 pm
This is not considered to be a complete tutorial. So, @sgrogan when you go through these steps you could note the details for a better documentation.
For sure! I hope to have time on the weekend. Thanks for the helpful starting point.