Uploaded image for project: 'Qt Visual Studio Tools'
  1. Qt Visual Studio Tools
  2. QTVSADDINBUG-1078

QtMsBuild system improvements

    XMLWordPrintable

Details

    • Windows
    • 31a82447e (dev)

    Description

      Background:
      Normally, the new QtMsBuild system puts a bunch of build output subdirectories into the Visual Studio Intermediate Directory, $(IntDir), such as "moc", "rcc", and "qmake".

      When comparing Visual Studio 2022 to Visual Studio 2019 the "qmake" folder is no longer in the correct location and this is causing a problem when having 2 projects in the same folder. Normally, the default Intermediate Directory in a Visual Studio project is $(Platform)/$(Configuration). So something like "x64/Debug". But when you have 2 projects in the same folder, that will cause problems with intermediate files from each project "colliding" with each other (e.g. one project's build keeps trying to overwrite the other project's files and vice versa). The solution to this is to change the Intermediate Director to $(Platform)/$(Configuration)/$(Project). So now the intermediate directory is something like "x64/Debug/ProjectA" and "x64/Debug/ProjectB" and each project can truly be built independently from the other one. This has been working fine for building Qt projects from VS2008 to VS2019. The "qmake" folder shows up in the following locations in this setup:
      x64/Debug/ProjectA/qmake
      x64/Debug/ProjectB/qmake

      Also, the "rcc" and "moc" folders would also show up properly in those locations. However, with Visual Studio 2022, the "qmake" folder is no longer being placed in the proper location. Regardless of what the Visual Studio Intermediate Directory is configured to be, the "qmake" folder is also placed in "$(Platform)/$(Configuration)". But the "moc" and "rcc" files are placed in the proper location.

      Like:
      x64/Debug/ProjectA/rcc
      x64/Debug/ProjectA/moc
      x64/Debug/ProjectB/rcc
      x64/Debug/ProjectB/moc

      but...
      x64/Debug/qmake

      Because of the incorrect placement of the "qmake" folder, both ProjectA and ProjectB are attempting to access files simultaneously and that causes build errors.

      This is most likely related to MSBuild's property evaluation. For the reference, please see the following:
      https://bugreports.qt.io/browse/QTVSADDINBUG-795
      https://bugreports.qt.io/browse/QTVSADDINBUG-886

      As a workaround:
      VS Property Manager can be used to define customized property values in a project like instructed at:
      https://bugreports.qt.io/browse/QTVSADDINBUG-795?focusedCommentId=651952&page=com.atlassian.jira.plugin.system.issuetabpanels%3Acomment-tabpanel#comment-651952

      But because this is working for "rcc" and "moc", this should not be needed and the user experience should be as good as with the previous versions of VS.

      Feature request:
      To make the QtMsBuild system have its own "Intermediate Directory" that doesn't depend on Visual Studios or, alternatively, reorganize the parts of the "qmake" folder that should be project-specific to work like the "rcc" and "moc" directories, maybe by reorganizing the information in "Qt.props" so that its relevant parts can still be loaded before $(IntDir) is defined, but not the part that specifies where the "qmake" folder should be located.

      Attachments

        No reviews matched the request. Check your Options in the drop-down menu of this sections header.

        Activity

          People

            ali.demiralp Ali Can Demiralp
            foxxx Tuukka Kettunen
            Votes:
            1 Vote for this issue
            Watchers:
            3 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved:

              Gerrit Reviews

                There are no open Gerrit changes