Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. General and Desktop
  4. Condition to auto detect installed Qt Versions in Qt Creator
Forum Updated to NodeBB v4.3 + New Features

Condition to auto detect installed Qt Versions in Qt Creator

Scheduled Pinned Locked Moved Solved General and Desktop
8 Posts 5 Posters 8.2k Views 2 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • J Offline
    J Offline
    jesperm
    wrote on 27 Sept 2017, 14:27 last edited by
    #1

    I currently have multiple Qt Versions in Qt Creator running on Ubuntu. These are built for specific hardware variants (mainly ARM-based). So far I have added these versions manually to Qt Creator (Tools > Options > Build & Run > Qt Versions), but this is a step I would like to avoid if possible. My wish is to distribute these custom Qt Versions to other users within my company and not force them to manually add them. Just ask them to install (using viable methods) and they should appear in Qt Creator.

    I know that Qt Versions can be detected automatically, but so far I have been unable to get hold of the information which states how these are actually detected and added automatically.

    The following page only mentions this briefly:
    “Qt Creator automatically detects the Qt versions that are registered by your system or by installers.”

    So my question is: how are Qt Versions registered on the system so they may be auto-detected by Qt Creator?

    1 Reply Last reply
    0
    • J Offline
      J Offline
      jesperm
      wrote on 28 Sept 2017, 12:22 last edited by
      #5

      I believe I have come to an conclusion on this matter after using the sdktool and watched this presentation.

      Auto-discovered Compilers/Versions/Kits are all added using the sdktool. There is no magic here sadly (which I hoped), they have to be added using this tool by passing the required arguments. Versions and Compiler (toolchain) may be added independently, but when a Kit is to be added, it has dependency both to added Version and Compiler (by unique IDs entered when adding them). Therefore they should preferably all be added using the same method.

      These settings are also unique for the installed Qt Creator version. I guess there might be a difference depending on how you have installed Qt Creator. In my case it is built from source code directly, so these settings are stored in the build directory (making these settings unique for this Qt Creator). The presentation suggests that system-wide settings are stored under /usr/share/qtcreator/.

      tldr; use sdktool to add auto-discoverable Compilers, Versions and Kits to Qt Creator.

      1 Reply Last reply
      1
      • H Offline
        H Offline
        hskoglund
        wrote on 27 Sept 2017, 14:51 last edited by
        #2

        Hi, my guess is in one of the files in the ~/config/QtProject/qtcreator folder

        J 1 Reply Last reply 28 Sept 2017, 07:20
        0
        • P Offline
          P Offline
          Pablo J. Rogina
          wrote on 27 Sept 2017, 15:25 last edited by
          #3

          @jesperm What about taking a look at Qt Creator source code? In particular this sdktool may be of interest for you I guess.

          Upvote the answer(s) that helped you solve the issue
          Use "Topic Tools" button to mark your post as Solved
          Add screenshots via postimage.org
          Don't ask support requests via chat/PM. Please use the forum so others can benefit from the solution in the future

          1 Reply Last reply
          1
          • H hskoglund
            27 Sept 2017, 14:51

            Hi, my guess is in one of the files in the ~/config/QtProject/qtcreator folder

            J Offline
            J Offline
            jesperm
            wrote on 28 Sept 2017, 07:20 last edited by jesperm
            #4

            @hskoglund Thanks for the reply, it appears that you are on the right track according to this page. "profiles.xml" and "qtversions.xml" stores information about the kits and versions, but I'm actually having a hard time finding these exact files in my system. What I did find was ".../QtProject/qtcreator/profiles-original.xml" and it contains the information which is related to the auto discovery of kits.

            One of the keys in the file is "<value type="bool" key="PE.Profile.AutoDetected">true</value>", I have seen other examples of this file on the Internet with the key set to "false". In my eyes this file is the result from a registered Qt Version, due to the naming of the key. I'll look further into this.

            @Pablo-J.-Rogina Thanks for the direction. Looking at the source code was actually an idea I had from the start, but had no clue where to start looking. The file previously mentioned (profiles-original.xml) has a stamp written by the sdktool, so looking further into the sdktool seems to be the right call - if that tool generated the file, it should contain more information how the kits are actually discovered.

            A 1 Reply Last reply 28 Jul 2021, 01:09
            1
            • J Offline
              J Offline
              jesperm
              wrote on 28 Sept 2017, 12:22 last edited by
              #5

              I believe I have come to an conclusion on this matter after using the sdktool and watched this presentation.

              Auto-discovered Compilers/Versions/Kits are all added using the sdktool. There is no magic here sadly (which I hoped), they have to be added using this tool by passing the required arguments. Versions and Compiler (toolchain) may be added independently, but when a Kit is to be added, it has dependency both to added Version and Compiler (by unique IDs entered when adding them). Therefore they should preferably all be added using the same method.

              These settings are also unique for the installed Qt Creator version. I guess there might be a difference depending on how you have installed Qt Creator. In my case it is built from source code directly, so these settings are stored in the build directory (making these settings unique for this Qt Creator). The presentation suggests that system-wide settings are stored under /usr/share/qtcreator/.

              tldr; use sdktool to add auto-discoverable Compilers, Versions and Kits to Qt Creator.

              1 Reply Last reply
              1
              • H Offline
                H Offline
                hunger
                wrote on 28 Sept 2017, 20:49 last edited by
                #6

                Great that my presentation still helps out people:-)

                There is no "global" configuration of stuff, everything is limited to one Qt Creator instance. /usr/share/qtcreator/... is just the default location for a system-wide installed instance of Creator on most Linux distributions.

                The sdktool is indeed the best way to register toolchains/qt versions/kits/debuggers/... with one Qt Creator instance. It works by managing some xml files in ../share/qtcreator/QtProject (path is relative to the Qt Creator executable that the sdktool belongs to!).

                The ids registered with the sdktool do not get randomized, so you can use it to set up a set of machines with kits that will work across the whole set.

                You can symlink/copy the settings to new creator instances though by just placing the ../share/qtcreator/QtProject directory of one instance into the right place for another and it will be picked up by both instances and creator should watch the files and react to them changing when it is running (but this has not been properly tested since Nokia times, so I will not bet that this still works;-).

                The instance settings will also get copied into your user configuration and (some) of the sdktool settings can get overridden there by the users. There is a flag in the XML stating which settings are "fixed", the others can be changed.

                J 1 Reply Last reply 29 Sept 2017, 08:01
                3
                • H hunger
                  28 Sept 2017, 20:49

                  Great that my presentation still helps out people:-)

                  There is no "global" configuration of stuff, everything is limited to one Qt Creator instance. /usr/share/qtcreator/... is just the default location for a system-wide installed instance of Creator on most Linux distributions.

                  The sdktool is indeed the best way to register toolchains/qt versions/kits/debuggers/... with one Qt Creator instance. It works by managing some xml files in ../share/qtcreator/QtProject (path is relative to the Qt Creator executable that the sdktool belongs to!).

                  The ids registered with the sdktool do not get randomized, so you can use it to set up a set of machines with kits that will work across the whole set.

                  You can symlink/copy the settings to new creator instances though by just placing the ../share/qtcreator/QtProject directory of one instance into the right place for another and it will be picked up by both instances and creator should watch the files and react to them changing when it is running (but this has not been properly tested since Nokia times, so I will not bet that this still works;-).

                  The instance settings will also get copied into your user configuration and (some) of the sdktool settings can get overridden there by the users. There is a flag in the XML stating which settings are "fixed", the others can be changed.

                  J Offline
                  J Offline
                  jesperm
                  wrote on 29 Sept 2017, 08:01 last edited by
                  #7

                  @hunger Thanks for the clarifications and the extra tips how symlink/copy could be an valuable option! I came to the right conclusion as I have understood it :)

                  Knowing it is tied to one instance of Qt Creator is very valuable information for the future. Then I know that it is necessary to either rerun sdktool for a new instance, or as you suggest, use symlink/copy the files.

                  So your presentation certainly helped; I'm glad that all these presentations are floating around and also the presentation material.

                  1 Reply Last reply
                  0
                  • J jesperm
                    28 Sept 2017, 07:20

                    @hskoglund Thanks for the reply, it appears that you are on the right track according to this page. "profiles.xml" and "qtversions.xml" stores information about the kits and versions, but I'm actually having a hard time finding these exact files in my system. What I did find was ".../QtProject/qtcreator/profiles-original.xml" and it contains the information which is related to the auto discovery of kits.

                    One of the keys in the file is "<value type="bool" key="PE.Profile.AutoDetected">true</value>", I have seen other examples of this file on the Internet with the key set to "false". In my eyes this file is the result from a registered Qt Version, due to the naming of the key. I'll look further into this.

                    @Pablo-J.-Rogina Thanks for the direction. Looking at the source code was actually an idea I had from the start, but had no clue where to start looking. The file previously mentioned (profiles-original.xml) has a stamp written by the sdktool, so looking further into the sdktool seems to be the right call - if that tool generated the file, it should contain more information how the kits are actually discovered.

                    A Offline
                    A Offline
                    artemnkfv
                    wrote on 28 Jul 2021, 01:09 last edited by
                    #8

                    @jesperm
                    Thanks for info.
                    Changed the path to system location of qmake.Save me a lot of time.

                    1 Reply Last reply
                    0

                    • Login

                    • Login or register to search.
                    • First post
                      Last post
                    0
                    • Categories
                    • Recent
                    • Tags
                    • Popular
                    • Users
                    • Groups
                    • Search
                    • Get Qt Extensions
                    • Unsolved