make sure that git repo info is only added if the musrfit project source is indeed a git repo, and not e.g. a download.

This commit is contained in:
2021-07-12 15:34:07 +02:00
parent edeff3563c
commit d3d55f8719
31 changed files with 279 additions and 70 deletions

View File

@@ -1,5 +1,12 @@
#--- musredit for Qt > 6.0 ----------------------------------------------------
#--- check if project source is repo ------------------------------------------
if (IS_GIT_REPO)
set(HAVE_GIT_REV_H "-DHAVE_GIT_REV_H")
else (IS_GIT_REPO)
set(HAVE_GIT_REV_H "")
endif (IS_GIT_REPO)
set(qt_libs Qt6::Core Qt6::Widgets Qt6::Network Qt6::Xml Qt6::Svg Qt6::PrintSupport)
set(musredit_src
@@ -115,6 +122,11 @@ target_include_directories(musredit
$<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/../../include>
)
target_compile_options(musredit
PRIVATE
"${HAVE_GIT_REV_H}"
)
target_link_libraries(musredit ${qt_libs})
#--- installation info --------------------------------------------------------

View File

@@ -28,7 +28,9 @@
***************************************************************************/
#include "config.h"
#ifdef HAVE_GIT_REV_H
#include "git-revision.h"
#endif
#include "PMusrEditAbout.h"
//---------------------------------------------------------------------------
@@ -39,8 +41,13 @@ PMusrEditAbout::PMusrEditAbout(QWidget *parent) : QDialog(parent)
{
setupUi(this);
#ifdef HAVE_GIT_REV_H
fGitBranch_label->setText(QString("git-branch: %1").arg(GIT_BRANCH));
fGitRev_label->setText(QString("git-rev: %1").arg(GIT_CURRENT_SHA1));
#else
fGitBranch_label->setText(QString("git-branch: unknown"));
fGitRev_label->setText(QString("git-rev: unknown"));
#endif
fMusrfitVersion_label->setText(QString("musrfit-version: %1 (%2)").arg(PACKAGE_VERSION).arg(BUILD_TYPE));
fRootVersion_label->setText(QString("ROOT-version: %1").arg(ROOT_VERSION_USED));

View File

@@ -31,7 +31,9 @@
#include <QApplication>
#ifdef HAVE_GIT_REV_H
#include "git-revision.h"
#endif
#include "PTextEdit.h"
#include "PFitOutputHandler.h"
@@ -52,7 +54,11 @@ int main( int argc, char ** argv )
std::cout << std::endl << std::endl;
return 0;
} else if (!strcmp(argv[1], "--version") || !strcmp(argv[1], "-v")) {
#ifdef HAVE_GIT_REV_H
std::cout << std::endl << "musredit git-branch: " << GIT_BRANCH << ", git-rev: " << GIT_CURRENT_SHA1;
#else
std::cout << std::endl << "musredit git-branch: unknown, git-rev: unknown.";
#endif
std::cout << std::endl << std::endl;
return 0;
}