FreeCAD debug build with apeltauer's libpack builds release instead

Having trouble installing or compiling FreeCAD? Get help here.
Forum rules
Be nice to others! Respect the FreeCAD code of conduct!
User avatar
apeltauer
Posts: 399
Joined: Fri Aug 11, 2017 2:19 pm

Re: FreeCAD debug build with apeltauer's libpack builds release instead

Post by apeltauer »

too many cons if your not already using vs... :)
wmayer
Founder
Posts: 20317
Joined: Thu Feb 19, 2009 10:32 am
Contact:

Re: FreeCAD debug build with apeltauer's libpack builds release instead

Post by wmayer »

apeltauer wrote: Thu May 02, 2019 9:31 am too many cons if your not already using vs... :)
I don't. I only installed Visual Build Tools to get the naked compiler without IDE.
User avatar
DeepSOIC
Veteran
Posts: 7896
Joined: Fri Aug 29, 2014 12:45 am
Location: used to be Saint-Petersburg, Russia

Re: FreeCAD debug build with apeltauer's libpack builds release instead

Post by DeepSOIC »

apeltauer wrote: Thu May 02, 2019 5:03 am Sorry for the question, but why dont you use visual studio?
For me, that's simply:
* I'm familiar with Qt creator, I've been using it from the start
* FreeCAD's GUI is Qt, so it kinda makes sense to pick Qt Creator, as I would expect it to be better tuned to Qt development. Although I can't say I feel many advantages, apart from built-in .ui editor, maybe because I never actually compared the two.
User avatar
DeepSOIC
Veteran
Posts: 7896
Joined: Fri Aug 29, 2014 12:45 am
Location: used to be Saint-Petersburg, Russia

Re: FreeCAD debug build with apeltauer's libpack builds release instead

Post by DeepSOIC »

Today I found out a possible clue, when looking across FreeCAD_trunk.cbp.

Code: Select all

<?xml version="1.0" encoding="UTF-8"?>
<CodeBlocks_project_file>
    <FileVersion major="1" minor="6"/>
    <Project>
        <Build>
            ...
            <Target title="FreeCADGui">
                ...
                <Compiler>
                    ...
                    <Add option="-DCMAKE_BUILD_TYPE=&quot;Release&quot;"/>
                    ...
                </Compiler>
                ...
            </Target>
            <Target title="FreeCADGui/fast">
                ...
                <Compiler>
                    ...
                    <Add option="-DCMAKE_BUILD_TYPE=&quot;Release&quot;"/>
                    ...
                </Compiler>
Only FreeCADGui entries have that enforced release. No other targets.
User avatar
DeepSOIC
Veteran
Posts: 7896
Joined: Fri Aug 29, 2014 12:45 am
Location: used to be Saint-Petersburg, Russia

Re: FreeCAD debug build with apeltauer's libpack builds release instead

Post by DeepSOIC »

DeepSOIC wrote: Sat Apr 27, 2019 12:59 pmIt seems like I can debug freecad even in release build, so if I fail to make a debug build, that will still work.
Not so fast! I can watch how the execution goes, but I get no variable inspection capability. And the debugger freezes sometimes, forcing me to terminate qt creator.
wmayer
Founder
Posts: 20317
Joined: Thu Feb 19, 2009 10:32 am
Contact:

Re: FreeCAD debug build with apeltauer's libpack builds release instead

Post by wmayer »

Only FreeCADGui entries have that enforced release. No other targets.
That comes from src/Gui/CMakeLists.txt:

Code: Select all

IF(CMAKE_BUILD_TYPE)
    add_definitions(-DCMAKE_BUILD_TYPE="${CMAKE_BUILD_TYPE}")
ENDIF(CMAKE_BUILD_TYPE)
and the pre-processor define is used in SplashScreen.cpp in case neither _DEBUG nor NDEBUG is defined.

But nevertheless it's strange that the variable is set to "Release" in your case. But are you sure you looked in the correct build directory? For every build directory QtCreator creates the file FreeCAD_trunk.cbp.

On my system I have four different build directories for QtCreator and for the two where a debug version is built CMAKE_BUILD_TYPE is correctly set to Debug.
User avatar
DeepSOIC
Veteran
Posts: 7896
Joined: Fri Aug 29, 2014 12:45 am
Location: used to be Saint-Petersburg, Russia

Re: FreeCAD debug build with apeltauer's libpack builds release instead

Post by DeepSOIC »

wmayer wrote: Thu May 16, 2019 12:07 pm But are you sure you looked in the correct build directory? For every build directory QtCreator creates the file FreeCAD_trunk.cbp.
Well, I'm kinda sure... even though I have created quite a few build directories, all builds were supposed to be debug and turned out to be release. I think I will delete all build directories and redo it from scratch yet again, just to verify... but later...
wmayer
Founder
Posts: 20317
Joined: Thu Feb 19, 2009 10:32 am
Contact:

Re: FreeCAD debug build with apeltauer's libpack builds release instead

Post by wmayer »

DeepSOIC wrote: Fri Apr 26, 2019 11:11 pm Also, peculiarly, when I run with debugger, Qt Creator bugs me with an alert that it doesn't look like a debug build. And the executable is named "FreeCAD.exe", not "FreeCAD_d.exe" like it used to be.
That's an issue that I discovered yesterday too with the new LibPack. It's caused by the Shiboken2Config.cmake file where a line is added that explicitly sets CMAKE_BUILD_TYPE to Release. But just removing this line is not an option because otherwise for some reason CMake configure fails when creating VS project files because for this generator CMAKE_BUILD_TYPE isn't defined.

So, I pushed a workaround that saves & restores CMAKE_BUILD_TYPE when doing the Shiboken2 check. git commit cc59222aa0
Actually you encounter this issue only when using nmake, jom or ninja because these are generators that rely on the existence of CMAKE_BUILD_TYPE while when creating regular VS projects you won't see the problem.

Off-topic:
It's also possible to use msbuild instead of jom or ninja. See: https://forum.qt.io/topic/91565/using-m ... -qtcreator
I recently installed QtCreator 4.9.2 and the default CMake generator is set to ninja. Obviously it handles parallel builds (i.e. it spawns several cl.exe processes) but a single build takes ages. So, I am testing msbuild right now and just for fun wanted to see if it can be used directly within QtCreator.
User avatar
DeepSOIC
Veteran
Posts: 7896
Joined: Fri Aug 29, 2014 12:45 am
Location: used to be Saint-Petersburg, Russia

Re: FreeCAD debug build with apeltauer's libpack builds release instead

Post by DeepSOIC »

wmayer wrote: Thu Aug 01, 2019 10:49 am
Thanks!
Post Reply