Use output of git describe as version.

This commit is contained in:
Arttu Ylä-Outinen 2016-03-09 14:44:48 +02:00
parent f8edf28161
commit 54f08f2bdb
3 changed files with 16 additions and 1 deletions

View file

@ -31,6 +31,7 @@ kvazaar_SOURCES = \
yuv_io.h yuv_io.h
kvazaar_LDADD = libkvazaar.la $(LIBS) kvazaar_LDADD = libkvazaar.la $(LIBS)
kvazaar_CPPFLAGS = -DKVZ_VERSION="`$(srcdir)/../tools/version.sh`"
libkvazaar_la_SOURCES = \ libkvazaar_la_SOURCES = \
bitstream.c \ bitstream.c \

View file

@ -181,7 +181,9 @@ typedef int16_t coeff_t;
// NOTE: When making a release, check to see if incrementing libversion in // NOTE: When making a release, check to see if incrementing libversion in
// configure.ac is necessary. // configure.ac is necessary.
#define KVZ_VERSION 0.8.3 #ifndef KVZ_VERSION
#define KVZ_VERSION v0.8.3
#endif
#define VERSION_STRING QUOTE_EXPAND(KVZ_VERSION) #define VERSION_STRING QUOTE_EXPAND(KVZ_VERSION)
//#define VERBOSE 1 //#define VERBOSE 1

12
tools/version.sh Executable file
View file

@ -0,0 +1,12 @@
#!/bin/sh
cd "$(dirname "$0")"
cd ..
if type git >/dev/null 2>/dev/null && [ -d .git ]; then
version="$(git describe --dirty --tags --match 'v*')"
else
version="$(awk '/#define KVZ_VERSION/ { print $3 }' src/global.h)"
fi
printf '%s\n' "$version"