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. Pulling git revision during build (with QT Creator)
Forum Updated to NodeBB v4.3 + New Features

Pulling git revision during build (with QT Creator)

Scheduled Pinned Locked Moved Unsolved General and Desktop
11 Posts 6 Posters 3.5k Views 3 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.
  • mrjjM Offline
    mrjjM Offline
    mrjj
    Lifetime Qt Champion
    wrote on last edited by
    #2

    Hi
    as far as i know, no git.exe is include in Qt / Creator installers.

    1 Reply Last reply
    3
    • Pablo J. RoginaP Offline
      Pablo J. RoginaP Offline
      Pablo J. Rogina
      wrote on last edited by
      #3

      I agree with @mrjj. @mgreenish do you have git working fine in Windows so far?

      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

      M 1 Reply Last reply
      2
      • Pablo J. RoginaP Pablo J. Rogina

        I agree with @mrjj. @mgreenish do you have git working fine in Windows so far?

        M Offline
        M Offline
        mgreenish
        wrote on last edited by
        #4

        @Pablo-J.-Rogina I do have git working on windows, yes. But I guess I don't know how the command is passed to Windows, if Qt does a transition of the 'shell' command based on the OS or if it is passed as-is irrespective of the OS.

        1 Reply Last reply
        0
        • SGaistS Offline
          SGaistS Offline
          SGaist
          Lifetime Qt Champion
          wrote on last edited by
          #5

          Hi,

          On Windows, it might very well be git.exe.

          Interested in AI ? www.idiap.ch
          Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct

          1 Reply Last reply
          0
          • M Offline
            M Offline
            mgreenish
            wrote on last edited by
            #6

            What's the difference between using

            $(shell
            

            and the replace function

            $$system(
            

            Is there any difference? The only comparison of the two I found said that $$system wasn't run on every build.

            1 Reply Last reply
            0
            • aha_1980A Offline
              aha_1980A Offline
              aha_1980
              Lifetime Qt Champion
              wrote on last edited by
              #7

              @mgreenish: Is git.exe in your PATH environment variable?

              When I experimented with including the Git hash into the executable, I used:

              SHA1 = $$system(git rev-parse --short=8 HEAD)

              I can't directly tell you what's the difference between $shell and $$system, but there are functions that are run on every make and some are run on every qmake.

              Qt has to stay free or it will die.

              1 Reply Last reply
              2
              • M Offline
                M Offline
                mgreenish
                wrote on last edited by
                #8

                @aha_1980 Yes, git.exe seems to be included in my path. I can open a command window in Windows, cd to the project directory and type in the following command:

                git rev-list HEAD --count
                

                I get the expect result as output. As such, it must be included in the path.

                1 Reply Last reply
                0
                • M Offline
                  M Offline
                  mgreenish
                  wrote on last edited by
                  #9

                  In any case, neither

                  VERSION_BUILD='$(shell git rev-list HEAD --count)'
                  

                  nor

                  VERSION_BUILD=$$system(git rev-list HEAD --count)
                  

                  seem to work. The current version number that shows up is 0.1. so the sprintf statement seems to be formatted correctly and likely the problem is with the assignment of VERSION_BUILD.

                  1 Reply Last reply
                  0
                  • Pablo J. RoginaP Offline
                    Pablo J. RoginaP Offline
                    Pablo J. Rogina
                    wrote on last edited by
                    #10

                    @mgreenish said in Pulling git revision during build (with QT Creator):

                    git.exe seems to be included in my path. I can open a command window in Windows, cd to the project directory and type in the following command

                    Could you please start Qt Creator from that same command window and try. I guess you may not have the same PATH values in Qt Creator if started from Windows menu

                    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
                    0
                    • AndrewBindrawA Offline
                      AndrewBindrawA Offline
                      AndrewBindraw
                      wrote on last edited by
                      #11

                      Hi.
                      Please, check my repo. Set Qt App version from git.

                      https://github.com/mrbindraw/TestVersion

                      1 Reply Last reply
                      1

                      • Login

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