ThirdParty: adjustments for csh
[OpenFOAM-1.6-ext.git] / etc / settings.csh
blobb74145e4dcd09c14c1df295d8c1836cdab233536
1 #----------------------------------*-sh-*--------------------------------------
2 # =========                 |
3 # \\      /  F ield         | OpenFOAM: The Open Source CFD Toolbox
4 #  \\    /   O peration     |
5 #   \\  /    A nd           | Copyright held by original author
6 #    \\/     M anipulation  |
7 #------------------------------------------------------------------------------
8 # License
9 #     This file is part of OpenFOAM.
11 #     OpenFOAM is free software; you can redistribute it and/or modify it
12 #     under the terms of the GNU General Public License as published by the
13 #     Free Software Foundation; either version 2 of the License, or (at your
14 #     option) any later version.
16 #     OpenFOAM is distributed in the hope that it will be useful, but WITHOUT
17 #     ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
18 #     FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
19 #     for more details.
21 #     You should have received a copy of the GNU General Public License
22 #     along with OpenFOAM; if not, write to the Free Software Foundation,
23 #     Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
25 # Script
26 #     etc/settings.csh
28 # Description
29 #     Startup file for OpenFOAM
30 #     Sourced from OpenFOAM-??/etc/cshrc
32 #------------------------------------------------------------------------------
34 # prefix to PATH
35 alias _foamAddPath 'set path=(\!* $path)'
36 # prefix to LD_LIBRARY_PATH
37 alias _foamAddLib 'setenv LD_LIBRARY_PATH \!*\:${LD_LIBRARY_PATH}'
39 # location of the jobControl directory
40 setenv FOAM_JOB_DIR $WM_PROJECT_INST_DIR/jobControl
42 # wmake configuration
43 setenv WM_DIR $WM_PROJECT_DIR/wmake
44 setenv WM_LINK_LANGUAGE c++
45 setenv WM_OPTIONS $WM_ARCH$WM_COMPILER$WM_PRECISION_OPTION$WM_COMPILE_OPTION
46 set path=($WM_DIR $path)
48 #setenv WM_DECOMP_INC -DCELL_DECOMP
49 #setenv WM_DECOMP_LIBS "-lcellDecompFiniteElement -lcellDecompositionMotionSolver"
50 setenv WM_DECOMP_INC -DFACE_DECOMP
51 setenv WM_DECOMP_LIBS "-lfaceDecompFiniteElement -lfaceDecompositionMotionSolver"
53 # base configuration
54 setenv FOAM_APP $WM_PROJECT_DIR/applications
55 setenv FOAM_APPBIN $WM_PROJECT_DIR/applications/bin/$WM_OPTIONS
56 setenv FOAM_LIB $WM_PROJECT_DIR/lib
57 setenv FOAM_LIBBIN $WM_PROJECT_DIR/lib/$WM_OPTIONS
58 setenv FOAM_SRC $WM_PROJECT_DIR/src
60 # shared site configuration - similar naming convention as ~OpenFOAM expansion
61 setenv FOAM_SITE_APPBIN $WM_PROJECT_INST_DIR/site/$WM_PROJECT_VERSION/bin/$WM_OPTIONS
62 setenv FOAM_SITE_LIBBIN $WM_PROJECT_INST_DIR/site/$WM_PROJECT_VERSION/lib/$WM_OPTIONS
64 # user configuration
65 setenv FOAM_USER_APPBIN $WM_PROJECT_USER_DIR/applications/bin/$WM_OPTIONS
66 setenv FOAM_USER_LIBBIN $WM_PROJECT_USER_DIR/lib/$WM_OPTIONS
68 # convenience
69 setenv FOAM_TUTORIALS $WM_PROJECT_DIR/tutorials
70 setenv FOAM_UTILITIES $FOAM_APP/utilities
71 setenv FOAM_SOLVERS $FOAM_APP/solvers
72 setenv FOAM_RUN $WM_PROJECT_USER_DIR/run
74 # add OpenFOAM scripts and wmake to the path
75 set path=($WM_DIR $WM_PROJECT_DIR/bin $path)
77 _foamAddPath $FOAM_APPBIN
78 _foamAddPath $FOAM_SITE_APPBIN
79 _foamAddPath $FOAM_USER_APPBIN
80  # Make sure to pick up dummy versions of external libraries last
81 _foamAddLib  $FOAM_LIBBIN/dummy
82 _foamAddLib  $FOAM_LIBBIN
83 _foamAddLib  $FOAM_SITE_LIBBIN
84 _foamAddLib  $FOAM_USER_LIBBIN
87 # Select compiler installation
88 # ~~~~~~~~~~~~~~~~~~~~~~~~~~~~
89 # compilerInstall = OpenFOAM | System
90 #set compilerInstall=OpenFOAM
91 set compilerInstall=System
93 switch ("$compilerInstall")
94 case OpenFOAM:
95     switch ("$WM_COMPILER")
96     case Gcc:
97         setenv WM_COMPILER_DIR $WM_THIRD_PARTY_DIR/gcc-4.3.3/platforms/$WM_ARCH$WM_COMPILER_ARCH
98         _foamAddLib $WM_THIRD_PARTY_DIR/mpfr-2.4.1/platforms/$WM_ARCH$WM_COMPILER_ARCH/lib
99         _foamAddLib $WM_THIRD_PARTY_DIR/gmp-4.2.4/platforms/$WM_ARCH$WM_COMPILER_ARCH/lib
100     breaksw
101     case Gcc43:
102         setenv WM_COMPILER_DIR $WM_THIRD_PARTY_DIR/gcc-4.3.3/platforms/$WM_ARCH$WM_COMPILER_ARCH
103         _foamAddLib $WM_THIRD_PARTY_DIR/mpfr-2.4.1/platforms/$WM_ARCH$WM_COMPILER_ARCH/lib
104         _foamAddLib $WM_THIRD_PARTY_DIR/gmp-4.2.4/platforms/$WM_ARCH$WM_COMPILER_ARCH/lib
105     breaksw
106     case Gcc42:
107         setenv WM_COMPILER_DIR $WM_THIRD_PARTY_DIR/gcc-4.2.4/platforms/$WM_ARCH$WM_COMPILER_ARCH
108     breaksw
109     endsw
111     # Check that the compiler directory can be found
112     if ( ! -d "$WM_COMPILER_DIR" ) then
113         echo
114         echo "Warning in $WM_PROJECT_DIR/etc/settings.csh:"
115         echo "    Cannot find $WM_COMPILER_DIR installation."
116         echo "    Please install this compiler version or if you wish to use the system compiler,"
117         echo "    change the 'compilerInstall' setting to 'System' in this file"
118         echo
119     endif
121     _foamAddPath ${WM_COMPILER_DIR}/bin
122     _foamAddLib  ${WM_COMPILER_DIR}/lib${WM_COMPILER_LIB_ARCH}
123     _foamAddLib  ${WM_COMPILER_DIR}/lib
125     breaksw
126 endsw
129 switch ("$WM_COMPILER")
130 case Gcc:
131     setenv WM_CC 'gcc'
132     setenv WM_CXX 'g++'
133     breaksw
134 case Icc:
135     setenv WM_CC 'icc'
136     setenv WM_CXX 'icpc'
137     breaksw
138 endsw
140 # Communications library
141 # ~~~~~~~~~~~~~~~~~~~~~~
143 unset MPI_ARCH_PATH
145 set mpi_version=unknown
147 switch ("$WM_MPLIB")
148 case OPENMPI:
149     if (-d $WM_THIRD_PARTY_DIR/packages/openmpi-1.4.3 ) then
150         set mpi_version=openmpi-1.4.3
152         if ($?FOAM_VERBOSE && $?prompt) then
153             echo "Using openmpi-1.4.3 from the ThirdParty package: $WM_THIRD_PARTY_DIR/packages/$mpi_version"
154         endif
155         _foamSource  $WM_THIRD_PARTY_DIR/packages/$mpi_version/platforms/$WM_OPTIONS/etc/$mpi_version.csh
157     else if (-d $WM_THIRD_PARTY_DIR/packages/openmpi-1.5 ) then
158         set mpi_version=openmpi-1.5
160         if ($?FOAM_VERBOSE && $?prompt) then
161             echo "Using openmpi-1.5 from the ThirdParty package: $WM_THIRD_PARTY_DIR/packages/$mpi_version"
162         endif
163         _foamSource  $WM_THIRD_PARTY_DIR/packages/$mpi_version/platforms/$WM_OPTIONS/etc/$mpi_version.csh
164     endif
166     setenv FOAM_MPI_LIBBIN $FOAM_LIBBIN/$mpi_version
167     unset mpi_version
168     breaksw
170 case SYSTEMOPENMPI:
171     set mpi_version=openmpi-system
173     # make sure not the "old" mpi is used 
174     # Not sure if this is necessary anymore.
175     # export OPAL_PREFIX=
177     # Make sure OPENMPI_BIN_DIR is set and valid
178     if ($?OPENMPI_BIN_DIR != 0 ) then 
179         if (-d "${OPENMPI_BIN_DIR}" ) then
180             # User defined value specified for OPENMPI_BIN_DIR
181             #
182             # WARNING:
183             #          We assume this path specified by $OPENMPI_BIN_DIR is valid
184             #          We assume the command mpicc is located somewhere under this path
185             #          We assume the file mpi.h is located somewhere under this path
186             #
187             #          Otherwise, please double check your openmpi installation, you are
188             #          probably missing the openmpi runtime and/or development packages
189             #          available for your system.
190             #
191             _foamAddPath $OPENMPI_BIN_DIR
192          endif
193     else
194         # Here, we assume your environment is already set for running
195         # and developping with openmpi.
196         #
197         # Initialize OPENMPI_BIN_DIR using the path to mpicc
198         set mpicc_cmd=`which mpicc`
199         setenv OPENMPI_BIN_DIR `dirname $mpicc_cmd`
200         unset mpicc_cmd
201     endif
203     # Make sure OPENMPI_LIB_DIR is set
204     if ( $?OPENMPI_LIB_DIR == 0 ) then
205         # Initialize OPENMPI_LIB_DIR using the path to mpicc 
206         setenv OPENMPI_LIB_DIR "`mpicc --showme:libdirs`"
207     endif
209     # Make sure the dynamic libraries are accessible
210     if( $?OPENMPI_LIB_DIR != 0 ) then
211         _foamAddLib $OPENMPI_LIB_DIR
212     endif
214     setenv MPI_HOME `dirname $OPENMPI_BIN_DIR`
215     setenv MPI_ARCH_PATH $MPI_HOME
216     setenv OPAL_PREFIX $MPI_ARCH_PATH
218     # We initialize the rest of the environment using mpicc --showme:
219     if ($?OPENMPI_INCLUDE_DIR == 0) then
220         setenv OPENMPI_INCLUDE_DIR "`mpicc --showme:incdirs`"
221     endif
223     if (${?OPENMPI_COMPILE_FLAGS} == 0) then
224         setenv OPENMPI_COMPILE_FLAGS "`mpicc --showme:compile`"
225     endif
227     if (${?OPENMPI_COMPILE_FLAGS} == 0) then
228         setenv OPENMPI_COMPILE_FLAGS "`mpicc --showme:compile`"
229     endif
231     if (${?OPENMPI_LINK_FLAGS} == 0) then
232         setenv OPENMPI_LINK_FLAGS "`mpicc --showme:link`"
233     endif
235     #
236     # WARNING: We assume the file mpi.h will be available under the directories identified
237     #          by the variable $OPENMPI_INCLUDE_DIR. Otherwise, please double check your
238     #          system openmpi installation.
240     # Set compilation flags here instead of in wmake/rules/../mplibSYSTEMOPENMPI
241     setenv PINC "$OPENMPI_COMPILE_FLAGS"
242     setenv PLIBS "$OPENMPI_LINK_FLAGS"
244     # No longer needed, but we keep this as a reference, just in case...
245     #libDir `echo "$PLIBS" | sed -e 's/.*-L\([^ ]*\).*/\1/'`
246     #_foamAddLib $libDir
248     if ($?FOAM_VERBOSE && $?prompt) then
249         echo "Using system installed OpenMPI:"
250         echo "    OPENMPI_BIN_DIR       : $OPENMPI_BIN_DIR"
251         echo "    OPENMPI_LIB_DIR       : $OPENMPI_LIB_DIR"
252         echo "    OPENMPI_INCLUDE_DIR   : $OPENMPI_INCLUDE_DIR"
253         echo "    OPENMPI_COMPILE_FLAGS : $OPENMPI_COMPILE_FLAGS"
254         echo "    OPENMPI_LINK_FLAGS    : $OPENMPI_LINK_FLAGS"
255         echo ""
256         echo "    MPI_HOME              : $MPI_HOME"
257         echo "    MPI_ARCH_PATH         : $MPI_ARCH_PATH"
258         echo "    OPAL_PREFIX           : $OPAL_PREFIX"
259         echo "    PINC                  : $PINC"
260         echo "    PLIBS                 : $PLIBS"
261     endif
263     setenv FOAM_MPI_LIBBIN $FOAM_LIBBIN/$mpi_version
264     unset mpi_version
265     breaksw
267 case MPICH:
268     set mpi_version=mpich-1.2.4
269     setenv MPI_HOME $WM_THIRD_PARTY_DIR/$mpi_version
270     setenv MPI_ARCH_PATH $MPI_HOME/platforms/$WM_OPTIONS
271     setenv MPICH_ROOT $MPI_ARCH_PATH
273     _foamAddPath $MPI_ARCH_PATH/bin
274     _foamAddLib  $MPI_ARCH_PATH/lib
276     setenv FOAM_MPI_LIBBIN $FOAM_LIBBIN/$mpi_version
277     unset mpi_version
278     breaksw
280 case MPICH-GM:
281     setenv MPI_ARCH_PATH /opt/mpi
282     setenv MPICH_PATH $MPI_ARCH_PATH
283     setenv MPICH_ROOT $MPI_ARCH_PATH
284     setenv GM_LIB_PATH /opt/gm/lib64
286     _foamAddPath $MPI_ARCH_PATH/bin
287     _foamAddLib  $MPI_ARCH_PATH/lib
288     _foamAddLib  $GM_LIB_PATH
290     setenv FOAM_MPI_LIBBIN $FOAM_LIBBIN/mpich-gm
291     breaksw
293 case HPMPI:
294     setenv MPI_HOME /opt/hpmpi
295     setenv MPI_ARCH_PATH $MPI_HOME
296     setenv MPICH_ROOT=$MPI_ARCH_PATH
298     _foamAddPath $MPI_ARCH_PATH/bin
300     switch (`uname -m`)
301     case i686:
302         _foamAddLib $MPI_ARCH_PATH/lib/linux_ia32
303         breaksw
304     case x86_64:
305         _foamAddLib $MPI_ARCH_PATH/lib/linux_amd64
306         breaksw
307     case ia64:
308         _foamAddLib $MPI_ARCH_PATH/lib/linux_ia64
309         breaksw
310     default:
311         echo Unknown processor type `uname -m` for Linux
312         breaksw
313     endsw
315     setenv FOAM_MPI_LIBBIN $FOAM_LIBBIN/hpmpi
316     breaksw
318 case GAMMA:
319     setenv MPI_ARCH_PATH /usr
320     setenv FOAM_MPI_LIBBIN $FOAM_LIBBIN/gamma
321     breaksw
323 case MPI:
324     setenv MPI_ARCH_PATH /opt/mpi
325     setenv FOAM_MPI_LIBBIN $FOAM_LIBBIN/mpi
326     breaksw
328 case FJMPI:
329     setenv MPI_ARCH_PATH /opt/FJSVmpi2
330     setenv FOAM_MPI_LIBBIN $FOAM_LIBBIN/mpi
331     _foamAddPath $MPI_ARCH_PATH/bin
332     _foamAddLib  $MPI_ARCH_PATH/lib/sparcv9
333     _foamAddLib  /opt/FSUNf90/lib/sparcv9
334     _foamAddLib  /opt/FJSVpnidt/lib
335     breaksw
337 case QSMPI:
338     setenv MPI_ARCH_PATH /usr/lib/mpi
339     setenv FOAM_MPI_LIBBIN FOAM_LIBBIN/qsmpi
341     _foamAddPath $MPI_ARCH_PATH/bin
342     _foamAddLib $MPI_ARCH_PATH/lib
344     breaksw
346 default:
347     setenv FOAM_MPI_LIBBIN $FOAM_LIBBIN/dummy
348     breaksw
349 endsw
351 _foamAddLib $FOAM_MPI_LIBBIN
354 # Set the minimum MPI buffer size (used by all platforms except SGI MPI)
355 # ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
356 set minBufferSize=20000000
358 if ( $?MPI_BUFFER_SIZE ) then
359     if ( $MPI_BUFFER_SIZE < $minBufferSize ) then
360         setenv MPI_BUFFER_SIZE $minBufferSize
361     endif
362 else
363     setenv MPI_BUFFER_SIZE $minBufferSize
364 endif
367 # CGAL library if available
368 # ~~~~~~~~~~~~~~~~~~~~~~~~~
369 if ( $?CGAL_LIB_DIR ) then
370     _foamAddLib $CGAL_LIB_DIR
371 endif
373 # Mesquite library if available
374 # ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
375 if ( $?MESQUITE_SYSTEM == 0 && -e $WM_THIRD_PARTY_DIR/packages/mesquite-2.1.2 ) then
376     _foamSource $WM_THIRD_PARTY_DIR/packages/mesquite-2.1.2/platforms/$WM_OPTIONS/etc/mesquite-2.1.2.csh
377 endif
379 # Metis library if available
380 # ~~~~~~~~~~~~~~~~~~~~~~~~~~
381 if ( $?METIS_SYSTEM == 0 && -e $WM_THIRD_PARTY_DIR/packages/metis-5.0pre2 ) then
382     _foamSource $WM_THIRD_PARTY_DIR/packages/metis-5.0pre2/platforms/$WM_OPTIONS/etc/metis-5.0pre2.csh
383 endif
385 # ParMetis library if available
386 # ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
387 if ( $?PARMETIS_SYSTEM == 0 && -e $WM_THIRD_PARTY_DIR/packages/ParMetis-3.1.1 ) then
388     _foamSource $WM_THIRD_PARTY_DIR/packages/ParMetis-3.1.1/platforms/$WM_OPTIONS/etc/ParMetis-3.1.1.csh
389 endif
391 # ParMGridGen library if available
392 # ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
393 if ( $?PARMGRIDGEN_SYSTEM == 0 && -e $WM_THIRD_PARTY_DIR/packages/ParMGridGen-1.0 ) then
394     _foamSource $WM_THIRD_PARTY_DIR/packages/ParMGridGen-1.0/platforms/$WM_OPTIONS/etc/ParMGridGen-1.0.csh
395 endif
397 # Load Libccmio library 
398 # ~~~~~~~~~~~~~~~~~~~~~
399 if ( $?LIBCCMIO_SYSTEM == 0 && -e $WM_THIRD_PARTY_DIR/packages/libccmio-2.6.1 ) then
400     _foamSource $WM_THIRD_PARTY_DIR/packages/libccmio-2.6.1/platforms/$WM_OPTIONS/etc/libccmio-2.6.1.csh
401 endif
404 # Scotch library if available
405 # ~~~~~~~~~~~~~~~~~~~~~~~~~~~
406 if ( $?SCOTCH_SYSTEM == 0 && -e $WM_THIRD_PARTY_DIR/packages/scotch-5.1.10b ) then
407     _foamSource $WM_THIRD_PARTY_DIR/packages/scotch-5.1.10b/platforms/$WM_OPTIONS/etc/scotch-5.1.10b.csh
408 endif
410 # Switch on the hoard memory allocator if available
411 # ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
412 #if ( -f $FOAM_LIBBIN/libhoard.so ) then
413 #    setenv LD_PRELOAD $FOAM_LIBBIN/libhoard.so:${LD_PRELOAD}
414 #endif
416 # Third party packages
418 # cmake
419 # ~~~~~
420 if ( $?CMAKE_SYSTEM == 0 && -e "$WM_THIRD_PARTY_DIR"/packages/cmake-2.8.3 ) then
421     _foamSource $WM_THIRD_PARTY_DIR/packages/cmake-2.8.3/platforms/$WM_OPTIONS/etc/cmake-2.8.3.csh
422 endif
424 # Python
425 # ~~~~~
426 if ( $?PYTHON_SYSTEM == 0 && -e "$WM_THIRD_PARTY_DIR"/packages/Python-2.7 ) then
427     _foamSource $WM_THIRD_PARTY_DIR/packages/Python-2.7/platforms/$WM_OPTIONS/etc/Python-2.7.csh
428 endif
430 # QT
431 # ~~~~~
432 if ( $?QT_SYSTEM == 0 && -e "$WM_THIRD_PARTY_DIR"/packages/qt-everywhere-opensource-src-4.7.0 )then
433     _foamSource $WM_THIRD_PARTY_DIR/packages/qt-everywhere-opensource-src-4.7.0/platforms/$WM_OPTIONS/etc/qt-everywhere-opensource-src-4.7.0.csh
434 endif
436 # PARAVIEW
437 # ~~~~~
438 if ( $?PARAVIEW_SYSTEM == 0 && -e "$WM_THIRD_PARTY_DIR"/packages/ParaView-3.8.1 ) then
439     _foamSource $WM_THIRD_PARTY_DIR/packages/ParaView-3.8.1/platforms/$WM_OPTIONS/etc/ParaView-3.8.1.csh
440 endif
442 if ( $WM_ARCH == "darwinIntel" ) then
443     setenv DYLD_LIBRARY_PATH ${LD_LIBRARY_PATH}
444 endif
446 # cleanup environment:
447 # ~~~~~~~~~~~~~~~~~~~~
448 unalias _foamAddPath
449 unalias _foamAddLib
450 unset minBufferSize
452 # -----------------------------------------------------------------------------