From: Anthony Geay Date: Fri, 12 Feb 2021 15:10:01 +0000 (+0100) Subject: no comment X-Git-Tag: V9_7_0a1~41 X-Git-Url: http://git.salome-platform.org/gitweb/?a=commitdiff_plain;h=b3639f4f45cbb3a22eb2ef21486675fbc2ddfb0b;p=modules%2Fshaper.git no comment --- diff --git a/src/SHAPERGUI/CMakeLists.txt b/src/SHAPERGUI/CMakeLists.txt index 0211a295d..551dd96d0 100644 --- a/src/SHAPERGUI/CMakeLists.txt +++ b/src/SHAPERGUI/CMakeLists.txt @@ -127,8 +127,8 @@ ADD_DEPENDENCIES(SHAPER XGUI) TARGET_LINK_LIBRARIES(SHAPER ${PROJECT_LIBRARIES}) # -add_executable(shapergui shapergui.cpp) -target_link_libraries(shapergui ${QT_LIBRARIES}) +add_executable(shapergui_app shapergui_app.cpp) +target_link_libraries(shapergui_app ${QT_LIBRARIES}) # configuration CONFIGURE_FILE( @@ -136,7 +136,7 @@ CONFIGURE_FILE( "${CMAKE_CURRENT_BINARY_DIR}/LightApp.xml" ) -install(TARGETS shapergui DESTINATION ${SHAPER_INSTALL_EXE}) +install(TARGETS shapergui_app DESTINATION ${SHAPER_INSTALL_EXE}) INSTALL(TARGETS SHAPER DESTINATION ${SHAPER_INSTALL_BIN}) INSTALL(FILES ${PROJECT_RESOURCES} DESTINATION ${SHAPER_INSTALL_RESOURCES}) INSTALL(FILES ${QM_RESOURCES} DESTINATION ${SHAPER_INSTALL_QM_RESOURCES}) diff --git a/src/SHAPERGUI/shapergui.cpp b/src/SHAPERGUI/shapergui.cpp deleted file mode 100644 index b0ba67c83..000000000 --- a/src/SHAPERGUI/shapergui.cpp +++ /dev/null @@ -1,60 +0,0 @@ -// Copyright (C) 2021 CEA/DEN, EDF R&D -// -// This library is free software; you can redistribute it and/or -// modify it under the terms of the GNU Lesser General Public -// License as published by the Free Software Foundation; either -// version 2.1 of the License, or (at your option) any later version. -// -// This library 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 -// Lesser General Public License for more details. -// -// You should have received a copy of the GNU Lesser General Public -// License along with this library; if not, write to the Free Software -// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA -// -// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com -// - -#include -#include -#include - -#include - -int main(int argc, char *argv[]) -{ - constexpr char GUI_ROOT_DIR[]="GUI_ROOT_DIR"; - constexpr char SHAPER_ROOT_DIR[]="SHAPER_ROOT_DIR"; - constexpr char LIGHTAPPCONFIG[]="LightAppConfig"; - QProcessEnvironment pe(QProcessEnvironment::systemEnvironment()); - if(!pe.contains(SHAPER_ROOT_DIR)) - { - std::cerr << SHAPER_ROOT_DIR << " is not defined in your environment !" << std::endl; - return 1; - } - if(!pe.contains(GUI_ROOT_DIR)) - { - std::cerr << GUI_ROOT_DIR << " is not defined in your environment !" << std::endl; - return 1; - } - // fill LightAppConfig env var - QString gui_root_dir( QDir::fromNativeSeparators(pe.value(GUI_ROOT_DIR)) ); - QString shaper_root_dir( QDir::fromNativeSeparators(pe.value(SHAPER_ROOT_DIR)) ); - QString lightappconfig_val( QString("%1:%2") - .arg( QDir::toNativeSeparators( QString("%1/share/salome/resources/gui").arg(gui_root_dir) ) ) - .arg( QDir::toNativeSeparators( QString("%1/share/salome/resources/shaper").arg(shaper_root_dir) ) ) ); - pe.insert(LIGHTAPPCONFIG,lightappconfig_val); - //tells shutup to salome.salome_init invoked at shaper engine ignition - pe.insert("SALOME_EMB_SERVANT","1"); - // - QProcess proc; - proc.setProcessEnvironment(pe); - proc.setProgram("suitexe"); - proc.setArguments({"--modules=SHAPER"}); - proc.setProcessChannelMode( QProcess::ForwardedErrorChannel ); - proc.start(); - proc.waitForFinished(); - return proc.exitCode(); -} diff --git a/src/SHAPERGUI/shapergui_app.cpp b/src/SHAPERGUI/shapergui_app.cpp new file mode 100644 index 000000000..b0ba67c83 --- /dev/null +++ b/src/SHAPERGUI/shapergui_app.cpp @@ -0,0 +1,60 @@ +// Copyright (C) 2021 CEA/DEN, EDF R&D +// +// This library is free software; you can redistribute it and/or +// modify it under the terms of the GNU Lesser General Public +// License as published by the Free Software Foundation; either +// version 2.1 of the License, or (at your option) any later version. +// +// This library 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 +// Lesser General Public License for more details. +// +// You should have received a copy of the GNU Lesser General Public +// License along with this library; if not, write to the Free Software +// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +// +// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com +// + +#include +#include +#include + +#include + +int main(int argc, char *argv[]) +{ + constexpr char GUI_ROOT_DIR[]="GUI_ROOT_DIR"; + constexpr char SHAPER_ROOT_DIR[]="SHAPER_ROOT_DIR"; + constexpr char LIGHTAPPCONFIG[]="LightAppConfig"; + QProcessEnvironment pe(QProcessEnvironment::systemEnvironment()); + if(!pe.contains(SHAPER_ROOT_DIR)) + { + std::cerr << SHAPER_ROOT_DIR << " is not defined in your environment !" << std::endl; + return 1; + } + if(!pe.contains(GUI_ROOT_DIR)) + { + std::cerr << GUI_ROOT_DIR << " is not defined in your environment !" << std::endl; + return 1; + } + // fill LightAppConfig env var + QString gui_root_dir( QDir::fromNativeSeparators(pe.value(GUI_ROOT_DIR)) ); + QString shaper_root_dir( QDir::fromNativeSeparators(pe.value(SHAPER_ROOT_DIR)) ); + QString lightappconfig_val( QString("%1:%2") + .arg( QDir::toNativeSeparators( QString("%1/share/salome/resources/gui").arg(gui_root_dir) ) ) + .arg( QDir::toNativeSeparators( QString("%1/share/salome/resources/shaper").arg(shaper_root_dir) ) ) ); + pe.insert(LIGHTAPPCONFIG,lightappconfig_val); + //tells shutup to salome.salome_init invoked at shaper engine ignition + pe.insert("SALOME_EMB_SERVANT","1"); + // + QProcess proc; + proc.setProcessEnvironment(pe); + proc.setProgram("suitexe"); + proc.setArguments({"--modules=SHAPER"}); + proc.setProcessChannelMode( QProcess::ForwardedErrorChannel ); + proc.start(); + proc.waitForFinished(); + return proc.exitCode(); +}