1 // Copyright (C) 2021 CEA/DEN, EDF R&D
3 // This library is free software; you can redistribute it and/or
4 // modify it under the terms of the GNU Lesser General Public
5 // License as published by the Free Software Foundation; either
6 // version 2.1 of the License, or (at your option) any later version.
8 // This library is distributed in the hope that it will be useful,
9 // but WITHOUT ANY WARRANTY; without even the implied warranty of
10 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
11 // Lesser General Public License for more details.
13 // You should have received a copy of the GNU Lesser General Public
14 // License along with this library; if not, write to the Free Software
15 // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
17 // See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
20 #include <QProcessEnvironment>
26 int main(int argc, char *argv[])
28 constexpr char GUI_ROOT_DIR[]="GUI_ROOT_DIR";
29 constexpr char SHAPER_ROOT_DIR[]="SHAPER_ROOT_DIR";
30 constexpr char LIGHTAPPCONFIG[]="LightAppConfig";
31 QProcessEnvironment pe(QProcessEnvironment::systemEnvironment());
32 if(!pe.contains(SHAPER_ROOT_DIR))
34 std::cerr << SHAPER_ROOT_DIR << " is not defined in your environment !" << std::endl;
37 if(!pe.contains(GUI_ROOT_DIR))
39 std::cerr << GUI_ROOT_DIR << " is not defined in your environment !" << std::endl;
42 // fill LightAppConfig env var
43 QString gui_root_dir( QDir::fromNativeSeparators(pe.value(GUI_ROOT_DIR)) );
44 QString shaper_root_dir( QDir::fromNativeSeparators(pe.value(SHAPER_ROOT_DIR)) );
45 QString lightappconfig_val( QString("%1:%2")
46 .arg( QDir::toNativeSeparators( QString("%1/share/salome/resources/gui").arg(gui_root_dir) ) )
47 .arg( QDir::toNativeSeparators( QString("%1/share/salome/resources/shaper").arg(shaper_root_dir) ) ) );
48 pe.insert(LIGHTAPPCONFIG,lightappconfig_val);
49 //tells shutup to salome.salome_init invoked at shaper engine ignition
50 pe.insert("SALOME_EMB_SERVANT","1");
53 proc.setProcessEnvironment(pe);
54 proc.setProgram("suitexe");
55 proc.setArguments({"--modules=SHAPER"});
56 proc.setProcessChannelMode( QProcess::ForwardedErrorChannel );
58 proc.waitForFinished();
59 return proc.exitCode();