attempt to insert revision number automatically

Qt solution needs some work to trigger rebuild.
This commit is contained in:
sinamas 2013-05-05 19:58:52 +02:00
parent 02c71b7ae2
commit 9a9c2093f7
4 changed files with 33 additions and 10 deletions

View File

@ -603,7 +603,11 @@ void GambatteMenuHandler::about() {
QMessageBox::about(
&mw_,
"About Gambatte",
"<h3>Gambatte Qt (git)</h3>"
"<h3>Gambatte Qt"
#ifdef GAMBATTE_QT_VERSION_STR
" (" GAMBATTE_QT_VERSION_STR ")"
#endif
"</h3>"
"<p>"
"<b>Homepage:</b> "
"<a href=\"https://github.com/sinamas/gambatte\">"

View File

@ -30,3 +30,7 @@ DESTDIR = ../bin
INCLUDEPATH += ../../libgambatte/include
DEPENDPATH += ../../libgambatte/include
LIBS += -L../../libgambatte -lgambatte -lz
exists(../../.git) {
MY_GIT_REVNO = $$system(git rev-list HEAD --count)
!isEmpty(MY_GIT_REVNO):DEFINES += GAMBATTE_QT_VERSION_STR='\\"r$$MY_GIT_REVNO\\"'
}

View File

@ -1,19 +1,19 @@
global_cflags = ARGUMENTS.get('CFLAGS', '-Wall -Wextra -O2 -fomit-frame-pointer')
global_cxxflags = ARGUMENTS.get('CXXFLAGS', global_cflags + ' -fno-exceptions -fno-rtti')
global_defines = ' -DHAVE_STDINT_H'
import subprocess
cflags = ARGUMENTS.get('CFLAGS', '-Wall -Wextra -O2 -fomit-frame-pointer')
cxxflags = ARGUMENTS.get('CXXFLAGS', cflags + ' -fno-exceptions -fno-rtti')
vars = Variables()
vars.Add('CC')
vars.Add('CXX')
env = Environment(CPPPATH = ['src', '../libgambatte/include', '../common'],
CFLAGS = global_cflags + global_defines,
CXXFLAGS = global_cxxflags + global_defines,
CFLAGS = cflags,
CXXFLAGS = cxxflags,
CPPDEFINES = { 'HAVE_STDINT_H': None },
variables = vars)
env.ParseConfig('sdl-config --cflags --libs')
sourceFiles = Split('''
src/gambatte_sdl.cpp
src/audiosink.cpp
src/blitterwrapper.cpp
src/parser.cpp
@ -44,4 +44,15 @@ conf = env.Configure()
conf.CheckLib('z')
conf.Finish()
env.Program('gambatte_sdl', sourceFiles)
version_str_def = {}
if Dir('../.git').exists():
try:
git_revno = subprocess.check_output("git rev-list HEAD --count", shell=True).strip()
version_str_def = { 'GAMBATTE_SDL_VERSION_STR': r'\"r' + git_revno + r'\"' }
except subprocess.CalledProcessError:
pass
env.Program('gambatte_sdl',
[env.Object('src/gambatte_sdl.cpp',
CPPDEFINES = env['CPPDEFINES'] + [version_str_def])]
+ sourceFiles)

View File

@ -555,7 +555,11 @@ static void printControls() {
}
int GambatteSdl::exec(int const argc, char const *const argv[]) {
std::puts("Gambatte SDL git");
std::puts("Gambatte SDL"
#ifdef GAMBATTE_SDL_VERSION_STR
" (" GAMBATTE_SDL_VERSION_STR ")"
#endif
);
std::set<Uint8> jdevnums;
BoolOption fsOption("\t\tStart in full screen mode\n", "full-screen", 'f');