Add version to About dialog

This commit is contained in:
2022-04-24 13:30:51 +02:00
parent cee6979ece
commit cbc6775756
5 changed files with 41 additions and 3 deletions
+11 -1
View File
@@ -50,7 +50,7 @@ endif()
add_executable(tenmon WIN32 ${TENMON_SRC}) add_executable(tenmon WIN32 ${TENMON_SRC})
find_path(FITS_INCLUDE fitsio2.h PATH_SUFFIXES cfitsio REQUIRED) find_path(FITS_INCLUDE fitsio2.h PATH_SUFFIXES cfitsio REQUIRED)
target_include_directories(tenmon PRIVATE ${OpenCV_INCLUDE_DIRS} ${FITS_INCLUDE} 3rdparty/include) target_include_directories(tenmon PRIVATE ${OpenCV_INCLUDE_DIRS} ${FITS_INCLUDE} 3rdparty/include ${CMAKE_BINARY_DIR})
if(WIN32) if(WIN32)
target_link_directories(tenmon PRIVATE 3rdparty/lib/Windows) target_link_directories(tenmon PRIVATE 3rdparty/lib/Windows)
@@ -81,3 +81,13 @@ if(UNIX)
endif() endif()
endif() endif()
endif(UNIX) endif(UNIX)
option(RELEASE_BUILD "Release build" OFF)
if(RELEASE_BUILD)
add_custom_target(tenmon_version COMMAND ${CMAKE_COMMAND} -Dlocal_dir="${CMAKE_CURRENT_SOURCE_DIR}" -Doutput_dir="${CMAKE_CURRENT_BINARY_DIR}"
-P "${CMAKE_CURRENT_SOURCE_DIR}/gitversion.cmake")
add_dependencies(tenmon tenmon_version)
else()
execute_process(COMMAND ${CMAKE_COMMAND} -Dlocal_dir=${CMAKE_CURRENT_SOURCE_DIR} -Doutput_dir=${CMAKE_CURRENT_BINARY_DIR}
-P "${CMAKE_CURRENT_SOURCE_DIR}/gitversion.cmake")
endif()
+4 -1
View File
@@ -4,6 +4,7 @@
#include <QVBoxLayout> #include <QVBoxLayout>
#include <QDialogButtonBox> #include <QDialogButtonBox>
#include <QFile> #include <QFile>
#include "gitversion.h"
About::About(QWidget *parent) : QDialog(parent) About::About(QWidget *parent) : QDialog(parent)
{ {
@@ -14,7 +15,9 @@ About::About(QWidget *parent) : QDialog(parent)
QFile tenmonText(":/about/tenmon"); QFile tenmonText(":/about/tenmon");
tenmonText.open(QIODevice::ReadOnly); tenmonText.open(QIODevice::ReadOnly);
label->setText(tenmonText.readAll()); QByteArray text = tenmonText.readAll();
text.replace("@GITVERSION@", GITVERSION);
label->setText(text);
label->setOpenExternalLinks(true); label->setOpenExternalLinks(true);
QTextEdit *pcl = new QTextEdit(this); QTextEdit *pcl = new QTextEdit(this);
+1 -1
View File
@@ -2,7 +2,7 @@
<td style="padding-right:10px"><img src=":/org.nou.tenmon.png"></td> <td style="padding-right:10px"><img src=":/org.nou.tenmon.png"></td>
<td><h3>Tenmon</h3> <td><h3>Tenmon</h3>
Tenmon is FITS/XISF image viewer and converter. It also index FITS keywords.<br> Tenmon is FITS/XISF image viewer and converter. It also index FITS keywords.<br>
Copyright © 2022 Dušan Poizl<br><br> v@GITVERSION@ Copyright © 2022 Dušan Poizl<br><br>
This program is free software: you can redistribute it and/or modify<br> This program is free software: you can redistribute it and/or modify<br>
it under the terms of the GNU General Public License as published by<br> it under the terms of the GNU General Public License as published by<br>
+19
View File
@@ -0,0 +1,19 @@
set(_build_version "unknown")
find_package(Git)
if(GIT_FOUND)
execute_process(
COMMAND ${GIT_EXECUTABLE} describe --tags HEAD
WORKING_DIRECTORY "${local_dir}"
OUTPUT_VARIABLE _build_version
ERROR_QUIET
OUTPUT_STRIP_TRAILING_WHITESPACE
)
message(STATUS "GIT hash: ${_build_version}")
else()
message(STATUS "GIT not found")
endif()
message(STATUS "local:${local_dir} output:${output_dir}")
configure_file("${local_dir}/gitversion.h.in" "${output_dir}/gitversion.h" @ONLY)
+6
View File
@@ -0,0 +1,6 @@
#ifndef GITVERSION_H
#define GITVERSION_H
#define GITVERSION "@_build_version@"
#endif