Add version to About dialog
This commit is contained in:
+11
-1
@@ -50,7 +50,7 @@ endif()
|
||||
add_executable(tenmon WIN32 ${TENMON_SRC})
|
||||
|
||||
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)
|
||||
target_link_directories(tenmon PRIVATE 3rdparty/lib/Windows)
|
||||
@@ -81,3 +81,13 @@ if(UNIX)
|
||||
endif()
|
||||
endif()
|
||||
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,6 +4,7 @@
|
||||
#include <QVBoxLayout>
|
||||
#include <QDialogButtonBox>
|
||||
#include <QFile>
|
||||
#include "gitversion.h"
|
||||
|
||||
About::About(QWidget *parent) : QDialog(parent)
|
||||
{
|
||||
@@ -14,7 +15,9 @@ About::About(QWidget *parent) : QDialog(parent)
|
||||
|
||||
QFile tenmonText(":/about/tenmon");
|
||||
tenmonText.open(QIODevice::ReadOnly);
|
||||
label->setText(tenmonText.readAll());
|
||||
QByteArray text = tenmonText.readAll();
|
||||
text.replace("@GITVERSION@", GITVERSION);
|
||||
label->setText(text);
|
||||
label->setOpenExternalLinks(true);
|
||||
|
||||
QTextEdit *pcl = new QTextEdit(this);
|
||||
|
||||
+1
-1
@@ -2,7 +2,7 @@
|
||||
<td style="padding-right:10px"><img src=":/org.nou.tenmon.png"></td>
|
||||
<td><h3>Tenmon</h3>
|
||||
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>
|
||||
it under the terms of the GNU General Public License as published by<br>
|
||||
|
||||
@@ -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)
|
||||
@@ -0,0 +1,6 @@
|
||||
#ifndef GITVERSION_H
|
||||
#define GITVERSION_H
|
||||
|
||||
#define GITVERSION "@_build_version@"
|
||||
|
||||
#endif
|
||||
Reference in New Issue
Block a user