1 #----------------------------------*-sh-*--------------------------------------
3 # \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
5 # \\ / A nd | Copyright (C) 2011 OpenFOAM Foundation
7 #------------------------------------------------------------------------------
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
13 # the Free Software Foundation, either version 3 of the License, or
14 # (at your 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
21 # You should have received a copy of the GNU General Public License
22 # along with OpenFOAM. If not, see <http://www.gnu.org/licenses/>.
25 # etc/config/settings.csh
28 # Startup file for OpenFOAM
29 # Sourced from OpenFOAM-<VERSION>/etc/cshrc
31 #------------------------------------------------------------------------------
34 alias _foamAddPath 'setenv PATH \!*\:${PATH}'
35 # prefix to LD_LIBRARY_PATH
36 alias _foamAddLib 'setenv LD_LIBRARY_PATH \!*\:${LD_LIBRARY_PATH}'
38 alias _foamAddMan 'setenv MANPATH \!*\:${MANPATH}'
40 #------------------------------------------------------------------------------
41 # Set environment variables according to system type
42 setenv WM_ARCH `uname -s`
53 switch ($WM_ARCH_OPTION)
55 setenv WM_COMPILER_ARCH 64
58 setenv WM_CFLAGS '-m32 -fPIC'
59 setenv WM_CXXFLAGS '-m32 -fPIC'
60 setenv WM_LDFLAGS '-m32'
64 setenv WM_ARCH linux64
65 setenv WM_COMPILER_LIB_ARCH 64
68 setenv WM_CFLAGS '-m64 -fPIC'
69 setenv WM_CXXFLAGS '-m64 -fPIC'
70 setenv WM_LDFLAGS '-m64'
74 echo "Unknown WM_ARCH_OPTION '$WM_ARCH_OPTION', should be 32 or 64"
81 setenv WM_ARCH linuxIA64
82 setenv WM_COMPILER I64
86 setenv WM_ARCH SiCortex64
88 setenv WM_COMPILER_LIB_ARCH 64
91 setenv WM_CFLAGS '-mabi=64 -fPIC'
92 setenv WM_CXXFLAGS '-mabi=64 -fPIC'
93 setenv WM_LDFLAGS '-mabi=64 -G0'
97 setenv WM_ARCH linuxPPC64
98 setenv WM_COMPILER_LIB_ARCH 64
101 setenv WM_CFLAGS '-m64 -fPIC'
102 setenv WM_CXXFLAGS '-m64 -fPIC'
103 setenv WM_LDFLAGS '-m64'
107 echo Unknown processor type `uname -m` for Linux
114 setenv WM_ARCH SunOS64
115 setenv WM_MPLIB FJMPI
116 setenv WM_COMPILER_LIB_ARCH 64
119 setenv WM_CFLAGS '-mabi=64 -fPIC'
120 setenv WM_CXXFLAGS '-mabi=64 -fPIC'
121 setenv WM_LDFLAGS '-mabi=64 -G0'
126 echo "Your '$WM_ARCH' operating system is not supported by this release"
127 echo "of OpenFOAM. For further assistance, please contact www.OpenFOAM.org"
134 #------------------------------------------------------------------------------
136 # location of the jobControl directory
137 setenv FOAM_JOB_DIR $WM_PROJECT_INST_DIR/jobControl
139 # wmake configuration
140 setenv WM_DIR $WM_PROJECT_DIR/wmake
141 setenv WM_LINK_LANGUAGE c++
142 setenv WM_OPTIONS $WM_ARCH$WM_COMPILER$WM_PRECISION_OPTION$WM_COMPILE_OPTION
144 # base executables/libraries
145 setenv FOAM_APPBIN $WM_PROJECT_DIR/platforms/$WM_OPTIONS/bin
146 setenv FOAM_LIBBIN $WM_PROJECT_DIR/platforms/$WM_OPTIONS/lib
148 # external (ThirdParty) libraries
149 setenv FOAM_EXT_LIBBIN $WM_THIRD_PARTY_DIR/platforms/$WM_OPTIONS/lib
151 # shared site executables/libraries
152 # similar naming convention as ~OpenFOAM expansion
153 if ( $?WM_PROJECT_SITE ) then
154 setenv FOAM_SITE_APPBIN $WM_PROJECT_SITE/$WM_PROJECT_VERSION/platforms/$WM_OPTIONS/bin
155 setenv FOAM_SITE_LIBBIN $WM_PROJECT_SITE/$WM_PROJECT_VERSION/platforms/$WM_OPTIONS/lib
157 setenv FOAM_SITE_APPBIN $WM_PROJECT_INST_DIR/site/$WM_PROJECT_VERSION/platforms/$WM_OPTIONS/bin
158 setenv FOAM_SITE_LIBBIN $WM_PROJECT_INST_DIR/site/$WM_PROJECT_VERSION/platforms/$WM_OPTIONS/lib
161 # user executables/libraries
162 setenv FOAM_USER_APPBIN $WM_PROJECT_USER_DIR/platforms/$WM_OPTIONS/bin
163 setenv FOAM_USER_LIBBIN $WM_PROJECT_USER_DIR/platforms/$WM_OPTIONS/lib
165 # dynamicCode templates
166 # - default location is the "~OpenFOAM/codeTemplates/dynamicCode" expansion
167 # setenv FOAM_CODE_TEMPLATES $WM_PROJECT_DIR/etc/codeTemplates/dynamicCode
170 setenv FOAM_APP $WM_PROJECT_DIR/applications
171 setenv FOAM_SRC $WM_PROJECT_DIR/src
172 setenv FOAM_TUTORIALS $WM_PROJECT_DIR/tutorials
173 setenv FOAM_UTILITIES $FOAM_APP/utilities
174 setenv FOAM_SOLVERS $FOAM_APP/solvers
175 setenv FOAM_RUN $WM_PROJECT_USER_DIR/run
177 # add wmake to the path - not required for runtime only environment
178 if ( -d "${WM_DIR}" ) setenv PATH ${WM_DIR}:${PATH}
179 # add OpenFOAM scripts to the path
180 setenv PATH ${WM_PROJECT_DIR}/bin:${PATH}
182 _foamAddPath ${FOAM_USER_APPBIN}:${FOAM_SITE_APPBIN}:${FOAM_APPBIN}
183 # Make sure to pick up dummy versions of external libraries last
184 _foamAddLib ${FOAM_USER_LIBBIN}:${FOAM_SITE_LIBBIN}:${FOAM_LIBBIN}:${FOAM_EXT_LIBBIN}:${FOAM_LIBBIN}/dummy
188 unset gcc_version gmp_version mpfr_version mpc_version
189 unsetenv MPFR_ARCH_PATH GMP_ARCH_PATH
192 # Location of compiler installation
193 # ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
194 if ( ! $?foamCompiler ) then
195 set foamCompiler=system
196 echo "Warning in $WM_PROJECT_DIR/etc/config/settings.csh:"
197 echo " foamCompiler not set, using '$foamCompiler'"
200 switch ("$foamCompiler")
203 switch ("$WM_COMPILER")
206 set gcc_version=gcc-4.4.3
207 set gmp_version=gmp-5.0.1
208 set mpfr_version=mpfr-2.4.2
212 set gcc_version=gcc-4.6.1
213 set gmp_version=gmp-5.0.1
214 set mpfr_version=mpfr-2.4.2
215 set mpc_version=mpc-0.8.1
219 set gcc_version=gcc-4.5.2
220 set gmp_version=gmp-5.0.1
221 set mpfr_version=mpfr-2.4.2
222 set mpc_version=mpc-0.8.1
226 set gcc_version=gcc-4.4.3
227 set gmp_version=gmp-5.0.1
228 set mpfr_version=mpfr-2.4.2
231 set gcc_version=gcc-4.3.3
232 set gmp_version=gmp-4.2.4
233 set mpfr_version=mpfr-2.4.1
236 # using clang - not gcc
238 setenv WM_CXX 'clang++'
239 #set clang_version=llvm-2.9
240 set clang_version=llvm-svn
244 echo "Warning in $WM_PROJECT_DIR/etc/config/settings.csh:"
245 echo " Unknown OpenFOAM compiler type '$WM_COMPILER'"
246 echo " Please check your settings"
251 # optional configuration tweaks:
252 _foamSource `$WM_PROJECT_DIR/bin/foamEtcFile config/compiler.csh`
254 if ( $?gcc_version ) then
255 set gccDir=$WM_THIRD_PARTY_DIR/platforms/$WM_ARCH$WM_COMPILER_ARCH/$gcc_version
256 set gmpDir=$WM_THIRD_PARTY_DIR/platforms/$WM_ARCH$WM_COMPILER_ARCH/$gmp_version
257 set mpfrDir=$WM_THIRD_PARTY_DIR/platforms/$WM_ARCH$WM_COMPILER_ARCH/$mpfr_version
258 if ( $?mpc_version ) then
259 set mpcDir=$WM_THIRD_PARTY_DIR/platforms/$WM_ARCH$WM_COMPILER_ARCH/$mpc_version
262 # Check that the compiler directory can be found
263 if ( ! -d "$gccDir" ) then
265 echo "Warning in $WM_PROJECT_DIR/etc/config/settings.csh:"
266 echo " Cannot find $gccDir installation."
267 echo " Please install this compiler version or if you wish to use the system compiler,"
268 echo " change the 'foamCompiler' setting to 'system'"
272 _foamAddMan $gccDir/man
273 _foamAddPath $gccDir/bin
275 # add compiler libraries to run-time environment
276 # 64-bit needs lib64, but 32-bit needs lib (not lib32)
277 if ($WM_ARCH_OPTION == 64 && $?WM_COMPILER_LIB_ARCH) then
278 _foamAddLib $gccDir/lib$WM_COMPILER_LIB_ARCH
280 _foamAddLib $gccDir/lib
283 # add gmp/mpfr libraries to run-time environment
284 _foamAddLib $gmpDir/lib
285 _foamAddLib $mpfrDir/lib
287 # add mpc libraries (not need for older gcc) to run-time environment
288 if ( $?mpc_version ) then
289 _foamAddLib $mpcDir/lib
292 # used by boost/CGAL:
293 setenv MPFR_ARCH_PATH $mpfrDir
294 setenv GMP_ARCH_PATH $gmpDir
296 unset gcc_version gccDir
297 unset gmp_version gmpDir mpfr_version mpfrDir mpc_version mpcDir
299 if ( $?clang_version ) then
300 set clangDir=$WM_THIRD_PARTY_DIR/platforms/$WM_ARCH$WM_COMPILER_ARCH/$clang_version
302 # Check that the compiler directory can be found
303 if ( ! -d "$clangDir" ) then
305 echo "Warning in $WM_PROJECT_DIR/etc/config/settings.csh:"
306 echo " Cannot find $clangDir installation."
307 echo " Please install this compiler version or if you wish to use the system compiler,"
308 echo " change the 'foamCompiler' setting to 'system'"
312 _foamAddMan $clangDir/man
313 _foamAddPath $clangDir/bin
315 unset clang_version clangDir
320 # okay, use system compiler
324 echo "Warn: foamCompiler='$foamCompiler' is unsupported"
325 echo " treating as 'system' instead"
331 # add c++0x flags for external programs
333 if ( $?WM_CXXFLAGS ) then
334 switch ("$WM_COMPILER")
336 setenv WM_CXXFLAGS "$WM_CXXFLAGS -std=c++0x"
345 set boost_version=boost_1_45_0
346 set cgal_version=CGAL-3.8
348 setenv BOOST_ARCH_PATH $WM_THIRD_PARTY_DIR/platforms/$WM_ARCH$WM_COMPILER/$boost_version
349 setenv CGAL_ARCH_PATH $WM_THIRD_PARTY_DIR/platforms/$WM_ARCH$WM_COMPILER/$cgal_version
351 # enabled if CGAL is available
352 if ( -d "$CGAL_ARCH_PATH" ) then
353 if ( -d "$BOOST_ARCH_PATH" ) then
354 _foamAddLib $BOOST_ARCH_PATH/lib
356 unsetenv BOOST_ARCH_PATH
358 _foamAddLib $CGAL_ARCH_PATH/lib
360 unsetenv BOOST_ARCH_PATH CGAL_ARCH_PATH MPFR_ARCH_PATH GMP_ARCH_PATH
363 unset boost_version cgal_version
366 # Communications library
367 # ~~~~~~~~~~~~~~~~~~~~~~
369 unsetenv MPI_ARCH_PATH MPI_HOME FOAM_MPI_LIBBIN
373 setenv FOAM_MPI openmpi-1.5.3
374 # optional configuration tweaks:
375 _foamSource `$WM_PROJECT_DIR/bin/foamEtcFile config/openmpi.csh`
377 setenv MPI_ARCH_PATH $WM_THIRD_PARTY_DIR/platforms/$WM_ARCH$WM_COMPILER/$FOAM_MPI
379 # Tell OpenMPI where to find its install directory
380 setenv OPAL_PREFIX $MPI_ARCH_PATH
382 _foamAddPath $MPI_ARCH_PATH/bin
383 _foamAddLib $MPI_ARCH_PATH/lib
384 _foamAddMan $MPI_ARCH_PATH/man
388 # Use the system installed openmpi, get library directory via mpicc
389 setenv FOAM_MPI openmpi-system
391 # Set compilation flags here instead of in wmake/rules/../mplibSYSTEMOPENMPI
392 setenv PINC "`mpicc --showme:compile`"
393 setenv PLIBS "`mpicc --showme:link`"
394 set libDir=`echo "$PLIBS" | sed -e 's/.*-L\([^ ]*\).*/\1/'`
396 # Bit of a hack: strip off 'lib' and hope this is the path to openmpi
397 # include files and libraries.
398 setenv MPI_ARCH_PATH "${libDir:h}"
400 if ($?FOAM_VERBOSE && $?prompt) then
401 echo "Using system installed MPI:"
402 echo " compile flags : $PINC"
403 echo " link flags : $PLIBS"
404 echo " libmpi dir : $libDir"
412 setenv FOAM_MPI mpich2-1.1.1p1
413 setenv MPI_HOME $WM_THIRD_PARTY_DIR/$FOAM_MPI
414 setenv MPI_ARCH_PATH $WM_THIRD_PARTY_DIR/platforms/$WM_ARCH$WM_COMPILER/$FOAM_MPI
416 _foamAddPath $MPI_ARCH_PATH/bin
417 _foamAddLib $MPI_ARCH_PATH/lib
418 _foamAddMan $MPI_ARCH_PATH/share/man
422 setenv FOAM_MPI mpich-gm
423 setenv MPI_ARCH_PATH /opt/mpi
424 setenv MPICH_PATH $MPI_ARCH_PATH
425 setenv GM_LIB_PATH /opt/gm/lib64
427 _foamAddPath $MPI_ARCH_PATH/bin
428 _foamAddLib $MPI_ARCH_PATH/lib
429 _foamAddLib $GM_LIB_PATH
433 setenv FOAM_MPI hpmpi
434 setenv MPI_HOME /opt/hpmpi
435 setenv MPI_ARCH_PATH $MPI_HOME
437 _foamAddPath $MPI_ARCH_PATH/bin
441 _foamAddLib $MPI_ARCH_PATH/lib/linux_ia32
444 _foamAddLib $MPI_ARCH_PATH/lib/linux_amd64
447 _foamAddLib $MPI_ARCH_PATH/lib/linux_ia64
450 echo Unknown processor type `uname -m` for Linux
456 setenv FOAM_MPI gamma
457 setenv MPI_ARCH_PATH /usr
462 setenv MPI_ARCH_PATH /opt/mpi
466 setenv FOAM_MPI fjmpi
467 setenv MPI_ARCH_PATH /opt/FJSVmpi2
469 _foamAddPath $MPI_ARCH_PATH/bin
470 _foamAddLib $MPI_ARCH_PATH/lib/sparcv9
471 _foamAddLib /opt/FSUNf90/lib/sparcv9
472 _foamAddLib /opt/FJSVpnidt/lib
476 setenv FOAM_MPI qsmpi
477 setenv MPI_ARCH_PATH /usr/lib/mpi
479 _foamAddPath $MPI_ARCH_PATH/bin
480 _foamAddLib $MPI_ARCH_PATH/lib
484 setenv FOAM_MPI dummy
489 # add (non-dummy) MPI implementation
490 # dummy MPI already added to LD_LIBRARY_PATH and has no external libraries
491 if ( "$FOAM_MPI" != dummy ) then
492 _foamAddLib ${FOAM_LIBBIN}/${FOAM_MPI}:${FOAM_EXT_LIBBIN}/${FOAM_MPI}
497 # Set the minimum MPI buffer size (used by all platforms except SGI MPI)
498 # ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
499 if ( ! $?minBufferSize ) set minBufferSize=20000000
501 if ( $?MPI_BUFFER_SIZE ) then
502 if ( $MPI_BUFFER_SIZE < $minBufferSize ) then
503 setenv MPI_BUFFER_SIZE $minBufferSize
506 setenv MPI_BUFFER_SIZE $minBufferSize
510 # cleanup environment:
511 # ~~~~~~~~~~~~~~~~~~~~
512 unalias _foamAddPath _foamAddLib _foamAddMan
513 unset foamCompiler minBufferSize
515 # ----------------------------------------------------------------- end-of-file