mirror of
https://github.com/OPM/ResInsight.git
synced 2024-12-28 09:51:44 -06:00
Show git SHA for command line parameter --version
This commit is contained in:
parent
672fbe177b
commit
a0ecdf47a5
@ -48,7 +48,7 @@ RiaApplication* createApplication( int& argc, char* argv[] )
|
||||
{
|
||||
for ( int i = 1; i < argc; ++i )
|
||||
{
|
||||
if ( !qstrcmp( argv[i], "--console" ) || !qstrcmp( argv[i], "--unittest" ) || !qstrcmp( argv[i], "--version" ) )
|
||||
if ( !qstrcmp( argv[i], "--console" ) || !qstrcmp( argv[i], "--unittest" ) )
|
||||
{
|
||||
#ifdef ENABLE_GRPC
|
||||
return new RiaGrpcConsoleApplication( argc, argv );
|
||||
|
@ -34,3 +34,5 @@
|
||||
#define RESINSIGHT_OCTAVE_VERSION "@OCTAVE_VERSION_STRING@"
|
||||
|
||||
#define RESINSIGHT_PYTHON_VERSION "@Python3_VERSION@"
|
||||
|
||||
#define RESINSIGHT_GIT_HASH "@RESINSIGHT_GIT_HASH@"
|
@ -131,6 +131,7 @@ RiaApplication::ApplicationStatus RiaConsoleApplication::handleArguments( gsl::n
|
||||
if ( progOpt->option( "version" ) )
|
||||
{
|
||||
QString text = QString( STRPRODUCTVER ) + "\n";
|
||||
text += "SHA " + QString( RESINSIGHT_GIT_HASH ) + "\n";
|
||||
|
||||
showFormattedTextInMessageBoxOrConsole( text );
|
||||
|
||||
|
@ -463,6 +463,16 @@ RiaApplication::ApplicationStatus RiaGuiApplication::handleArguments( gsl::not_n
|
||||
return RiaApplication::ApplicationStatus::EXIT_COMPLETED;
|
||||
}
|
||||
|
||||
if ( progOpt->option( "version" ) )
|
||||
{
|
||||
QString text = QString( STRPRODUCTVER ) + "\n";
|
||||
text += "SHA " + QString( RESINSIGHT_GIT_HASH ) + "\n";
|
||||
|
||||
showFormattedTextInMessageBoxOrConsole( text );
|
||||
|
||||
return RiaApplication::ApplicationStatus::EXIT_COMPLETED;
|
||||
}
|
||||
|
||||
// Code generation
|
||||
// -----------------
|
||||
if ( cvf::Option o = progOpt->option( "generate" ) )
|
||||
|
@ -324,6 +324,12 @@ set(CMAKE_CXX_COMPILER_LAUNCHER ${TEMP_CMAKE_CXX_COMPILER_LAUNCHER})
|
||||
# ##############################################################################
|
||||
find_package(Git QUIET)
|
||||
if(GIT_FOUND AND EXISTS "${PROJECT_SOURCE_DIR}/.git")
|
||||
execute_process(
|
||||
COMMAND git log -1 --pretty=format:%h
|
||||
OUTPUT_VARIABLE RESINSIGHT_GIT_HASH
|
||||
OUTPUT_STRIP_TRAILING_WHITESPACE ERROR_QUIET
|
||||
)
|
||||
|
||||
# Update submodules as needed
|
||||
option(RESINSIGHT_UPDATE_SUBMODULES "Check submodules during build" ON)
|
||||
mark_as_advanced(RESINSIGHT_UPDATE_SUBMODULES)
|
||||
|
Loading…
Reference in New Issue
Block a user