mirror of
https://github.com/OPM/ResInsight.git
synced 2025-02-25 18:55:39 -06:00
Now handling compilation both with and without ODB api
This commit is contained in:
parent
936d6553cf
commit
a7e38bcda1
@ -28,6 +28,9 @@ include_directories(
|
|||||||
${CMAKE_CURRENT_BINARY_DIR}
|
${CMAKE_CURRENT_BINARY_DIR}
|
||||||
)
|
)
|
||||||
|
|
||||||
|
#############################################################################
|
||||||
|
# Defining all the source (and header) files
|
||||||
|
#############################################################################
|
||||||
|
|
||||||
# Use all h files in the subdirectories to make them available in the project
|
# Use all h files in the subdirectories to make them available in the project
|
||||||
file( GLOB_RECURSE HEADER_FILES *.h )
|
file( GLOB_RECURSE HEADER_FILES *.h )
|
||||||
@ -92,15 +95,28 @@ list( APPEND CPP_SOURCES
|
|||||||
${CODE_SOURCE_FILES}
|
${CODE_SOURCE_FILES}
|
||||||
)
|
)
|
||||||
|
|
||||||
|
#############################################################################
|
||||||
|
# Sub-directory projects
|
||||||
|
#############################################################################
|
||||||
|
|
||||||
add_subdirectory(WellPathImportSsihub)
|
add_subdirectory(WellPathImportSsihub)
|
||||||
|
|
||||||
add_subdirectory(GeoMech/GeoMechDataModel)
|
add_subdirectory(GeoMech/GeoMechDataModel)
|
||||||
set(RESINSIGHT_ODB_API_DIR "" CACHE PATH "Path tho the ODB api from Simulia")
|
|
||||||
|
|
||||||
add_subdirectory(GeoMech/OdbReader)
|
#
|
||||||
|
# Odb api
|
||||||
|
#
|
||||||
|
set(RESINSIGHT_ODB_API_DIR "" CACHE PATH "Path to the ODB api from Simulia")
|
||||||
|
if(NOT ${RESINSIGHT_ODB_API_DIR} EQUAL "")
|
||||||
|
add_definitions(-DUSE_ODB_API)
|
||||||
|
add_subdirectory(GeoMech/OdbReader)
|
||||||
|
SET(RESINSIGHT_USE_ODB_API 1)
|
||||||
|
endif()
|
||||||
|
|
||||||
|
#############################################################################
|
||||||
|
# Qt specifics: Moc, ui, resources
|
||||||
|
#############################################################################
|
||||||
|
|
||||||
# Define files for MOC-ing
|
|
||||||
set ( QT_MOC_HEADERS
|
set ( QT_MOC_HEADERS
|
||||||
Application/RiaApplication.h
|
Application/RiaApplication.h
|
||||||
|
|
||||||
@ -209,6 +225,10 @@ source_group( "UserInterface" FILES ${USER_INTERFACE_FILES} )
|
|||||||
source_group( "SocketInterface" FILES ${SOCKET_INTERFACE_FILES} )
|
source_group( "SocketInterface" FILES ${SOCKET_INTERFACE_FILES} )
|
||||||
|
|
||||||
|
|
||||||
|
#############################################################################
|
||||||
|
# Set up the main executable with its source files
|
||||||
|
#############################################################################
|
||||||
|
|
||||||
# Default behaviour for a Qt application is a console application, resulting in a console window always being launced at startup
|
# Default behaviour for a Qt application is a console application, resulting in a console window always being launced at startup
|
||||||
# The following statement is used to control this behaviour
|
# The following statement is used to control this behaviour
|
||||||
# set_target_properties( MY_TARGET PROPERTIES LINK_FLAGS_DEBUG "/SUBSYSTEM:WINDOWS")
|
# set_target_properties( MY_TARGET PROPERTIES LINK_FLAGS_DEBUG "/SUBSYSTEM:WINDOWS")
|
||||||
@ -236,7 +256,11 @@ set( EXE_FILES
|
|||||||
|
|
||||||
add_executable( ResInsight ${EXE_FILES} )
|
add_executable( ResInsight ${EXE_FILES} )
|
||||||
|
|
||||||
|
|
||||||
|
#############################################################################
|
||||||
# Application icon for MacOS X bundle
|
# Application icon for MacOS X bundle
|
||||||
|
#############################################################################
|
||||||
|
|
||||||
if (APPLE)
|
if (APPLE)
|
||||||
add_custom_command (OUTPUT Resources/ResInsight.icns
|
add_custom_command (OUTPUT Resources/ResInsight.icns
|
||||||
COMMAND sips -s format icns ${CMAKE_CURRENT_SOURCE_DIR}/Resources/AppLogo48x48.png --out ${CMAKE_CURRENT_BINARY_DIR}/Resources/ResInsight.icns
|
COMMAND sips -s format icns ${CMAKE_CURRENT_SOURCE_DIR}/Resources/AppLogo48x48.png --out ${CMAKE_CURRENT_BINARY_DIR}/Resources/ResInsight.icns
|
||||||
@ -249,6 +273,10 @@ if (APPLE)
|
|||||||
MACOSX_BUNDLE_ICON_FILE ${CMAKE_CURRENT_BINARY_DIR}/Resources/ResInsight.icns)
|
MACOSX_BUNDLE_ICON_FILE ${CMAKE_CURRENT_BINARY_DIR}/Resources/ResInsight.icns)
|
||||||
endif ()
|
endif ()
|
||||||
|
|
||||||
|
#############################################################################
|
||||||
|
# Set up libraries and dependent projects to link with
|
||||||
|
#############################################################################
|
||||||
|
|
||||||
set( LINK_LIBRARIES
|
set( LINK_LIBRARIES
|
||||||
WellPathImportSsihub
|
WellPathImportSsihub
|
||||||
|
|
||||||
@ -265,7 +293,6 @@ set( LINK_LIBRARIES
|
|||||||
LibCore
|
LibCore
|
||||||
|
|
||||||
RigGeoMechDataModel
|
RigGeoMechDataModel
|
||||||
RifOdbReader
|
|
||||||
|
|
||||||
ecl
|
ecl
|
||||||
ert_util
|
ert_util
|
||||||
@ -285,13 +312,20 @@ if (${CMAKE_SYSTEM_NAME} MATCHES "Linux")
|
|||||||
)
|
)
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
|
# Add the odb reader if we are compiling with odb support
|
||||||
|
IF (${RESINSIGHT_USE_ODB_API})
|
||||||
|
set ( LINK_LIBRARIES ${LINK_LIBRARIES} RifOdbReader)
|
||||||
|
ENDIF()
|
||||||
|
|
||||||
target_link_libraries( ResInsight ${LINK_LIBRARIES} ${EXTERNAL_LINK_LIBRARIES})
|
target_link_libraries( ResInsight ${LINK_LIBRARIES} ${EXTERNAL_LINK_LIBRARIES})
|
||||||
|
|
||||||
|
#############################################################################
|
||||||
|
# Copy Dlls on MSVC
|
||||||
|
#############################################################################
|
||||||
|
|
||||||
# Copy Dlls
|
|
||||||
# Copy Odb Dlls
|
# Copy Odb Dlls
|
||||||
|
|
||||||
if (MSVC)
|
if ((MSVC) AND (${RESINSIGHT_USE_ODB_API}))
|
||||||
# Find all the dlls
|
# Find all the dlls
|
||||||
file (GLOB RI_ALL_ODB_DLLS ${RESINSIGHT_ODB_API_DIR}/lib/*.dll)
|
file (GLOB RI_ALL_ODB_DLLS ${RESINSIGHT_ODB_API_DIR}/lib/*.dll)
|
||||||
|
|
||||||
@ -309,12 +343,12 @@ if (MSVC)
|
|||||||
"${CMAKE_CURRENT_BINARY_DIR}/$<CONFIGURATION>")
|
"${CMAKE_CURRENT_BINARY_DIR}/$<CONFIGURATION>")
|
||||||
endforeach()
|
endforeach()
|
||||||
|
|
||||||
endif(MSVC)
|
endif()
|
||||||
|
|
||||||
|
# Qt DLLs
|
||||||
|
|
||||||
if (MSVC)
|
if (MSVC)
|
||||||
|
|
||||||
# Qt DLLs
|
|
||||||
set (QTLIBLIST QtCore QtCored QtGui QtGuid QtOpenGl QtOpenGld QtNetwork QtNetworkd QtScript QtScriptd QtScriptTools QtScriptToolsd)
|
set (QTLIBLIST QtCore QtCored QtGui QtGuid QtOpenGl QtOpenGld QtNetwork QtNetworkd QtScript QtScriptd QtScriptTools QtScriptToolsd)
|
||||||
foreach (qtlib ${QTLIBLIST})
|
foreach (qtlib ${QTLIBLIST})
|
||||||
add_custom_command(TARGET ResInsight POST_BUILD
|
add_custom_command(TARGET ResInsight POST_BUILD
|
||||||
|
@ -87,18 +87,21 @@ bool RimGeoMechCase::openGeoMechCase()
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
RiaPreferences* prefs = RiaApplication::instance()->preferences();
|
|
||||||
|
#ifdef USE_ODB_API
|
||||||
readerInterface = new RifOdbReader;
|
readerInterface = new RifOdbReader;
|
||||||
|
|
||||||
m_geoMechCaseData = new RigGeoMechCaseData;
|
m_geoMechCaseData = new RigGeoMechCaseData;
|
||||||
if (!readerInterface->readFemParts(m_caseFileName().toStdString(), m_geoMechCaseData->femParts()))
|
if (readerInterface->readFemParts(m_caseFileName().toStdString(), m_geoMechCaseData->femParts()))
|
||||||
{
|
{
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
// Todo: Default Results stuff, if needed
|
// Todo: Default Results stuff, if needed
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
|
return false;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -229,6 +229,14 @@ void RimGeoMechView::loadDataAndUpdate()
|
|||||||
void RimGeoMechView::createDisplayModelAndRedraw()
|
void RimGeoMechView::createDisplayModelAndRedraw()
|
||||||
{
|
{
|
||||||
if (m_viewer && m_geomechCase)
|
if (m_viewer && m_geomechCase)
|
||||||
|
{
|
||||||
|
int partCount = 0;
|
||||||
|
if (m_geomechCase->geoMechData() && m_geomechCase->geoMechData()->femParts())
|
||||||
|
{
|
||||||
|
partCount = m_geomechCase->geoMechData()->femParts()->partCount();
|
||||||
|
}
|
||||||
|
|
||||||
|
if (partCount >= 0)
|
||||||
{
|
{
|
||||||
cvf::ref<cvf::Transform> scaleTransform = new cvf::Transform();
|
cvf::ref<cvf::Transform> scaleTransform = new cvf::Transform();
|
||||||
scaleTransform->setLocalTransform(cvf::Mat4d::IDENTITY);
|
scaleTransform->setLocalTransform(cvf::Mat4d::IDENTITY);
|
||||||
@ -236,13 +244,15 @@ void RimGeoMechView::createDisplayModelAndRedraw()
|
|||||||
cvf::ref<cvf::ModelBasicList> cvfModel = new cvf::ModelBasicList;
|
cvf::ref<cvf::ModelBasicList> cvfModel = new cvf::ModelBasicList;
|
||||||
m_geoMechVizModel = new RivGeoMechPartMgr();
|
m_geoMechVizModel = new RivGeoMechPartMgr();
|
||||||
m_geoMechVizModel->clearAndSetReservoir(m_geomechCase->geoMechData(), this);
|
m_geoMechVizModel->clearAndSetReservoir(m_geomechCase->geoMechData(), this);
|
||||||
for (int femPartIdx = 0; femPartIdx < m_geomechCase->geoMechData()->femParts()->partCount(); ++femPartIdx)
|
|
||||||
|
for (int femPartIdx = 0; femPartIdx < partCount; ++femPartIdx)
|
||||||
{
|
{
|
||||||
cvf::ref<cvf::UByteArray> elmVisibility = m_geoMechVizModel->cellVisibility(femPartIdx);
|
cvf::ref<cvf::UByteArray> elmVisibility = m_geoMechVizModel->cellVisibility(femPartIdx);
|
||||||
m_geoMechVizModel->setTransform(scaleTransform.p());
|
m_geoMechVizModel->setTransform(scaleTransform.p());
|
||||||
RivElmVisibilityCalculator::computeAllVisible(elmVisibility.p(), m_geomechCase->geoMechData()->femParts()->part(femPartIdx));
|
RivElmVisibilityCalculator::computeAllVisible(elmVisibility.p(), m_geomechCase->geoMechData()->femParts()->part(femPartIdx));
|
||||||
m_geoMechVizModel->setCellVisibility(femPartIdx, elmVisibility.p());
|
m_geoMechVizModel->setCellVisibility(femPartIdx, elmVisibility.p());
|
||||||
}
|
}
|
||||||
|
|
||||||
m_geoMechVizModel->appendGridPartsToModel(cvfModel.p());
|
m_geoMechVizModel->appendGridPartsToModel(cvfModel.p());
|
||||||
|
|
||||||
cvf::ref<cvf::Scene> scene = new cvf::Scene;
|
cvf::ref<cvf::Scene> scene = new cvf::Scene;
|
||||||
@ -252,6 +262,8 @@ void RimGeoMechView::createDisplayModelAndRedraw()
|
|||||||
m_viewer->setMainScene(scene.p());
|
m_viewer->setMainScene(scene.p());
|
||||||
m_viewer->zoomAll();
|
m_viewer->zoomAll();
|
||||||
m_viewer->update();
|
m_viewer->update();
|
||||||
|
|
||||||
|
}
|
||||||
}
|
}
|
||||||
RiuMainWindow::instance()->refreshAnimationActions();
|
RiuMainWindow::instance()->refreshAnimationActions();
|
||||||
}
|
}
|
||||||
|
@ -386,8 +386,10 @@ void RiuMainWindow::createMenus()
|
|||||||
importMenu->addAction(m_importInputEclipseFileAction);
|
importMenu->addAction(m_importInputEclipseFileAction);
|
||||||
importMenu->addAction(m_openMultipleEclipseCasesAction);
|
importMenu->addAction(m_openMultipleEclipseCasesAction);
|
||||||
importMenu->addSeparator();
|
importMenu->addSeparator();
|
||||||
|
#ifdef USE_ODB_API
|
||||||
importMenu->addAction(m_importGeoMechCaseAction);
|
importMenu->addAction(m_importGeoMechCaseAction);
|
||||||
importMenu->addSeparator();
|
importMenu->addSeparator();
|
||||||
|
#endif
|
||||||
importMenu->addAction(m_importWellPathsFromFileAction);
|
importMenu->addAction(m_importWellPathsFromFileAction);
|
||||||
importMenu->addAction(m_importWellPathsFromSSIHubAction);
|
importMenu->addAction(m_importWellPathsFromSSIHubAction);
|
||||||
|
|
||||||
@ -1045,6 +1047,10 @@ void RiuMainWindow::slotOpenRecentFile()
|
|||||||
{
|
{
|
||||||
loadingSucceded = RiaApplication::instance()->openEclipseCaseFromFile(filename);
|
loadingSucceded = RiaApplication::instance()->openEclipseCaseFromFile(filename);
|
||||||
}
|
}
|
||||||
|
else if (filename.contains(".odb", Qt::CaseInsensitive) )
|
||||||
|
{
|
||||||
|
loadingSucceded = RiaApplication::instance()->openOdbCaseFromFile(filename);
|
||||||
|
}
|
||||||
|
|
||||||
if (loadingSucceded)
|
if (loadingSucceded)
|
||||||
{
|
{
|
||||||
@ -2049,7 +2055,9 @@ void RiuMainWindow::appendActionsContextMenuForPdmObject(caf::PdmObject* pdmObje
|
|||||||
}
|
}
|
||||||
else if (dynamic_cast<RimGeoMechModels*>(pdmObject))
|
else if (dynamic_cast<RimGeoMechModels*>(pdmObject))
|
||||||
{
|
{
|
||||||
|
#ifdef USE_ODB_API
|
||||||
menu->addAction(m_importGeoMechCaseAction);
|
menu->addAction(m_importGeoMechCaseAction);
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user