From 8779c4b3e4b51839580503650d9d78bd83e669a5 Mon Sep 17 00:00:00 2001 From: Sergey BELASH Date: Tue, 9 Sep 2014 11:31:33 +0400 Subject: [PATCH] Make the application compiliable and executable on Linux with SALOME environment: * Salome and stanalone environments merged into one. * Hotfix for PreferencesMgr to avoid crash in Salome Module mode --- CMakeCommon/FindSUIT.cmake | 12 ++-- CMakeCommon/XMLProcessing.cmake | 8 +-- CMakeLists.txt | 4 +- eclipse.sh | 6 +- eclipse_salome.sh | 17 ------ linux_env.sh | 100 ++++++-------------------------- msvc10_env.bat | 6 +- salome_env.sh | 30 ---------- salome_run.sh | 6 +- src/Model/Model_Document.h | 3 +- src/XGUI/XGUI_Preferences.cpp | 2 + 11 files changed, 45 insertions(+), 149 deletions(-) delete mode 100755 eclipse_salome.sh delete mode 100644 salome_env.sh diff --git a/CMakeCommon/FindSUIT.cmake b/CMakeCommon/FindSUIT.cmake index daca7d986..260e4ceda 100644 --- a/CMakeCommon/FindSUIT.cmake +++ b/CMakeCommon/FindSUIT.cmake @@ -1,6 +1,10 @@ -SET(SUIT_DIR $ENV{SUIT_DIR}) -IF(EXISTS ${SUIT_DIR}) +IF(HAVE_SALOME) + SET(SUIT_INCLUDE ${SALOME_GUI_INCLUDE}) + MESSAGE(STATUS "SUIT_INCLUDE: ${SALOME_GUI_INCLUDE}") +ELSE(HAVE_SALOME) + SET(SUIT_DIR $ENV{SUIT_DIR}) + IF(EXISTS ${SUIT_DIR}) MESSAGE(STATUS "SUIT found at ${SUIT_DIR}") IF(WIN32) @@ -20,5 +24,5 @@ IF(EXISTS ${SUIT_DIR}) ElSE() SET(SUIT_INCLUDE ${SUIT_DIR}/include/salome) ENDIF() - -ENDIF(EXISTS ${SUIT_DIR}) + ENDIF(EXISTS ${SUIT_DIR}) +ENDIF(HAVE_SALOME) diff --git a/CMakeCommon/XMLProcessing.cmake b/CMakeCommon/XMLProcessing.cmake index 9abfef07a..04860f1b2 100644 --- a/CMakeCommon/XMLProcessing.cmake +++ b/CMakeCommon/XMLProcessing.cmake @@ -1,10 +1,10 @@ IF(WIN32) - FILE(TO_CMAKE_PATH $ENV{LIBXML_DIR}/lib/libxml2.lib LIBXML2_LIBRARIES) - FILE(TO_CMAKE_PATH $ENV{LIBXML_DIR}/include LIBXML2_INCLUDE_DIR) + FILE(TO_CMAKE_PATH $ENV{LIBXML2_ROOT_DIR}/lib/libxml2.lib LIBXML2_LIBRARIES) + FILE(TO_CMAKE_PATH $ENV{LIBXML2_ROOT_DIR}/include LIBXML2_INCLUDE_DIR) ELSE() - FILE(TO_CMAKE_PATH $ENV{LIBXML_DIR}/lib/libxml2.so LIBXML2_LIBRARIES) - FILE(TO_CMAKE_PATH $ENV{LIBXML_DIR}/include/libxml2 LIBXML2_INCLUDE_DIR) + FILE(TO_CMAKE_PATH $ENV{LIBXML2_ROOT_DIR}/lib/libxml2.so LIBXML2_LIBRARIES) + FILE(TO_CMAKE_PATH $ENV{LIBXML2_ROOT_DIR}/include/libxml2 LIBXML2_INCLUDE_DIR) ENDIF() FIND_PACKAGE(LibXml2 REQUIRED) diff --git a/CMakeLists.txt b/CMakeLists.txt index ae2ee1eb0..8a6134b22 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -11,10 +11,8 @@ INCLUDE(FindPython) INCLUDE(FindSalome) INCLUDE(FindSolveSpace) INCLUDE(FindCAS) +INCLUDE(FindSUIT) -IF(NOT ${HAVE_SALOME}) - INCLUDE(FindSUIT) -ENDIF(NOT ${HAVE_SALOME}) IF(UNIX) IF(CMAKE_COMPILER_IS_GNUCC) diff --git a/eclipse.sh b/eclipse.sh index 27f21f7db..9ba180d69 100755 --- a/eclipse.sh +++ b/eclipse.sh @@ -9,6 +9,9 @@ source ${SRC_DIR}/linux_env.sh mkdir -p ${ROOT_DIR}/build cd ${ROOT_DIR}/build +export LD_LIBRARY_PATH=${KERNEL_ROOT_DIR}/lib/salome:${LD_LIBRARY_PATH} +export LightAppConfig=${ROOT_DIR}/install/share/salome/resources/newgeom:${GUI_ROOT_DIR}/share/salome/resources/gui + CMAKE_ARGS="-D_ECLIPSE_VERSION=4.3" CMAKE_ARGS="${CMAKE_ARGS} -DCMAKE_BUILD_TYPE=Debug" CMAKE_ARGS="${CMAKE_ARGS} -DCMAKE_ECLIPSE_GENERATE_SOURCE_PROJECT=ON" @@ -19,5 +22,4 @@ CMAKE_ARGS="${CMAKE_ARGS} ${SRC_DIR}" cmake -G "Eclipse CDT4 - Unix Makefiles" ${CMAKE_ARGS} -#/misc/dn48/newgeom/common/eclipse-4.3.0/eclipse& -/misc/dn48/newgeom/common/eclipse-4.4.0/eclipse& \ No newline at end of file +/misc/dn48/newgeom/common/eclipse-4.4.0/eclipse& diff --git a/eclipse_salome.sh b/eclipse_salome.sh deleted file mode 100755 index 103982b80..000000000 --- a/eclipse_salome.sh +++ /dev/null @@ -1,17 +0,0 @@ -#!/bin/sh - -source salome_env.sh - -mkdir -p ${ROOT_DIR}/build -cd ${ROOT_DIR}/build - -CMAKE_ARGS="-D_ECLIPSE_VERSION=4.3" -CMAKE_ARGS="${CMAKE_ARGS} -DCMAKE_BUILD_TYPE=Debug" -CMAKE_ARGS="${CMAKE_ARGS} -DCMAKE_ECLIPSE_GENERATE_SOURCE_PROJECT=ON" -CMAKE_ARGS="${CMAKE_ARGS} -DCMAKE_INSTALL_PREFIX:PATH=${ROOT_DIR}/install" -CMAKE_ARGS="${CMAKE_ARGS} ${SRC_DIR}" - - -cmake -G "Eclipse CDT4 - Unix Makefiles" ${CMAKE_ARGS} - -/misc/dn48/newgeom/common/eclipse-4.3.0/eclipse -Dosgi.locking=none & diff --git a/linux_env.sh b/linux_env.sh index 684c8ddfe..f6bdf5dce 100644 --- a/linux_env.sh +++ b/linux_env.sh @@ -1,99 +1,38 @@ -#------ Setting products installation directory ------ +#!/bin/sh -if [ "${PDIR}" = "" ] ; then - export PDIR=/dn48/newgeom/common/SALOME-7.4.0 +if [ "${INST_ROOT}" = "" ] ; then + source /dn48/newgeom/common/SALOME/env_products.sh +else + source ${INST_ROOT}/env_products.sh fi -# Find absolute path to ROOT_DIR -export ROOT_DIR=$(pwd)/.. -export ROOT_DIR=`cd "${ROOT_DIR}";pwd` +if [ "${NEWGEOM_PDIR}" = "" ] ; then + export NEWGEOM_PDIR=/dn48/newgeom/common/products +fi + +if [ "${ROOT_DIR}" = "" ] ; then + export ROOT_DIR=$(pwd)/.. + export ROOT_DIR=`cd "${ROOT_DIR}";pwd` +fi -#------ Python ------ -export PYTHONHOME=${PDIR}/Python-2.7.3 -export PYTHON_INCLUDE=${PYTHONHOME}/include/python2.7 -export PYTHON_VERSION=2.7 -export PATH=${PYTHONHOME}/bin:${PATH} -export LD_LIBRARY_PATH=${PYTHONHOME}/lib:${LD_LIBRARY_PATH} -export PYTHONPATH=${PYTHONHOME}/lib/python2.7 -## -#------ Qt ------ -export QT4_ROOT_DIR=${PDIR}/qt-4.8.4 -export QT_PLUGIN_PATH=${QT4_ROOT_DIR}/plugins -export PATH=${QT4_ROOT_DIR}/bin:${PATH} -export LD_LIBRARY_PATH=${QT4_ROOT_DIR}/lib:${LD_LIBRARY_PATH} -## -#------ boost ------ -export BOOST_ROOT_DIR=${PDIR}/boost-1.52.0 -export LD_LIBRARY_PATH=${BOOST_ROOT_DIR}/lib:${LD_LIBRARY_PATH} -## -#------ swig ------ -export SWIG_ROOT_DIR=${PDIR}/swig-2.0.8 -export SWIG_LIB=${SWIG_ROOT_DIR}/share/swig/2.0.8 -export PATH=${SWIG_ROOT_DIR}/bin:${PATH} -## -#------ cmake ------ -export CMAKE_ROOT_DIR=${PDIR}/cmake-2.8.10.2 -export PATH=${CMAKE_ROOT_DIR}/bin:${PATH} -## -#------ freetype ------ -export FREETYPE_ROOT_DIR=${PDIR}/freetype-2.4.11 -export LD_LIBRARY_PATH=${FREETYPE_ROOT_DIR}/lib:${LD_LIBRARY_PATH} -## -#------ freeimage ------ -export FREEIMAGE_ROOT_DIR=${PDIR}/freeimage-3.16.0 -export LD_LIBRARY_PATH=${FREEIMAGE_ROOT_DIR}/lib:${LD_LIBRARY_PATH} -## -#------ gl2ps ------ -export GL2PS_ROOT_DIR=${PDIR}/gl2ps-1.3.8 -export PATH=${GL2PS_ROOT_DIR}/bin:${PATH} -export LD_LIBRARY_PATH=${GL2PS_ROOT_DIR}/lib:${LD_LIBRARY_PATH} -## -#------ tbb ------ -export TBB_ROOT_DIR=${PDIR}/tbb-30_018oss -export PATH=${TBB_ROOT_DIR}/bin/intel64/cc4.1.0_libc2.4_kernel2.6.16.21:${PATH} -export LD_LIBRARY_PATH=${TBB_ROOT_DIR}/lib/intel64/cc4.1.0_libc2.4_kernel2.6.16.21:${LD_LIBRARY_PATH} -## -#------ libxml2 ------ -export LIBXML_DIR=${PDIR}/libxml2-2.9.0 -export PATH=${LIBXML_DIR}/bin:${PATH} -export LD_LIBRARY_PATH=${LIBXML_DIR}/lib:${LD_LIBRARY_PATH} -## #------ SolveSpace ------ -export SOLVESPACE_ROOT_DIR=${PDIR}/solvespace-2.0 +export SOLVESPACE_ROOT_DIR=${NEWGEOM_PDIR}/solvespace-2.0 export LD_LIBRARY_PATH=${SOLVESPACE_ROOT_DIR}/lib:${LD_LIBRARY_PATH} ## -#------ OCCT ------ -export CAS_ROOT_DIR=${PDIR}/OCCT-6.7.1 #------ lcov ------ -export LCOV_ROOT_DIR=${PDIR}/lcov-1.11 +export LCOV_ROOT_DIR=${NEWGEOM_PDIR}/lcov-1.11 export PATH=${LCOV_ROOT_DIR}/bin:${PATH} +## -#------ SUIT ------ -export SUIT_DIR=${PDIR}/GUI_7.4.0 -export PATH=${SUIT_DIR}/bin/salome:${PATH} -export LD_LIBRARY_PATH=${SUIT_DIR}/lib/salome:${LD_LIBRARY_PATH} - -# CAS_ROOT_DIR has to be in the PATH for CMake's FindCAS procedures -export PATH=${CAS_ROOT_DIR}:${CAS_ROOT_DIR}/bin:${PATH} -export LD_LIBRARY_PATH=${CAS_ROOT_DIR}/lib:${LD_LIBRARY_PATH} -export CSF_GraphicShr=${CAS_ROOT_DIR}/lib/libTKOpenGl.so -# Variable for Foundation Classes : -export CSF_UnitsLexicon=${CAS_ROOT_DIR}/src/UnitsAPI/Lexi_Expr.dat -export CSF_UnitsDefinition=${CAS_ROOT_DIR}/src/UnitsAPI/Units.dat -# Variable for DataExchange : -export CSF_SHMessage=${CAS_ROOT_DIR}/src/SHMessage -export CSF_XSMessage=${CAS_ROOT_DIR}/src/XSMessage -# Variable for Font : -export CSF_MDTVFontDirectory=${CAS_ROOT_DIR}/src/FontMFT -export CSF_MDTVTexturesDirectory=${CAS_ROOT_DIR}/src/Textures +#------ OCCT ------ # Defaults export CSF_PluginDefaults=${CAS_ROOT_DIR}/src/StdResource export CSF_StandardDefaults=${CAS_ROOT_DIR}/src/StdResource -# Activation of OCCT Kernel multithreading : -export MMGT_REENTRANT=1 # For CMake export LIB=${LD_LIBRARY_PATH} +export PATH=${CASROOT}:${PATH} +## #------ NewGEOM ------ export NEW_GEOM_ROOT_DIR=${ROOT_DIR}/install @@ -102,4 +41,3 @@ export PYTHONPATH=${NEW_GEOM_ROOT_DIR}/swig:${PYTHONPATH} export LD_LIBRARY_PATH=${NEW_GEOM_ROOT_DIR}/bin:${NEW_GEOM_ROOT_DIR}/swig:${NEW_GEOM_ROOT_DIR}/plugins:${LD_LIBRARY_PATH} export NEW_GEOM_CONFIG_FILE=${NEW_GEOM_ROOT_DIR}/plugins export NewGeomResources=${NEW_GEOM_ROOT_DIR}/resources - diff --git a/msvc10_env.bat b/msvc10_env.bat index a684f5e8b..fd95eec28 100644 --- a/msvc10_env.bat +++ b/msvc10_env.bat @@ -105,9 +105,9 @@ set PATH=%CMAKEDIR%\bin;%PATH% @REM ------------------------- @REM LIBXML2 -@SET LIBXML_DIR=%PDIR%\libxml2-2.9.0 -@SET PATH=%LIBXML_DIR%\lib;%PATH% -@SET PATH=%LIBXML_DIR%\bin;%PATH% +@SET LIBXML2_ROOT_DIR=%PDIR%\libxml2-2.9.0 +@SET PATH=%LIBXML2_ROOT_DIR%\lib;%PATH% +@SET PATH=%LIBXML2_ROOT_DIR%\bin;%PATH% @REM ------------------------- @REM ------------------------- diff --git a/salome_env.sh b/salome_env.sh deleted file mode 100644 index fc7a5049f..000000000 --- a/salome_env.sh +++ /dev/null @@ -1,30 +0,0 @@ -#!/bin/sh - -if [ "${INST_ROOT}" = "" ] ; then - source /dn48/newgeom/common/SALOME/env_products.sh -else - source ${INST_ROOT}/env_products.sh -fi - - -#------ SolveSpace ------ -export SOLVESPACE_ROOT_DIR=/dn48/newgeom/common/products/solvespace-2.0 -export LD_LIBRARY_PATH=${SOLVESPACE_ROOT_DIR}/lib:${LD_LIBRARY_PATH} -## - -export ROOT_DIR=$(pwd)/.. -export ROOT_DIR=`cd "${ROOT_DIR}";pwd` - -SRC_DIR=${ROOT_DIR}/sources - -export LIB=${LD_LIBRARY_PATH} -export PATH=${CASROOT}:${PATH} -export PYTHON_INC_DIR=${PYTHON_INCLUDE} -export PYTHON_LIB_DIR=${PYTHON_ROOT_DIR}/lib - - -#------ NewGEOM ------ -export INST_DIR=${ROOT_DIR}/install -export PATH=${INST_DIR}/bin:${INST_DIR}/plugins:${PATH} -export LD_LIBRARY_PATH=${INST_DIR}/bin:${INST_DIR}/swig:${INST_DIR}/plugins:${PATH}${LD_LIBRARY_PATH} -export NEW_GEOM_CONFIG_FILE=${INST_DIR}/plugins diff --git a/salome_run.sh b/salome_run.sh index e4dc6bd95..5ef39f4ab 100755 --- a/salome_run.sh +++ b/salome_run.sh @@ -1,12 +1,12 @@ #!/bin/sh export ROOT_DIR=$(pwd)/.. +export ROOT_DIR=`cd "${ROOT_DIR}";pwd` -source ${ROOT_DIR}/sources/salome_env.sh +source ${ROOT_DIR}/sources/linux_env.sh # Correcting path which defined with error export LD_LIBRARY_PATH=${KERNEL_ROOT_DIR}/lib/salome:${LD_LIBRARY_PATH} - export LightAppConfig=${ROOT_DIR}/install/share/salome/resources/newgeom:${GUI_ROOT_DIR}/share/salome/resources/gui -SUITApp LightApp -style salome --modules=NewGeom --uselicense --noexcepthandling \ No newline at end of file +SUITApp LightApp --modules=NewGeom \ No newline at end of file diff --git a/src/Model/Model_Document.h b/src/Model/Model_Document.h index 21f535939..0a53b920c 100644 --- a/src/Model/Model_Document.h +++ b/src/Model/Model_Document.h @@ -153,8 +153,7 @@ class Model_Document : public ModelAPI_Document const int theResultIndex = 0); //! returns the label of result by index; creates this label if it was not created before - TDF_Label Model_Document::resultLabel( - const boost::shared_ptr& theFeatureData, const int theResultIndex); + TDF_Label resultLabel(const boost::shared_ptr& theFeatureData, const int theResultIndex); //! Updates the results list of the feature basing on the current data tree void updateResults(FeaturePtr theFeature); diff --git a/src/XGUI/XGUI_Preferences.cpp b/src/XGUI/XGUI_Preferences.cpp index 0d3f69a12..81fae93d0 100644 --- a/src/XGUI/XGUI_Preferences.cpp +++ b/src/XGUI/XGUI_Preferences.cpp @@ -53,6 +53,8 @@ void XGUI_Preferences::updateCustomProps() void XGUI_Preferences::loadCustomProps() { + if(!myResourceMgr) + return; QStringList aSections = myResourceMgr->sections(); foreach (QString aSection, aSections) { -- 2.39.2