From 8ee487fe3f2eb21ec3f24a652debf60b2c0d2393 Mon Sep 17 00:00:00 2001 From: ana Date: Thu, 28 Jul 2016 17:45:59 +0300 Subject: [PATCH] Fix for the "23284: EDF 13077 GEOM: Build GEOM without GUI and without VTK" issue. --- CMakeLists.txt | 24 +++++++++++++++++++----- SalomeGEOMConfig.cmake.in | 6 +++++- doc/salome/gui/GEOM/CMakeLists.txt | 5 ++++- idl/CMakeLists.txt | 6 ++++-- resources/CMakeLists.txt | 8 +++++++- src/CMakeLists.txt | 15 +++++++++++++-- src/GEOM_I_Superv/CMakeLists.txt | 5 ++++- src/GEOM_I_Superv/GEOM_Superv_i.cc | 9 +++++++++ src/GEOM_I_Superv/GEOM_Superv_i.hh | 7 ++++++- src/GEOM_SWIG/CMakeLists.txt | 4 +++- 10 files changed, 74 insertions(+), 15 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index cf0c94e68..ad0bb3c78 100755 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -70,7 +70,9 @@ OPTION(SALOME_BUILD_TESTS "Build SALOME tests" ON) OPTION(SALOME_BUILD_GUI "Enable GUI" ON) CMAKE_DEPENDENT_OPTION(SALOME_GEOM_USE_OPENCV "Enable shape recognition from picture" OFF "SALOME_BUILD_GUI" OFF) -MARK_AS_ADVANCED(SALOME_BUILD_GUI SALOME_GEOM_USE_OPENCV) +CMAKE_DEPENDENT_OPTION(SALOME_GEOM_USE_VTK "Enable VTK-dependent functionality" ON + "NOT SALOME_BUILD_GUI" ON) +MARK_AS_ADVANCED(SALOME_BUILD_GUI SALOME_GEOM_USE_OPENCV SALOME_GEOM_USE_VTK) # Prerequisites # ============= @@ -146,7 +148,11 @@ ENDIF(SALOME_BUILD_GUI) ## FIND_PACKAGE(SalomeCAS REQUIRED) -FIND_PACKAGE(SalomeVTK REQUIRED) + +IF(SALOME_GEOM_USE_VTK) + FIND_PACKAGE(SalomeVTK REQUIRED) + ADD_DEFINITIONS(-DWITH_VTK) +ENDIF(SALOME_GEOM_USE_VTK) # OpenCV IF(SALOME_GEOM_USE_OPENCV) @@ -231,9 +237,9 @@ INCLUDE(CMakePackageConfigHelpers) SET(_${PROJECT_NAME}_exposed_targets GEOMArchimede BlockFix GEOMbasic GEOMAlgo GEOMClient GEOMImpl GEOMUtils GEOMEngine GEOM_SupervEngine GEOMSketcher - SalomeIDLGEOM SalomeIDLGEOMSuperv SalomeIDLAdvancedGEOM ShHealOper XAO AdvancedEngine OCC2VTK - SalomeIDLSTLPlugin SalomeIDLBREPPlugin SalomeIDLSTEPPlugin SalomeIDLIGESPlugin SalomeIDLXAOPlugin SalomeIDLVTKPlugin - STLPluginEngine BREPPluginEngine STEPPluginEngine IGESPluginEngine XAOPluginEngine VTKPluginEngine + SalomeIDLGEOM SalomeIDLGEOMSuperv SalomeIDLAdvancedGEOM ShHealOper XAO AdvancedEngine + SalomeIDLSTLPlugin SalomeIDLBREPPlugin SalomeIDLSTEPPlugin SalomeIDLIGESPlugin SalomeIDLXAOPlugin + STLPluginEngine BREPPluginEngine STEPPluginEngine IGESPluginEngine XAOPluginEngine ) IF(SALOME_BUILD_GUI) LIST(APPEND _${PROJECT_NAME}_exposed_targets @@ -247,6 +253,14 @@ IF(SALOME_BUILD_GUI) ENDIF(SALOME_USE_GRAPHICSVIEW) ENDIF(SALOME_BUILD_GUI) +IF(SALOME_GEOM_USE_VTK) + LIST(APPEND _${PROJECT_NAME}_exposed_targets + OCC2VTK + VTKPluginEngine + SalomeIDLVTKPlugin + ) +ENDIF(SALOME_GEOM_USE_VTK) + IF(SALOME_GEOM_USE_OPENCV) LIST(APPEND _${PROJECT_NAME}_exposed_targets GEOMShapeRec diff --git a/SalomeGEOMConfig.cmake.in b/SalomeGEOMConfig.cmake.in index 72c770337..701655953 100644 --- a/SalomeGEOMConfig.cmake.in +++ b/SalomeGEOMConfig.cmake.in @@ -53,11 +53,11 @@ SET(SALOME_GEOM_BUILD_TESTS @SALOME_BUILD_TESTS@) # Advanced options SET(SALOME_GEOM_BUILD_GUI @SALOME_BUILD_GUI@) SET(SALOME_GEOM_USE_OPENCV @SALOME_GEOM_USE_OPENCV@) +SET(SALOME_GEOM_USE_VTK @SALOME_GEOM_USE_VTK@) # Level 1 prerequisites: SET_AND_CHECK(KERNEL_ROOT_DIR_EXP "@PACKAGE_KERNEL_ROOT_DIR@") SET_AND_CHECK(CAS_ROOT_DIR_EXP "@PACKAGE_CAS_ROOT_DIR@") -SET_AND_CHECK(VTK_ROOT_DIR_EXP "@PACKAGE_VTK_ROOT_DIR@") # Optional level 1 prerequisites: IF(SALOME_GEOM_BUILD_GUI) @@ -68,6 +68,10 @@ IF(SALOME_GEOM_USE_OPENCV) SET_AND_CHECK(OPENCV_ROOT_DIR_EXP "@PACKAGE_OPENCV_ROOT_DIR@") LIST(APPEND GEOM_DEFINITIONS "-DWITH_OPENCV") ENDIF() +IF(SALOME_GEOM_USE_VTK) + SET_AND_CHECK(VTK_ROOT_DIR_EXP "@PACKAGE_VTK_ROOT_DIR@") + LIST(APPEND GEOM_DEFINITIONS "-DWITH_VTK") +ENDIF() # For all prerequisites, load the corresponding targets if the package was used # in CONFIG mode. This ensures dependent projects link correctly diff --git a/doc/salome/gui/GEOM/CMakeLists.txt b/doc/salome/gui/GEOM/CMakeLists.txt index a0defdbfd..b30c3ca01 100644 --- a/doc/salome/gui/GEOM/CMakeLists.txt +++ b/doc/salome/gui/GEOM/CMakeLists.txt @@ -27,7 +27,10 @@ SALOME_CONFIGURE_FILE(static/header_py.html.in ${CMAKE_CURRENT_BINARY_DIR}/stati # Generate a temporary python file, needed for the genaration of the documentation # of the built-in Geometry plugins. -SET(DOC_GEOM_PluginsList AdvancedGEOM STLPlugin BREPPlugin STEPPlugin IGESPlugin XAOPlugin VTKPlugin) +SET(DOC_GEOM_PluginsList AdvancedGEOM STLPlugin BREPPlugin STEPPlugin IGESPlugin XAOPlugin) +IF(SALOME_GEOM_USE_VTK) + SET(DOC_GEOM_PluginsList ${DOC_GEOM_PluginsList} VTKPlugin) +ENDIF() SALOME_ACCUMULATE_ENVIRONMENT(GEOM_PluginsList NOCHECK ${DOC_GEOM_PluginsList}) SET(geom_file "${CMAKE_CURRENT_SOURCE_DIR}/collect_geom_methods.py") SET(plugins_cmd_options ${geom_file} -o tmp1/geomBuilder.py ${DOC_GEOM_PluginsList}) diff --git a/idl/CMakeLists.txt b/idl/CMakeLists.txt index 3ec72cd2d..9d7f1692a 100755 --- a/idl/CMakeLists.txt +++ b/idl/CMakeLists.txt @@ -107,8 +107,10 @@ INSTALL(TARGETS SalomeIDLIGESPlugin EXPORT ${PROJECT_NAME}TargetGroup DESTINATIO OMNIORB_ADD_MODULE(SalomeIDLXAOPlugin "${SalomeIDLXAOPlugin_IDLSOURCES}" "${IDL_INCLUDE_DIRS}" "${IDL_LINK_PLUGIN_FLAGS}") INSTALL(TARGETS SalomeIDLXAOPlugin EXPORT ${PROJECT_NAME}TargetGroup DESTINATION ${SALOME_INSTALL_LIBS}) -OMNIORB_ADD_MODULE(SalomeIDLVTKPlugin "${SalomeIDLVTKPlugin_IDLSOURCES}" "${IDL_INCLUDE_DIRS}" "${IDL_LINK_PLUGIN_FLAGS}") -INSTALL(TARGETS SalomeIDLVTKPlugin EXPORT ${PROJECT_NAME}TargetGroup DESTINATION ${SALOME_INSTALL_LIBS}) +IF(SALOME_GEOM_USE_VTK) + OMNIORB_ADD_MODULE(SalomeIDLVTKPlugin "${SalomeIDLVTKPlugin_IDLSOURCES}" "${IDL_INCLUDE_DIRS}" "${IDL_LINK_PLUGIN_FLAGS}") + INSTALL(TARGETS SalomeIDLVTKPlugin EXPORT ${PROJECT_NAME}TargetGroup DESTINATION ${SALOME_INSTALL_LIBS}) +ENDIF(SALOME_GEOM_USE_VTK) OMNIORB_ADD_MODULE(SalomeIDLGEOMSuperv "${SalomeIDLGEOMSuperv_IDLSOURCES}" "${IDL_INCLUDE_DIRS}" "${IDL_LINK_SUPERV_FLAGS}") INSTALL(TARGETS SalomeIDLGEOMSuperv EXPORT ${PROJECT_NAME}TargetGroup DESTINATION ${SALOME_INSTALL_LIBS}) diff --git a/resources/CMakeLists.txt b/resources/CMakeLists.txt index 6d834876b..99240b42c 100755 --- a/resources/CMakeLists.txt +++ b/resources/CMakeLists.txt @@ -29,7 +29,6 @@ SET( _res_files STEPPlugin.xml IGESPlugin.xml XAOPlugin.xml - VTKPlugin.xml GEOM_en.xml GEOM_fr.xml GEOM.config @@ -300,6 +299,13 @@ SET( _res_files exportxao.png importxao.png ##@@ insert new functions before this line @@ do not remove this line @@## ) +IF(SALOME_GEOM_USE_VTK) + SET(_res_files + VTKPlugin.xml + ${_res_files} + ) +ENDIF(SALOME_GEOM_USE_VTK) + INSTALL(FILES ${_res_files} DESTINATION ${SALOME_GEOM_INSTALL_RES_DATA}) SET( _texture_files diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index da1d493d6..ceb8ff62f 100755 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -23,8 +23,8 @@ SET(SUBDIRS_COMMON ARCHIMEDE BlockFix GEOMAlgo SKETCHER GEOM ShHealOper GEOMUtils XAO XAO_Swig GEOMImpl GEOM_I GEOMClient GEOM_I_Superv GEOM_SWIG GEOM_PY - AdvancedEngine OCC2VTK - STLPlugin BREPPlugin STEPPlugin IGESPlugin XAOPlugin VTKPlugin Tools + AdvancedEngine + STLPlugin BREPPlugin STEPPlugin IGESPlugin XAOPlugin Tools ) ## @@ -36,6 +36,16 @@ IF(SALOME_GEOM_USE_OPENCV) ) ENDIF() +## +# VTK +## +IF(SALOME_GEOM_USE_VTK) + SET(SUBDIRS_VTK + OCC2VTK + VTKPlugin + ) +ENDIF() + ## # GUI ## @@ -55,6 +65,7 @@ ENDIF() SET(SUBDIRS ${SUBDIRS_COMMON} ${SUBDIRS_OPENCV} + ${SUBDIRS_VTK} ${SUBDIRS_CC} ${SUBDIRS_GUI} ) diff --git a/src/GEOM_I_Superv/CMakeLists.txt b/src/GEOM_I_Superv/CMakeLists.txt index e9a0563e3..f2e8589e1 100755 --- a/src/GEOM_I_Superv/CMakeLists.txt +++ b/src/GEOM_I_Superv/CMakeLists.txt @@ -43,7 +43,6 @@ SET(_link_LIBRARIES SalomeIDLIGESPlugin SalomeIDLSTEPPlugin SalomeIDLSTLPlugin - SalomeIDLVTKPlugin SalomeIDLXAOPlugin ${KERNEL_SALOMELocalTrace} ${KERNEL_SalomeDSClient} @@ -52,6 +51,10 @@ SET(_link_LIBRARIES ${KERNEL_SalomeNS} ) +IF(SALOME_GEOM_USE_VTK) + SET(_link_LIBRARIES ${_link_LIBRARIES} + SalomeIDLVTKPlugin) +ENDIF(SALOME_GEOM_USE_VTK) # --- headers --- SET(GEOM_SupervEngine_HEADERS diff --git a/src/GEOM_I_Superv/GEOM_Superv_i.cc b/src/GEOM_I_Superv/GEOM_Superv_i.cc index a93b4c632..2984de3af 100644 --- a/src/GEOM_I_Superv/GEOM_Superv_i.cc +++ b/src/GEOM_I_Superv/GEOM_Superv_i.cc @@ -22,6 +22,7 @@ #include "GEOM_Superv_i.hh" #include "SALOME_LifeCycleCORBA.hxx" +#include "Utils_CorbaException.hxx" #include CORBA_SERVER_HEADER(SALOME_Session) #include "SALOMEDSClient_ClientFactory.hxx" @@ -483,6 +484,7 @@ void GEOM_Superv_i::getXAOPluginOp() } } +#ifdef WITH_VTK //============================================================================= // getVTKPluginOp: //============================================================================= @@ -498,6 +500,7 @@ void GEOM_Superv_i::getVTKPluginOp() myVTKOp = GEOM::IVTKOperations::_narrow(myGeomEngine->GetPluginOperations(myStudyID, "VTKPluginEngine")); } } +#endif //============================================================================= // GetServant: @@ -3652,6 +3655,7 @@ CORBA::Boolean GEOM_Superv_i::ImportXAO( const char* fileName, return false; } + //============================================================================= // Export VTK //============================================================================= @@ -3659,11 +3663,16 @@ void GEOM_Superv_i::ExportVTK( GEOM::GEOM_Object_ptr theObject, const char* theFileName, CORBA::Double theDeflection ) { + #ifdef WITH_VTK beginService( " GEOM_Superv_i::ExportVTK" ); MESSAGE("GEOM_Superv_i::ExportVTK"); getVTKPluginOp(); myVTKOp->ExportVTK( theObject, theFileName, theDeflection ); endService( " GEOM_Superv_i::ExportVTK" ); +#else + std::string message("GEOM_Superv_i::ExportVTK functionality is unavailable"); + THROW_SALOME_CORBA_EXCEPTION(message.c_str(), SALOME::INTERNAL_ERROR); +#endif } //=============================== Advanced Operations ============================= diff --git a/src/GEOM_I_Superv/GEOM_Superv_i.hh b/src/GEOM_I_Superv/GEOM_Superv_i.hh index da94583c8..594215cc4 100644 --- a/src/GEOM_I_Superv/GEOM_Superv_i.hh +++ b/src/GEOM_I_Superv/GEOM_Superv_i.hh @@ -34,7 +34,9 @@ #include CORBA_CLIENT_HEADER(STEPPlugin) #include CORBA_CLIENT_HEADER(IGESPlugin) #include CORBA_CLIENT_HEADER(XAOPlugin) +#ifdef WITH_VTK #include CORBA_CLIENT_HEADER(VTKPlugin) +#endif #include CORBA_SERVER_HEADER(GEOM_Superv) #include "SALOME_Component_i.hxx" @@ -73,8 +75,9 @@ public: void getSTEPPluginOp(); void getIGESPluginOp(); void getXAOPluginOp(); +#ifdef WITH_VTK void getVTKPluginOp(); - +#endif PortableServer::ServantBase_var GetServant(CORBA::Object_ptr theObject, PortableServer::POA_ptr thePOA); @@ -807,7 +810,9 @@ private: GEOM::ISTEPOperations_var mySTEPOp; GEOM::IIGESOperations_var myIGESOp; GEOM::IXAOOperations_var myXAOOp; +#ifdef WITH_VTK GEOM::IVTKOperations_var myVTKOp; +#endif }; #endif diff --git a/src/GEOM_SWIG/CMakeLists.txt b/src/GEOM_SWIG/CMakeLists.txt index 22c9d3a0f..c29198e15 100755 --- a/src/GEOM_SWIG/CMakeLists.txt +++ b/src/GEOM_SWIG/CMakeLists.txt @@ -132,4 +132,6 @@ SALOME_INSTALL_SCRIPTS("${_python_BREP_SCRIPTS}" ${SALOME_INSTALL_PYTHON}/salome SALOME_INSTALL_SCRIPTS("${_python_STEP_SCRIPTS}" ${SALOME_INSTALL_PYTHON}/salome/STEPPlugin DEF_PERMS) SALOME_INSTALL_SCRIPTS("${_python_IGES_SCRIPTS}" ${SALOME_INSTALL_PYTHON}/salome/IGESPlugin DEF_PERMS) SALOME_INSTALL_SCRIPTS("${_python_XAO_SCRIPTS}" ${SALOME_INSTALL_PYTHON}/salome/XAOPlugin DEF_PERMS) -SALOME_INSTALL_SCRIPTS("${_python_VTK_SCRIPTS}" ${SALOME_INSTALL_PYTHON}/salome/VTKPlugin DEF_PERMS) +IF(SALOME_GEOM_USE_VTK) + SALOME_INSTALL_SCRIPTS("${_python_VTK_SCRIPTS}" ${SALOME_INSTALL_PYTHON}/salome/VTKPlugin DEF_PERMS) +ENDIF(SALOME_GEOM_USE_VTK) -- 2.39.2