premake5: Add "version" command which prints the version string.

Needed for the CI to apply build naming by revision number.
This commit is contained in:
/dev/urandom 2016-01-17 21:47:40 +01:00
parent 1b572511da
commit e55f48dbe2
No known key found for this signature in database
GPG Key ID: 41322B973E0F295E

View File

@ -11,6 +11,20 @@ newoption {
description = "Do not use new virtual path structure (separating headers and source files)."
}
newaction {
trigger = "version",
description = "Returns the version string for the current commit of the source code.",
onWorkspace = function(wks)
-- get revision number via git
local proc = assert(io.popen("git rev-list --count HEAD", "r"))
local revNumber = assert(proc:read('*a')):gsub("%s+", "")
proc:close()
print(revNumber)
os.exit(0)
end
}
newaction {
trigger = "generate-buildinfo",
description = "Sets up build information file like version.h.",