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