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:
@@ -61,11 +61,19 @@ else (APPLE)
|
||||
add_executable(mupp ${GENERATED_HEADER_FILES} ${MUPP_SOURCE_FILES} qrc_mupp.cpp)
|
||||
endif (APPLE)
|
||||
|
||||
#--- 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)
|
||||
|
||||
#--- compiler option to workaround a little cast problem for some
|
||||
#--- boost/compiler combinations ----------------------------------------------
|
||||
target_compile_options(mupp
|
||||
PRIVATE
|
||||
"-fpermissive"
|
||||
"-fpermissive"
|
||||
"${HAVE_GIT_REV_H}"
|
||||
)
|
||||
|
||||
#--- add the variable related sources -----------------------------------------
|
||||
|
||||
@@ -58,6 +58,9 @@
|
||||
#include <QtDebug>
|
||||
|
||||
#include "mupp_version.h"
|
||||
#ifdef HAVE_GIT_REV_H
|
||||
#include "git-revision.h"
|
||||
#endif
|
||||
#include "PmuppGui.h"
|
||||
|
||||
//----------------------------------------------------------------------------------------------------
|
||||
@@ -779,7 +782,11 @@ void PmuppGui::helpCmds()
|
||||
*/
|
||||
void PmuppGui::helpAbout()
|
||||
{
|
||||
#ifdef HAVE_GIT_REV_H
|
||||
QMessageBox::information(this, "about", QString("mupp: created by Andreas Suter.\nVersion: %1\nBranch: %2\nHash: %3").arg(MUPP_VERSION).arg(GIT_BRANCH).arg(GIT_COMMIT_HASH));
|
||||
#else
|
||||
QMessageBox::information(this, "about", QString("mupp: created by Andreas Suter.\nVersion: %1").arg(MUPP_VERSION));
|
||||
#endif
|
||||
}
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
|
||||
@@ -6,22 +6,6 @@ set(BIN_DIR "@CMAKE_CURRENT_BINARY_DIR@")
|
||||
set(CMAKE_INSTALL_PREFIX "@CMAKE_INSTALL_PREFIX@")
|
||||
set(MUPP_VERSION "@mupp_VERSION@")
|
||||
|
||||
# Get the current working branch
|
||||
execute_process(
|
||||
COMMAND git rev-parse --abbrev-ref HEAD
|
||||
WORKING_DIRECTORY ${CMAKE_SOURCE_DIR}
|
||||
OUTPUT_VARIABLE GIT_BRANCH
|
||||
OUTPUT_STRIP_TRAILING_WHITESPACE
|
||||
)
|
||||
|
||||
# Get the latest abbreviated commit hash of the working branch
|
||||
execute_process(
|
||||
COMMAND git log -1 --pretty="%h, %ci"
|
||||
WORKING_DIRECTORY ${CMAKE_SOURCE_DIR}
|
||||
OUTPUT_VARIABLE GIT_COMMIT_HASH
|
||||
OUTPUT_STRIP_TRAILING_WHITESPACE
|
||||
)
|
||||
|
||||
configure_file(
|
||||
${SRC_DIR}/cmake/mupp_version.h.in
|
||||
${BIN_DIR}/mupp_version.h
|
||||
|
||||
@@ -4,8 +4,5 @@
|
||||
#define MUPP_PREFIX "@CMAKE_INSTALL_PREFIX@"
|
||||
#define MUPP_VERSION "@MUPP_VERSION@"
|
||||
|
||||
#define GIT_BRANCH "@GIT_BRANCH@"
|
||||
#define GIT_COMMIT_HASH @GIT_COMMIT_HASH@
|
||||
|
||||
#endif
|
||||
|
||||
|
||||
@@ -41,6 +41,9 @@
|
||||
#include <QTimer>
|
||||
|
||||
#include "mupp_version.h"
|
||||
#ifdef HAVE_GIT_REV_H
|
||||
#include "git-revision.h"
|
||||
#endif
|
||||
#include "PmuppScript.h"
|
||||
#include "PmuppGui.h"
|
||||
|
||||
@@ -525,7 +528,11 @@ int main(int argc, char *argv[])
|
||||
mupp_syntax();
|
||||
return 0;
|
||||
} else if (!qstrcmp(argv[1], "-v") || !qstrcmp(argv[1], "--version")) {
|
||||
#ifdef HAVE_GIT_REV_H
|
||||
std::cout << std::endl << "mupp version: " << MUPP_VERSION << ", git-branch: " << GIT_BRANCH << ", git-rev: " << GIT_COMMIT_HASH << std::endl << std::endl;
|
||||
#else
|
||||
std::cout << std::endl << "mupp version: " << MUPP_VERSION << std::endl << std::endl;
|
||||
#endif
|
||||
return 0;
|
||||
} else if (!qstrcmp(argv[1], "-s") || !qstrcmp(argv[1], "--script")) {
|
||||
if (argc != 3) {
|
||||
|
||||
@@ -1,5 +1,12 @@
|
||||
#--- musrWiz for Qt > 5.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 Qt5::Core Qt5::Widgets Qt5::Svg Qt5::Xml)
|
||||
|
||||
set(musrWiz_src
|
||||
@@ -51,6 +58,11 @@ target_include_directories(musrWiz
|
||||
$<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/../../include>
|
||||
)
|
||||
|
||||
target_compile_options(musrWiz
|
||||
PRIVATE
|
||||
"${HAVE_GIT_REV_H}"
|
||||
)
|
||||
|
||||
target_link_libraries(musrWiz ${qt_libs})
|
||||
|
||||
#--- installation info --------------------------------------------------------
|
||||
|
||||
@@ -1,5 +1,12 @@
|
||||
#--- musredit for Qt > 5.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 Qt5::Core Qt5::Widgets Qt5::Network Qt5::Xml Qt5::Svg Qt5::PrintSupport)
|
||||
|
||||
set(musredit_src
|
||||
@@ -116,6 +123,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 --------------------------------------------------------
|
||||
|
||||
@@ -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));
|
||||
|
||||
|
||||
@@ -31,7 +31,10 @@
|
||||
|
||||
#include <QApplication>
|
||||
|
||||
#ifdef HAVE_GIT_REV_H
|
||||
#include "git-revision.h"
|
||||
#endif
|
||||
|
||||
#include "PTextEdit.h"
|
||||
#include "PFitOutputHandler.h"
|
||||
|
||||
@@ -52,7 +55,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;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user