mirror of
https://github.com/OPM/ResInsight.git
synced 2025-02-09 23:16:00 -06:00
#1596 Move several files from Application to Application/Tools
This commit is contained in:
parent
b12143c0a8
commit
263015cdff
32
ApplicationCode/Application/CMakeLists_files.cmake
Normal file
32
ApplicationCode/Application/CMakeLists_files.cmake
Normal file
@ -0,0 +1,32 @@
|
||||
|
||||
# Use this workaround until we're on 2.8.3 on all platforms and can use CMAKE_CURRENT_LIST_DIR directly
|
||||
if (${CMAKE_VERSION} VERSION_GREATER "2.8.2")
|
||||
set(CEE_CURRENT_LIST_DIR ${CMAKE_CURRENT_LIST_DIR}/)
|
||||
endif()
|
||||
|
||||
set (SOURCE_GROUP_HEADER_FILES
|
||||
${CEE_CURRENT_LIST_DIR}RiaApplication.h
|
||||
${CEE_CURRENT_LIST_DIR}RiaPreferences.h
|
||||
)
|
||||
|
||||
set (SOURCE_GROUP_SOURCE_FILES
|
||||
${CEE_CURRENT_LIST_DIR}RiaApplication.cpp
|
||||
${CEE_CURRENT_LIST_DIR}RiaMain.cpp
|
||||
${CEE_CURRENT_LIST_DIR}RiaPreferences.cpp
|
||||
)
|
||||
|
||||
list(APPEND CODE_HEADER_FILES
|
||||
${SOURCE_GROUP_HEADER_FILES}
|
||||
)
|
||||
|
||||
list(APPEND CODE_SOURCE_FILES
|
||||
${SOURCE_GROUP_SOURCE_FILES}
|
||||
)
|
||||
|
||||
set (QT_MOC_HEADERS
|
||||
${QT_MOC_HEADERS}
|
||||
${CEE_CURRENT_LIST_DIR}RiaApplication.h
|
||||
)
|
||||
|
||||
|
||||
source_group( "Application" FILES ${SOURCE_GROUP_HEADER_FILES} ${SOURCE_GROUP_SOURCE_FILES} ${CEE_CURRENT_LIST_DIR}CMakeLists_files.cmake )
|
39
ApplicationCode/Application/Tools/CMakeLists_files.cmake
Normal file
39
ApplicationCode/Application/Tools/CMakeLists_files.cmake
Normal file
@ -0,0 +1,39 @@
|
||||
|
||||
# Use this workaround until we're on 2.8.3 on all platforms and can use CMAKE_CURRENT_LIST_DIR directly
|
||||
if (${CMAKE_VERSION} VERSION_GREATER "2.8.2")
|
||||
set(CEE_CURRENT_LIST_DIR ${CMAKE_CURRENT_LIST_DIR}/)
|
||||
endif()
|
||||
|
||||
|
||||
set (SOURCE_GROUP_HEADER_FILES
|
||||
${CEE_CURRENT_LIST_DIR}RiaColorTables.h
|
||||
${CEE_CURRENT_LIST_DIR}RiaImageCompareReporter.h
|
||||
${CEE_CURRENT_LIST_DIR}RiaImageFileCompare.h
|
||||
${CEE_CURRENT_LIST_DIR}RiaLogging.h
|
||||
${CEE_CURRENT_LIST_DIR}RiaProjectModifier.h
|
||||
${CEE_CURRENT_LIST_DIR}RiaRegressionTest.h
|
||||
)
|
||||
|
||||
set (SOURCE_GROUP_SOURCE_FILES
|
||||
${CEE_CURRENT_LIST_DIR}RiaColorTables.cpp
|
||||
${CEE_CURRENT_LIST_DIR}RiaImageCompareReporter.cpp
|
||||
${CEE_CURRENT_LIST_DIR}RiaImageFileCompare.cpp
|
||||
${CEE_CURRENT_LIST_DIR}RiaLogging.cpp
|
||||
${CEE_CURRENT_LIST_DIR}RiaProjectModifier.cpp
|
||||
${CEE_CURRENT_LIST_DIR}RiaRegressionTest.cpp
|
||||
)
|
||||
|
||||
list(APPEND CODE_HEADER_FILES
|
||||
${SOURCE_GROUP_HEADER_FILES}
|
||||
)
|
||||
|
||||
list(APPEND CODE_SOURCE_FILES
|
||||
${SOURCE_GROUP_SOURCE_FILES}
|
||||
)
|
||||
|
||||
set (QT_MOC_HEADERS
|
||||
${QT_MOC_HEADERS}
|
||||
)
|
||||
|
||||
|
||||
source_group( "Application\\Tools" FILES ${SOURCE_GROUP_HEADER_FILES} ${SOURCE_GROUP_SOURCE_FILES} ${CEE_CURRENT_LIST_DIR}CMakeLists_files.cmake )
|
@ -1,156 +1,156 @@
|
||||
/////////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// Copyright (C) 2011-2012 Statoil ASA, Ceetron AS
|
||||
//
|
||||
// ResInsight is free software: you can redistribute it and/or modify
|
||||
// it under the terms of the GNU General Public License as published by
|
||||
// the Free Software Foundation, either version 3 of the License, or
|
||||
// (at your option) any later version.
|
||||
//
|
||||
// ResInsight is distributed in the hope that it will be useful, but WITHOUT ANY
|
||||
// WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||
// FITNESS FOR A PARTICULAR PURPOSE.
|
||||
//
|
||||
// See the GNU General Public License at <http://www.gnu.org/licenses/gpl.html>
|
||||
// for more details.
|
||||
//
|
||||
/////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
#include "RiaImageFileCompare.h"
|
||||
#include <QtCore/QProcess>
|
||||
|
||||
|
||||
//==================================================================================================
|
||||
//
|
||||
//
|
||||
//
|
||||
//==================================================================================================
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
RiaImageFileCompare::RiaImageFileCompare(QString compareExecutable)
|
||||
: m_compareExecutable(compareExecutable)
|
||||
{
|
||||
reset();
|
||||
}
|
||||
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
RiaImageFileCompare::~RiaImageFileCompare()
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RiaImageFileCompare::reset()
|
||||
{
|
||||
m_imagesEqual = false;
|
||||
m_lastError = IC_NO_ERROR;
|
||||
m_errorMsg = "";
|
||||
m_errorDetails = "";
|
||||
}
|
||||
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
bool RiaImageFileCompare::runComparison(QString imgFileName, QString refFileName, QString diffFileName)
|
||||
{
|
||||
reset();
|
||||
|
||||
if (m_compareExecutable.isEmpty())
|
||||
{
|
||||
m_lastError = SEVERE_ERROR;
|
||||
m_errorMsg = "Cannot compare images, no compare executable set";
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
//QString args = QString("-fuzz 2% -lowlight-color white -metric ae \"%1\" \"%2\" \"%3\"").arg(imgFileName).arg(refFileName).arg((diffFileName));
|
||||
// The ImageMagick compare tool on RedHat 5 does not support the lowlight-color options
|
||||
// Use GCC version as a crude mechanism for disabling use of this option on RedHat5
|
||||
#if (__GNUC__ == 4 && __GNUC_MINOR__ <= 1)
|
||||
QString args = QString("-fuzz 0.4% -metric ae \"%1\" \"%2\" \"%3\"").arg(imgFileName).arg(refFileName).arg((diffFileName));
|
||||
#else
|
||||
QString args = QString("-fuzz 0.4% -lowlight-color white -metric ae \"%1\" \"%2\" \"%3\"").arg(imgFileName).arg(refFileName).arg((diffFileName));
|
||||
#endif
|
||||
QString completeCommand = QString("\"%1\" %2").arg(m_compareExecutable).arg(args);
|
||||
|
||||
// Launch process and wait
|
||||
QProcess proc;
|
||||
proc.start(completeCommand);
|
||||
proc.waitForFinished(30000);
|
||||
|
||||
QProcess::ProcessError procError = proc.error();
|
||||
if (procError != QProcess::UnknownError)
|
||||
{
|
||||
m_lastError = SEVERE_ERROR;
|
||||
m_errorMsg = "Error running compare tool process";
|
||||
m_errorDetails = completeCommand;
|
||||
return false;
|
||||
}
|
||||
|
||||
QByteArray stdErr = proc.readAllStandardError();
|
||||
int procExitCode = proc.exitCode();
|
||||
if (procExitCode == 0)
|
||||
{
|
||||
// Strip out whitespace and look for 0 (as in zero pixel differences)
|
||||
stdErr = stdErr.simplified();
|
||||
if (!stdErr.isEmpty() && stdErr[0] == '0')
|
||||
{
|
||||
m_imagesEqual = true;
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
else
|
||||
{
|
||||
// Report non-severe error
|
||||
m_lastError = IC_ERROR;
|
||||
m_errorMsg = "Error running compare tool process";
|
||||
m_errorDetails = stdErr;
|
||||
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
bool RiaImageFileCompare::imagesEqual() const
|
||||
{
|
||||
return m_imagesEqual;
|
||||
}
|
||||
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
RiaImageFileCompare::ErrorType RiaImageFileCompare::error() const
|
||||
{
|
||||
return m_lastError;
|
||||
}
|
||||
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
QString RiaImageFileCompare::errorMessage() const
|
||||
{
|
||||
return m_errorMsg;
|
||||
}
|
||||
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
QString RiaImageFileCompare::errorDetails() const
|
||||
{
|
||||
return m_errorDetails;
|
||||
}
|
||||
/////////////////////////////////////////////////////////////////////////////////
|
||||
//
|
||||
// Copyright (C) 2011-2012 Statoil ASA, Ceetron AS
|
||||
//
|
||||
// ResInsight is free software: you can redistribute it and/or modify
|
||||
// it under the terms of the GNU General Public License as published by
|
||||
// the Free Software Foundation, either version 3 of the License, or
|
||||
// (at your option) any later version.
|
||||
//
|
||||
// ResInsight is distributed in the hope that it will be useful, but WITHOUT ANY
|
||||
// WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||
// FITNESS FOR A PARTICULAR PURPOSE.
|
||||
//
|
||||
// See the GNU General Public License at <http://www.gnu.org/licenses/gpl.html>
|
||||
// for more details.
|
||||
//
|
||||
/////////////////////////////////////////////////////////////////////////////////
|
||||
|
||||
#include "RiaImageFileCompare.h"
|
||||
#include <QtCore/QProcess>
|
||||
|
||||
|
||||
//==================================================================================================
|
||||
//
|
||||
//
|
||||
//
|
||||
//==================================================================================================
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
RiaImageFileCompare::RiaImageFileCompare(QString compareExecutable)
|
||||
: m_compareExecutable(compareExecutable)
|
||||
{
|
||||
reset();
|
||||
}
|
||||
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
RiaImageFileCompare::~RiaImageFileCompare()
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
void RiaImageFileCompare::reset()
|
||||
{
|
||||
m_imagesEqual = false;
|
||||
m_lastError = IC_NO_ERROR;
|
||||
m_errorMsg = "";
|
||||
m_errorDetails = "";
|
||||
}
|
||||
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
bool RiaImageFileCompare::runComparison(QString imgFileName, QString refFileName, QString diffFileName)
|
||||
{
|
||||
reset();
|
||||
|
||||
if (m_compareExecutable.isEmpty())
|
||||
{
|
||||
m_lastError = SEVERE_ERROR;
|
||||
m_errorMsg = "Cannot compare images, no compare executable set";
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
//QString args = QString("-fuzz 2% -lowlight-color white -metric ae \"%1\" \"%2\" \"%3\"").arg(imgFileName).arg(refFileName).arg((diffFileName));
|
||||
// The ImageMagick compare tool on RedHat 5 does not support the lowlight-color options
|
||||
// Use GCC version as a crude mechanism for disabling use of this option on RedHat5
|
||||
#if (__GNUC__ == 4 && __GNUC_MINOR__ <= 1)
|
||||
QString args = QString("-fuzz 0.4% -metric ae \"%1\" \"%2\" \"%3\"").arg(imgFileName).arg(refFileName).arg((diffFileName));
|
||||
#else
|
||||
QString args = QString("-fuzz 0.4% -lowlight-color white -metric ae \"%1\" \"%2\" \"%3\"").arg(imgFileName).arg(refFileName).arg((diffFileName));
|
||||
#endif
|
||||
QString completeCommand = QString("\"%1\" %2").arg(m_compareExecutable).arg(args);
|
||||
|
||||
// Launch process and wait
|
||||
QProcess proc;
|
||||
proc.start(completeCommand);
|
||||
proc.waitForFinished(30000);
|
||||
|
||||
QProcess::ProcessError procError = proc.error();
|
||||
if (procError != QProcess::UnknownError)
|
||||
{
|
||||
m_lastError = SEVERE_ERROR;
|
||||
m_errorMsg = "Error running compare tool process";
|
||||
m_errorDetails = completeCommand;
|
||||
return false;
|
||||
}
|
||||
|
||||
QByteArray stdErr = proc.readAllStandardError();
|
||||
int procExitCode = proc.exitCode();
|
||||
if (procExitCode == 0)
|
||||
{
|
||||
// Strip out whitespace and look for 0 (as in zero pixel differences)
|
||||
stdErr = stdErr.simplified();
|
||||
if (!stdErr.isEmpty() && stdErr[0] == '0')
|
||||
{
|
||||
m_imagesEqual = true;
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
else
|
||||
{
|
||||
// Report non-severe error
|
||||
m_lastError = IC_ERROR;
|
||||
m_errorMsg = "Error running compare tool process";
|
||||
m_errorDetails = stdErr;
|
||||
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
bool RiaImageFileCompare::imagesEqual() const
|
||||
{
|
||||
return m_imagesEqual;
|
||||
}
|
||||
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
RiaImageFileCompare::ErrorType RiaImageFileCompare::error() const
|
||||
{
|
||||
return m_lastError;
|
||||
}
|
||||
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
QString RiaImageFileCompare::errorMessage() const
|
||||
{
|
||||
return m_errorMsg;
|
||||
}
|
||||
|
||||
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
///
|
||||
//--------------------------------------------------------------------------------------------------
|
||||
QString RiaImageFileCompare::errorDetails() const
|
||||
{
|
||||
return m_errorDetails;
|
||||
}
|
@ -37,6 +37,7 @@ include_directories(
|
||||
${CMAKE_CURRENT_SOURCE_DIR}
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/Adm
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/Application
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/Application/Tools
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/Commands
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/Commands/EclipseCommands
|
||||
${CMAKE_CURRENT_SOURCE_DIR}/FileInterface
|
||||
@ -69,20 +70,6 @@ include_directories(
|
||||
# Use all h files in the subdirectories to make them available in the project
|
||||
file( GLOB_RECURSE HEADER_FILES *.h )
|
||||
|
||||
set( APPLICATION_FILES
|
||||
RiaMain.cpp
|
||||
|
||||
Application/RiaApplication.cpp
|
||||
Application/RiaPreferences.cpp
|
||||
Application/RiaImageFileCompare.cpp
|
||||
Application/RiaImageCompareReporter.cpp
|
||||
Application/RiaProjectModifier.cpp
|
||||
Application/RiaRegressionTest.cpp
|
||||
Application/RiaColorTables.cpp
|
||||
Application/RiaLogging.h
|
||||
Application/RiaLogging.cpp
|
||||
)
|
||||
|
||||
set( SOCKET_INTERFACE_FILES
|
||||
SocketInterface/RiaSocketServer.cpp
|
||||
SocketInterface/RiaProjectInfoCommands.cpp
|
||||
@ -95,12 +82,14 @@ set( SOCKET_INTERFACE_FILES
|
||||
)
|
||||
|
||||
list( APPEND CPP_SOURCES
|
||||
${APPLICATION_FILES}
|
||||
${SOCKET_INTERFACE_FILES}
|
||||
${UNIT_TEST_FILES}
|
||||
)
|
||||
|
||||
list( APPEND REFERENCED_CMAKE_FILES
|
||||
Application/CMakeLists_files.cmake
|
||||
Application/Tools/CMakeLists_files.cmake
|
||||
|
||||
ReservoirDataModel/CMakeLists_files.cmake
|
||||
ReservoirDataModel/CMakeLists_filesNotToUnitTest.cmake
|
||||
FileInterface/CMakeLists_files.cmake
|
||||
@ -185,7 +174,6 @@ add_subdirectory(GeoMech/GeoMechDataModel)
|
||||
|
||||
set ( QT_MOC_HEADERS
|
||||
${QT_MOC_HEADERS}
|
||||
Application/RiaApplication.h
|
||||
|
||||
ProjectDataModel/RimMimeData.h
|
||||
ProjectDataModel/RimIntersectionBox.h
|
||||
@ -221,7 +209,6 @@ endif()
|
||||
################################################################################
|
||||
# Create source groups - see also included CMakeLists_files.cmake
|
||||
################################################################################
|
||||
source_group( "Application" FILES ${APPLICATION_FILES} )
|
||||
source_group( "ModelVisualization" FILES ${MODEL_VISUALIZATION_FILES} )
|
||||
source_group( "SocketInterface" FILES ${SOCKET_INTERFACE_FILES} )
|
||||
source_group( "UnitTests" FILES ${UNIT_TEST_FILES} )
|
||||
|
Loading…
Reference in New Issue
Block a user