Salome HOME
Merge remote branch 'origin/hydro/imps_2015'
[modules/gui.git] / bin / runLightSalome.csh
1 #!/bin/csh -f
2 # Copyright (C) 2007-2016  CEA/DEN, EDF R&D, OPEN CASCADE
3 #
4 # Copyright (C) 2003-2007  OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
5 # CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
6 #
7 # This library is free software; you can redistribute it and/or
8 # modify it under the terms of the GNU Lesser General Public
9 # License as published by the Free Software Foundation; either
10 # version 2.1 of the License, or (at your option) any later version.
11 #
12 # This library is distributed in the hope that it will be useful,
13 # but WITHOUT ANY WARRANTY; without even the implied warranty of
14 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
15 # Lesser General Public License for more details.
16 #
17 # You should have received a copy of the GNU Lesser General Public
18 # License along with this library; if not, write to the Free Software
19 # Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA
20 #
21 # See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
22 #
23 #  File   : runLightSalome.csh
24 #  Author : Vadim SANDLER, Open CASCADE S.A.S, vadim.sandler@opencascade.com
25 #
26
27 ###
28 # set default value for the LightAppConfig variable, which 
29 # is necessary for loading of .ini or .xml resources file
30 ###
31
32 if ( ! ($?LightAppConfig) ) then
33     setenv LightAppConfig ${GUI_ROOT_DIR}/share/salome/resources/gui
34 else
35     setenv LightAppConfig ${LightAppConfig}:${GUI_ROOT_DIR}/share/salome/resources/gui
36 endif
37 if ( ! ($?LightAppResources) ) then
38     setenv LightAppResources ${GUI_ROOT_DIR}/share/salome/resources/gui
39 else
40     setenv LightAppResources ${LightAppResources}:${GUI_ROOT_DIR}/share/salome/resources/gui
41 endif
42
43 ###
44 # default settings 
45 ###
46
47 if (! ($?PATH) ) setenv PATH
48 if (! ($?LD_LIBRARY_PATH) ) setenv LD_LIBRARY_PATH
49 if (! ($?PYTHONPATH) ) setenv PYTHONPATH
50 if (! ($?SALOMEPATH) ) setenv SALOMEPATH
51
52 ###
53 # process --modules=... command line option (get list of modules)
54 ###
55
56 set modules=""
57
58 foreach arg ( X $* )
59     if ( "$arg" != "X" ) then
60         switch ( $arg )
61             case --modules=*:
62                 set modules=`echo $arg | awk -F= '{ print $2 }' | sed -e "s%,% %g"`
63                 breaksw
64             default:
65                 breaksw
66         endsw
67     endif
68 end
69
70 set modules="KERNEL GUI $modules"
71
72 ###
73 # exclude modules duplication
74 ###
75
76 set mods=""
77
78 foreach mod ( $modules )
79     echo $mods | grep -E "\<$mod\>" >/dev/null
80     if ( "$?" == "1" ) then
81         set mods="$mods $mod"
82     endif
83 end
84
85 ###
86 # set additional environment
87 ###
88
89 set python_version=`python -c "import sys; print sys.version[:3]"`
90
91 set MY_PATH=""
92 set MY_LD_LIBRARY_PATH=""
93 set MY_PYTHONPATH=""
94
95 foreach mod ( $mods )
96     if ( "$arg" != "X" ) then
97         set root_dir=`printenv ${mod}_ROOT_DIR`
98         if ( "$root_dir" != "" ) then
99             set mod_lower=`echo $mod | tr "A-Z" "a-z"`
100             if ( -d ${root_dir}/bin/salome ) then
101                 if ( "${MY_PATH}" == "" ) then
102                     set MY_PATH=${root_dir}/bin/salome
103                 else
104                     set MY_PATH=${MY_PATH}:${root_dir}/bin/salome
105                 endif
106             endif
107             if ( -d ${root_dir}/lib/salome ) then
108                 if ( "${MY_LD_LIBRARY_PATH}" == "" ) then
109                     set MY_LD_LIBRARY_PATH=${root_dir}/lib/salome
110                 else
111                     set MY_LD_LIBRARY_PATH=${MY_LD_LIBRARY_PATH}:${root_dir}/lib/salome
112                 endif
113             endif
114             if ( "${python_version}" != "" ) then
115                 if ( -d ${root_dir}/bin/salome ) then
116                     if ( "${MY_PYTHONPATH}" == "" ) then
117                         set MY_PYTHONPATH=${root_dir}/bin/salome
118                     else
119                         set MY_PYTHONPATH=${MY_PYTHONPATH}:${root_dir}/bin/salome
120                     endif
121                 endif
122                 if ( -d ${root_dir}/lib/salome ) then
123                     if ( "${MY_PYTHONPATH}" == "" ) then
124                         set MY_PYTHONPATH=${root_dir}/lib/salome
125                     else
126                         set MY_PYTHONPATH=${MY_PYTHONPATH}:${root_dir}/lib/salome
127                     endif
128                 endif
129                 if ( -d ${root_dir}/lib/python${python_version}/site-packages/salome ) then 
130                     if ( "${MY_PYTHONPATH}" == "" ) then
131                         set MY_PYTHONPATH=${root_dir}/lib/python${python_version}/site-packages/salome
132                     else
133                         set MY_PYTHONPATH=${MY_PYTHONPATH}:${root_dir}/lib/python${python_version}/site-packages/salome
134                     endif
135                 endif
136             endif
137             if ( "$mod" != "KERNEL" && "$mod" != "GUI" ) then
138                 setenv LightAppConfig ${LightAppConfig}:${root_dir}/share/salome/resources/${mod_lower}
139             endif
140             if ( "${SALOMEPATH}" == "" ) then
141                 setenv SALOMEPATH ${root_dir}
142             else
143                 setenv SALOMEPATH ${SALOMEPATH}:${root_dir}
144             endif
145         endif
146     endif
147 end
148
149 if ( "${MY_PATH}" != "" ) setenv PATH ${MY_PATH}:${PATH}
150 if ( "${MY_LD_LIBRARY_PATH}" != "" ) setenv LD_LIBRARY_PATH ${MY_LD_LIBRARY_PATH}:${LD_LIBRARY_PATH}
151 if ( "${PYTHONPATH}" != "" ) setenv PYTHONPATH ${MY_PYTHONPATH}:${PYTHONPATH}
152
153 ###
154 # start application
155 ###
156
157 suitexe LightApp $* &