qt-labs / vstools

Other
73 stars 23 forks source link

Separate debug and release project folders #30

Closed FalsinSoft closed 3 weeks ago

FalsinSoft commented 1 month ago

If the project folder is the same (/out/build) for both builds debug and release sometimes happens with Visual Studio when some changes are made to the code and you switch from release to debug the source object file is not updated and, consequently, the breakpoints do not work. Configure a separate folder for debug and release seems to fix this problem.

acdemiralp commented 3 weeks ago

Hello, thank you very much for the fix. Can you please open the merge request to https://codereview.qt-project.org/ ( tutorial: https://wiki.qt.io/Qt_Contribution_Guidelines )?

Edit: I have taken the initiative to enter the change. Please see https://codereview.qt-project.org/c/qt-labs/vstools/+/584484 .

FalsinSoft commented 3 weeks ago

Hi Thank you, I was about to insert it but I saw that you already inserted it. I'm sorry I submitted the patch here but I didn't note the official repositiry was already present into the qt git server.

By the way are you interested in another addtion to the CMakepreset file allowing to run the executable from Visual Studio in release mode? Currently if you try to run the executable from VS it can not find the Qt dll libraries and doesn't execute. I made a change in the CMakepreset file allowing to run correctly but I would need time to study the VS Tool plugin code to find the correct point to add. Since you work on the project and know the code better thanme can I explain the change to allow you to make the patch?

acdemiralp commented 3 weeks ago

Hello, sure, please go ahead. It should be able to find the .dlls if the preset file is setup correctly. I will look into it according to the information that you provide.

FalsinSoft commented 3 weeks ago

Thank you, this is the changes I made in the json files:

Inside CMakePresets.json

{
  "version": 3,
  "configurePresets": [
    {
      "name": "Windows-Path",
      "hidden": true,
      "condition": {
        "type": "equals",
        "lhs": "${hostSystemName}",
        "rhs": "Windows"
      },
      "environment": {
        "PATH": "$env{QTDIR}/bin;$penv{PATH}"
      }
    },
    {
      "hidden": true,
      "name": "Qt",
      "cacheVariables": {
        "CMAKE_PREFIX_PATH": "$env{QTDIR}"
      },
      "vendor": {
        "qt-project.org/Qt": {
          "checksum": "wVa86FgEkvdCTVp1/nxvrkaemJc="
        }
      }
    }
  ],
  "vendor": {
    "qt-project.org/Presets": {
      "checksum": "Vyxbyrr5UFn1ijiVgP7iMzGbvSc="
    }
  }
}

Inside CMakeUserPresets.json both preset Debug-x64 and Release-x64 should inderit as follow:

"inherits": [
        "Windows-Path",
        "Qt-Default"
      ]

this add the qt dll path and allow executable run from VS. Please note I had to make the changes this way because I can't directly change the checksum parts since any changes are automatically removed by the plugin. But following this concept it is possible to insert this addition also in a less complicated way...

FalsinSoft commented 3 weeks ago

Hi It's ok my explanation about last feature? If you confirm I'll close this merge request. Thank you

acdemiralp commented 3 weeks ago

Hello, yes it is clear, and you can close it.

The runtime library directory is added to path automatically when the executable is launched within Visual Studio, and I can confirm that this behavior works for new projects. I will attempt to find in which cases it is not added correctly.

FalsinSoft commented 3 weeks ago

Hi Just tried to create a new project using latest Visual studio version 17.11.1 and latest Qt VS Tools plugin version 3.2.0.47. I created a QtQuick app using the plugin wizard. The result is the same, if I compire and start the app in debug mode it execute and find the runtime libraries but in release mode compile the app but doesn't start cause no Qt runtime dll libraries are found.

Now I close this issue but if you need additional info or support contact me directly to my email falsinsoft@gmail.com thank you