Add full git commit to About dialog

This commit is contained in:
Mario Hüttel 2019-08-26 00:05:45 +02:00
parent 91633edc78
commit f60150e8c7
7 changed files with 29 additions and 3 deletions

View File

@ -25,4 +25,6 @@
/** @brief This string holds the @ref git-version-num of the app */
extern const char *_app_version_string;
/** @brief This string holds the git commit hash of the current HEAD revision */
extern const char *_app_git_commit;
/** @} */

7
main.c
View File

@ -89,11 +89,18 @@ static void app_about(GSimpleAction *action, GVariant *parameter, gpointer user_
(void)user_data;
(void)action;
(void)parameter;
GString *comment_text;
comment_text = g_string_new("gds-render is a tool fo rendering GDS2 layout files into vector graphics.");
g_string_append_printf(comment_text, "\n\n Full git commit: %s", _app_git_commit);
builder = gtk_builder_new_from_resource("/gui/about.glade");
dialog = GTK_DIALOG(gtk_builder_get_object(builder, "about-dialog"));
gtk_window_set_transient_for(GTK_WINDOW(dialog), NULL);
gtk_about_dialog_set_version(GTK_ABOUT_DIALOG(dialog), _app_version_string);
gtk_about_dialog_set_comments(GTK_ABOUT_DIALOG(dialog), comment_text->str);
g_string_free(comment_text, TRUE);
/* Load icon from resource */
logo_buf = gdk_pixbuf_new_from_resource_at_scale("/images/logo.svg", 100, 100, TRUE, &error);

View File

@ -6,7 +6,8 @@
<property name="can_focus">False</property>
<property name="type_hint">dialog</property>
<property name="program_name">GDS-Render Tool </property>
<property name="comments" translatable="yes">Tool for rendering GDS(II) layout files into LaTeX/TikZ code or directly into a PDF file</property>
<property name="version">!! Replaced during runtime !!</property>
<property name="comments" translatable="yes">!! Replaced during runtime !!</property>
<property name="website">https://git.shimatta.de/mhu/gds-render</property>
<property name="website_label" translatable="yes">Git Repository</property>
<property name="authors">Mario Hüttel &lt;mario.huettel@gmx.net&gt;</property>

View File

@ -2,4 +2,9 @@ add_library(version STATIC "version.c")
execute_process(COMMAND bash ./generate-version-string.sh
WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}
OUTPUT_VARIABLE GIT_VER)
target_compile_definitions(version PUBLIC PROJECT_GIT_VERSION=${GIT_VER})
execute_process(COMMAND bash ./generate-git-commit-string.sh
WORKING_DIRECTORY ${CMAKE_CURRENT_SOURCE_DIR}
OUTPUT_VARIABLE GIT_COMMIT)
message("Commit: ${GIT_COMMIT}")
message("Version: ${GIT_VER}")
target_compile_definitions(version PRIVATE PROJECT_GIT_VERSION=${GIT_VER} PROJECT_GIT_COMMIT=${GIT_COMMIT})

View File

@ -0,0 +1,3 @@
#!/bin/bash
git rev-parse --verify HEAD | tr -d '\n'

View File

@ -1 +1 @@
git describe --tags --dirty
git describe --tags --dirty | tr -d '\n'

View File

@ -33,4 +33,12 @@ const char *_app_version_string = xstr(PROJECT_GIT_VERSION);
const char *_app_version_string = "! version not set !";
#endif
#ifdef PROJECT_GIT_COMMIT
#define xstr(a) str(a)
#define str(a) #a
const char *_app_git_commit = xstr(PROJECT_GIT_COMMIT);
#else
const char *_app_git_commit = "! Commit hash not available !";
#endif
/** @} */