Skip to content

Commit

Permalink
Merge pull request #140 from gerlero/deps
Browse files Browse the repository at this point in the history
Improve handling of dependencies
  • Loading branch information
gerlero authored May 24, 2023
2 parents 6201e80 + 3ba2e05 commit 37e69d8
Show file tree
Hide file tree
Showing 2 changed files with 26 additions and 15 deletions.
2 changes: 1 addition & 1 deletion Brewfile
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,9 @@ tap "gerlero/openfoam"

# Required dependencies
brew "open-mpi"
brew "libomp"

# Optional dependencies (enabled by default)
brew "libomp"
brew "boost"
brew "fftw"
brew "kahip"
Expand Down
39 changes: 25 additions & 14 deletions configure.sh
Original file line number Diff line number Diff line change
Expand Up @@ -11,12 +11,22 @@ bin/tools/foamConfigurePaths \
-scotch-path $PWD/usr/opt/scotch-no-pthread


OPENMPI_PATH="$PWD/usr/opt/open-mpi"
GMP_PATH="$PWD/usr/opt/gmp"
MPFR_PATH="$PWD/usr/opt/mpfr"

sed -i '' "s|\# export GMP_ARCH_PATH=...|export GMP_ARCH_PATH=\"$GMP_PATH\"|" etc/config.sh/CGAL
sed -i '' "s|\# setenv GMP_ARCH_PATH ...|setenv GMP_ARCH_PATH \"$GMP_PATH\"|" etc/config.csh/CGAL

sed -i '' "s|\# export MPFR_ARCH_PATH=...|export MPFR_ARCH_PATH=\"$MPFR_PATH\"|" etc/config.sh/CGAL
sed -i '' "s|\# setenv MPFR_ARCH_PATH ...|setenv MPFR_ARCH_PATH \"$MPFR_PATH\"|" etc/config.csh/CGAL


MPI_PATH="$PWD/usr/opt/open-mpi"
BASH_PATH="$PWD/usr/opt/bash"

PATH_EXTRA="$BASH_PATH/bin:$OPENMPI_PATH/bin"
MANPATH_EXTRA="$BASH_PATH/share/man:$OPENMPI_PATH/share/man"
INFOPATH_EXTRA="$BASH_PATH/share/info:$OPENMPI_PATH/share/info"
PATH_EXTRA="$BASH_PATH/bin:$MPI_PATH/bin"
MANPATH_EXTRA="$BASH_PATH/share/man:$MPI_PATH/share/man"
INFOPATH_EXTRA="$BASH_PATH/share/info:$MPI_PATH/share/info"

echo "export PATH=\"$PATH_EXTRA\${PATH+:\$PATH}\"" >> etc/prefs.sh
echo "setenv PATH $PATH_EXTRA:\$PATH" >> etc/prefs.csh
Expand All @@ -29,17 +39,18 @@ echo "setenv INFOPATH $INFOPATH_EXTRA\`[ \${?INFOPATH} == 1 ] && echo \":\${INFO


LIBOMP_PATH="$PWD/usr/opt/libomp"
GMP_PATH="$PWD/usr/opt/gmp"
MPFR_PATH="$PWD/usr/opt/mpfr"

CPATH_EXTRA="$LIBOMP_PATH/include:$GMP_PATH/include:$MPFR_PATH/include"
LIBRARY_PATH_EXTRA="$LIBOMP_PATH/lib:$GMP_PATH/lib:$MPFR_PATH/lib"

echo "export CPATH=\"$CPATH_EXTRA\${CPATH+:\$CPATH}\"" >> etc/prefs.sh
echo "setenv CPATH \"$CPATH_EXTRA\`[ \${?CPATH} == 1 ] && echo \":\${CPATH}\"\`\"" >> etc/prefs.csh

echo "export LIBRARY_PATH=\"$LIBRARY_PATH_EXTRA\${LIBRARY_PATH+:\$LIBRARY_PATH}\"" >> etc/prefs.sh
echo "setenv LIBRARY_PATH \"$LIBRARY_PATH_EXTRA\`[ \${?LIBRARY_PATH} == 1 ] && echo \":\${LIBRARY_PATH}\"\`\"" >> etc/prefs.csh
if [ -f "$LIBOMP_PATH/include/omp.h" ]; then
echo "export CPATH=\"$LIBOMP_PATH/include\${CPATH+:\$CPATH}\"" >> etc/prefs.sh
echo "setenv CPATH \"$LIBOMP_PATH/include\`[ \${?CPATH} == 1 ] && echo \":\${CPATH}\"\`\"" >> etc/prefs.csh

echo "export LIBRARY_PATH=\"$LIBOMP_PATH/lib\${LIBRARY_PATH+:\$LIBRARY_PATH}\"" >> etc/prefs.sh
echo "setenv LIBRARY_PATH \"$LIBOMP_PATH/lib\`[ \${?LIBRARY_PATH} == 1 ] && echo \":\${LIBRARY_PATH}\"\`\"" >> etc/prefs.csh
else
echo "OpenMP not found at $LIBOMP_PATH. Disabling OpenMP support" >&2
echo "export WM_COMPILE_CONTROL=\"\$WM_COMPILE_CONTROL ~openmp\"" >> etc/prefs.sh
echo "setenv WM_COMPILE_CONTROL \"\$WM_COMPILE_CONTROL ~openmp\"" >> etc/prefs.csh
fi


# Workaround for https://develop.openfoam.com/Development/openfoam/-/issues/1664
Expand Down

0 comments on commit 37e69d8

Please sign in to comment.