Include generated git version string in executable and generated stub files
This commit is contained in:
21
resources/version.sh
Normal file
21
resources/version.sh
Normal file
@@ -0,0 +1,21 @@
|
||||
#!/bin/sh
|
||||
|
||||
createVersion() {
|
||||
local gitVersion=`git describe --long --always --dirty`
|
||||
local versionLoc="../src/version.h"
|
||||
local currentVersion=$(grep -oP '"\K.*(?=")' $versionLoc 2>/dev/null)
|
||||
|
||||
if [ ! -z "$1" ] && [ "$1" == "-d" ]; then
|
||||
gitVersion="${gitVersion}-debug"
|
||||
fi
|
||||
if [ "$gitVersion" == "$currentVersion" ]; then
|
||||
return 0
|
||||
else
|
||||
echo "Creating version header: ${gitVersion}"
|
||||
cat <<VERSION_END > "$versionLoc"
|
||||
#define GITVERSION "${gitVersion}"
|
||||
VERSION_END
|
||||
fi
|
||||
}
|
||||
|
||||
createVersion $*
|
Reference in New Issue
Block a user