Page 4 of 6

Re: Version/Build number in Launcher window

Posted: 08 Feb 2014, 16:06
by scrawl
It seems travis now always fails with:
CMake Error at CMakeLists.txt:39 (message):
Failed to get valid version information from Git
https://travis-ci.org/zinnschlag/openmw/builds/18477085

Re: Version/Build number in Launcher window

Posted: 08 Feb 2014, 21:08
by pvdk
That must be because Travis can't find git. Does it have git included in its path?

EDIT: the link suggests it does run some git commands successfully, but I suspect find_package(Git QUIET) fails. Maybe removing the QUIET part will give more information.

Re: Version/Build number in Launcher window

Posted: 09 Feb 2014, 12:58
by scrawl
Also, this will most definitely fail for downloaded source tarballs, which do not have a git repository in them.
Any idea how to handle that?

Re: Version/Build number in Launcher window

Posted: 09 Feb 2014, 13:06
by pvdk
Yeah good point, maybe add a CMake flag for that, or only show the version info if the git tag was found?

Re: Version/Build number in Launcher window

Posted: 09 Feb 2014, 13:27
by scrawl
I think we'll still want openmw --version to show the correct version for a tarball, because afaik some distros use that for their packages.

Re: Version/Build number in Launcher window

Posted: 10 Feb 2014, 22:08
by cc9cii
Seems to break windows build. I'm using TortoiseGit so it might be that CMake doesn't know where to find git executable. Worked around by editing CMakeLists for now.

Edit: adding %AppData%\..\Local\Programs\Git\bin to PATH (via Control Panel) fixes it

Re: Version/Build number in Launcher window

Posted: 12 Feb 2014, 10:03
by Greendogo
I assume at some point the OpenCS's version/build number will be found in a window/menu somewhere inside it?

Re: Version/Build number in Launcher window

Posted: 12 Feb 2014, 10:19
by Zini
At some point. Still very short on manpower for OpenCS, so less important tasks tend to be left by the wayside for now.

Re: Version/Build number in Launcher window

Posted: 13 Feb 2014, 12:10
by scrawl
I have found the problem for travis. It uses a git clone --depth=50, that is, a shallow clone with history limited to the last 50 revisions. That means it also doesn't have the tags, and git rev-list --tags will return nothing.

Edit: doing a git fetch --tags first resolves this.

As mentioned earlier though, we still want a way to disable this stuff for tarballs.

Re: Version/Build number in Launcher window

Posted: 13 Feb 2014, 12:55
by pvdk
Yes, for the shallow clone problem and for the source tarball version problem I actually found a solution in the Kdenlive CMakeLists.txt:

Code: Select all

# To be switched on when releasing.
option(RELEASE_BUILD "Remove Git revision from program version (use for stable releases)" OFF)

# Get current version.
set(VERSION "\"${KDENLIVE_VERSION}\"")
if(NOT RELEASE_BUILD)
  if(EXISTS ${PROJECT_SOURCE_DIR}/.git)
    # Probably a Git workspace: determine the revision.
    find_package(Git)
    if(GIT_FOUND)
      exec_program(${GIT_EXECUTABLE}
        ${CMAKE_CURRENT_SOURCE_DIR}
        ARGS "describe --tags"
        OUTPUT_VARIABLE KDENLIVE_GIT_REVISION
        RETURN_VALUE TAG_RESULT
      )
      # git describe --tags failed, for example it fails if repo was checked with depth=1
      if(NOT ${TAG_RESULT} EQUAL 0)
        exec_program(${GIT_EXECUTABLE}
          ${CMAKE_CURRENT_SOURCE_DIR}
          ARGS "describe --always"
          OUTPUT_VARIABLE KDENLIVE_GIT_REVISION
        )
      endif(NOT ${TAG_RESULT} EQUAL 0)
      message("Current Kdenlive Git revision is ${KDENLIVE_GIT_REVISION}")
      set(VERSION "\"${KDENLIVE_VERSION} (rev. ${KDENLIVE_GIT_REVISION})\"")
    else(GIT_FOUND)
      message("Could not determine the Git revision")
    endif(GIT_FOUND)
  endif(EXISTS ${PROJECT_SOURCE_DIR}/.git)
endif(NOT RELEASE_BUILD)
How does that look? We still would have to define the version manually for source tarball builds though.