Commit fcf4c5fb authored by Mark OLESEN's avatar Mark OLESEN
Browse files

ENH: wmake have_* script changes

- use local 'prefix' variable for easier override and more consistency
parent abf6d57a
......@@ -2,7 +2,7 @@
# ========= |
# \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
# \\ / O peration |
# \\ / A nd | Copyright (C) 2018 OpenCFD Ltd.
# \\ / A nd | Copyright (C) 2018-2019 OpenCFD Ltd.
# \\/ M anipulation |
#------------------------------------------------------------------------------
# License
......@@ -54,59 +54,53 @@ echo_adios2()
# -> HAVE_ADIOS2, ADIOS2_INC_DIR, ADIOS2_LIB_DIR
have_adios2()
{
local header library static label settings warn
local prefix header library static settings warn
# warn="==> skip adios2"
# Basic setup/checks
settings=$($WM_PROJECT_DIR/bin/foamEtcFile config.sh/ADIOS2) || {
[ -n "$warn" ] && echo "$warn (no config.sh/ADIOS2 settings)"
return 1
}
. $settings
if isNone "$ADIOS2_ARCH_PATH"
# Setup
if settings=$($WM_PROJECT_DIR/bin/foamEtcFile config.sh/ADIOS2)
then
[ -n "$warn" ] && echo "$warn (not available)"
return 1
. "$settings"
else
[ -n "$warn" ] && echo "$warn (no config.sh/ADIOS2 settings)"
return 2
fi
# Location
prefix="$ADIOS2_ARCH_PATH"
# Header/library names
header="adios2.h"
library="libadios2$extLibso"
if hasAbsdir "$ADIOS2_ARCH_PATH"
# ----------------------------------
if isNone "$prefix"
then
[ -n "$warn" ] && echo "$warn (disabled)"
return 1
elif hasAbsdir "$prefix"
then
header=$(findFirstFile $ADIOS2_ARCH_PATH/include/$header)
header=$(findFirstFile "$prefix/include/$header")
library=$(findFirstFile \
"$(thirdExtLib $library)" \
$ADIOS2_ARCH_PATH/lib/$library \
$ADIOS2_ARCH_PATH/lib$WM_COMPILER_LIB_ARCH/$library \
"$prefix/lib/$library" \
"$prefix/lib$WM_COMPILER_LIB_ARCH/$library" \
)
elif isSystem "$ADIOS2_ARCH_PATH"
elif isSystem "$prefix"
then
header=$(findFirstFile /usr/local/include/$header /usr/include/$header)
case "$header" in
/usr/local/*)
library=$(findFirstFile \
/usr/local/lib/$library \
/usr/local/lib$WM_COMPILER_LIB_ARCH/$library \
)
;;
*)
library=$(findFirstFile \
/usr/lib/$library \
/usr/lib$WM_COMPILER_LIB_ARCH/$library \
)
;;
esac
prefix=/usr
header=$(findFirstFile "/usr/local/include/$header" "/usr/include/$header")
case "$header" in (/usr/local/*) prefix=/usr/local ;; esac
library=$(findFirstFile \
"$prefix/lib/$library" \
"$prefix/lib$WM_COMPILER_LIB_ARCH/$library" \
)
else
unset header library
unset prefix header library
fi
# ----------------------------------
# Header found?
[ -n "$header" ] || {
......@@ -116,14 +110,15 @@ have_adios2()
# Library found?
[ -n "$library" ] || {
[ -n "$warn" ] && echo "$warn (missing library)"
[ -n "$warn" ] && echo "$warn (no library)"
return 2
}
header="${header%/*}" # Strip one-level (include/adios2/...)
header="${header%/*}" # Strip one-level (include/adios2/...)
# OK
export HAVE_ADIOS2=true
export ADIOS2_ARCH_PATH
export ADIOS2_ARCH_PATH="$prefix"
export ADIOS2_INC_DIR="${header%/*}" # Basename
export ADIOS2_LIB_DIR="${library%/*}" # Basename
}
......
......@@ -2,7 +2,7 @@
# ========= |
# \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
# \\ / O peration |
# \\ / A nd | Copyright (C) 2018 OpenCFD Ltd.
# \\ / A nd | Copyright (C) 2018-2019 OpenCFD Ltd.
# \\/ M anipulation |
#------------------------------------------------------------------------------
# License
......@@ -54,54 +54,46 @@ echo_boost()
# -> HAVE_BOOST, BOOST_INC_DIR, BOOST_LIB_DIR
have_boost()
{
local header library static label settings warn
local prefix header library static settings warn
# warn="==> skip boost"
# Basic setup/checks
if isNone "$BOOST_ARCH_PATH"
then
[ -n "$warn" ] && echo "$warn (not available)"
return 1
fi
# Setup - from the current environment
# Location
prefix="$BOOST_ARCH_PATH"
# Header/library names
header="boost/version.hpp"
library="libboost_system$extLibso"
if hasAbsdir "$BOOST_ARCH_PATH"
# ----------------------------------
if isNone "$prefix"
then
[ -n "$warn" ] && echo "$warn (disabled)"
return 1
elif hasAbsdir "$prefix"
then
header=$(findFirstFile $BOOST_ARCH_PATH/include/$header)
header=$(findFirstFile "$prefix/include/$header")
library=$(findFirstFile \
"$(thirdExtLib $library)" \
$BOOST_ARCH_PATH/lib/$library \
$BOOST_ARCH_PATH/lib$WM_COMPILER_LIB_ARCH/$library \
"$prefix/lib/$library" \
"$prefix/lib$WM_COMPILER_LIB_ARCH/$library" \
)
elif isSystem "$BOOST_ARCH_PATH"
elif isSystem "$prefix"
then
header=$(findFirstFile /usr/local/include/$header /usr/include/$header)
case "$header" in
/usr/local/*)
library=$(findFirstFile \
/usr/local/lib/$library \
/usr/local/lib$WM_COMPILER_LIB_ARCH/$library \
)
;;
*)
library=$(findFirstFile \
/usr/lib/$library \
/usr/lib$WM_COMPILER_LIB_ARCH/$library \
)
;;
esac
prefix=/usr
header=$(findFirstFile "/usr/local/include/$header" "/usr/include/$header")
case "$header" in (/usr/local/*) prefix=/usr/local ;; esac
library=$(findFirstFile \
"$prefix/lib/$library" \
"$prefix/lib$WM_COMPILER_LIB_ARCH/$library" \
)
else
unset header library
unset prefix header library
fi
# ----------------------------------
# Header found?
[ -n "$header" ] || {
......@@ -111,14 +103,16 @@ have_boost()
# Library found?
[ -n "$library" ] || {
[ -n "$warn" ] && echo "$warn (missing library)"
[ -n "$warn" ] && echo "$warn (no library)"
return 2
}
header="${header%/*}" # Strip one-level (include/boost/...)
header="${header%/*}" # Strip one-level (include/boost/...)
# OK
export HAVE_BOOST=true
export BOOST_ARCH_PATH
export BOOST_ARCH_PATH="$prefix"
export BOOST_INC_DIR="${header%/*}" # Basename
export BOOST_LIB_DIR="${library%/*}" # Basename
}
......
......@@ -2,7 +2,7 @@
# ========= |
# \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
# \\ / O peration |
# \\ / A nd | Copyright (C) 2018 OpenCFD Ltd.
# \\ / A nd | Copyright (C) 2018-2019 OpenCFD Ltd.
# \\/ M anipulation |
#------------------------------------------------------------------------------
# License
......@@ -53,42 +53,44 @@ echo_ccmio()
# -> HAVE_CCMIO, CCMIO_INC_DIR, CCMIO_LIB_DIR
have_ccmio()
{
local header library static label settings warn good
local prefix header library static settings warn
warn="==> skip ccmio"
# Basic setup/checks
settings=$($WM_PROJECT_DIR/bin/foamEtcFile config.sh/ccmio) || {
[ -n "$warn" ] && echo "$warn (no config.sh/ccmio settings)"
return 1
}
. $settings
if isNone "$CCMIO_ARCH_PATH"
# Setup
if settings=$($WM_PROJECT_DIR/bin/foamEtcFile config.sh/ccmio)
then
[ -n "$warn" ] && echo "$warn (not available)"
return 1
. "$settings"
else
[ -n "$warn" ] && echo "$warn (no config.sh/ccmio settings)"
return 2
fi
# Location
prefix="$CCMIO_ARCH_PATH"
# Header/library names.
# Link with static libccmio only (fewer issues)
#
header="libccmio/ccmio.h"
static="libccmio$extLiba"
if hasAbsdir "$CCMIO_ARCH_PATH"
# ----------------------------------
if isNone "$prefix"
then
[ -n "$warn" ] && echo "$warn (disabled)"
return 1
elif hasAbsdir "$prefix"
then
header=$(findFirstFile $CCMIO_ARCH_PATH/include/$header)
header=$(findFirstFile "$prefix/include/$header")
library=$(findFirstFile \
"$(thirdExtLib $library)" \
$CCMIO_ARCH_PATH/lib/$static \
$CCMIO_ARCH_PATH/lib$WM_COMPILER_LIB_ARCH/$static \
"$prefix/lib/$static" \
"$prefix/lib$WM_COMPILER_LIB_ARCH/$static" \
)
else
unset header library
unset prefix header library
fi
# ----------------------------------
# Header found?
[ -n "$header" ] || {
......@@ -98,16 +100,17 @@ have_ccmio()
# Library found?
[ -n "$library" ] || {
[ -n "$warn" ] && echo "$warn (missing library)"
[ -n "$warn" ] && echo "$warn (no library)"
return 2
}
header="${header%/*}" # Strip one-level (include/libccmio/...)
# The libccmio uses int32_t.
# The OpenFOAM adapter thus requires additional work for 64-bit labels.
# The OpenFOAM adapter was originally only designed for 'double'
local good
if [ "$WM_LABEL_SIZE" = 32 ]
then
if [ "$WM_PRECISION_OPTION" = DP ]
......@@ -124,8 +127,12 @@ have_ccmio()
return 1
fi
header="${header%/*}" # Strip one-level (include/libccmio/...)
# OK
export HAVE_CCMIO=true
export CCMIO_ARCH_PATH
export CCMIO_ARCH_PATH="$prefix"
export CCMIO_INC_DIR="${header%/*}" # Basename
export CCMIO_LIB_DIR="${library%/*}" # Basename
}
......
......@@ -2,7 +2,7 @@
# ========= |
# \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
# \\ / O peration |
# \\ / A nd | Copyright (C) 2018 OpenCFD Ltd.
# \\ / A nd | Copyright (C) 2018-2019 OpenCFD Ltd.
# \\/ M anipulation |
#------------------------------------------------------------------------------
# License
......@@ -54,54 +54,46 @@ echo_cgal()
# -> HAVE_CGAL, CGAL_INC_DIR, CGAL_LIB_DIR
have_cgal()
{
local header library static label settings warn
local prefix header library static settings warn
# warn="==> skip cgal"
# Basic setup/checks
if isNone "$CGAL_ARCH_PATH"
then
[ -n "$warn" ] && echo "$warn (not available)"
return 1
fi
# Setup - from the current environment
# Location
prefix="$CGAL_ARCH_PATH"
# Header/library names
header="CGAL/version.h"
library="libCGAL$extLibso"
if hasAbsdir "$CGAL_ARCH_PATH"
# ----------------------------------
if isNone "$prefix"
then
[ -n "$warn" ] && echo "$warn (disabled)"
return 1
elif hasAbsdir "$prefix"
then
header=$(findFirstFile $CGAL_ARCH_PATH/include/$header)
header=$(findFirstFile "$prefix/include/$header")
library=$(findFirstFile \
"$(thirdExtLib $library)" \
$CGAL_ARCH_PATH/lib/$library \
$CGAL_ARCH_PATH/lib$WM_COMPILER_LIB_ARCH/$library \
"$prefix/lib/$library" \
"$prefix/lib$WM_COMPILER_LIB_ARCH/$library" \
)
elif isSystem "$CGAL_ARCH_PATH"
elif isSystem "$prefix"
then
header=$(findFirstFile /usr/local/include/$header /usr/include/$header)
case "$header" in
/usr/local/*)
library=$(findFirstFile \
/usr/local/lib/$library \
/usr/local/lib$WM_COMPILER_LIB_ARCH/$library \
)
;;
*)
library=$(findFirstFile \
/usr/lib/$library \
/usr/lib$WM_COMPILER_LIB_ARCH/$library \
)
;;
esac
prefix=/usr
header=$(findFirstFile "/usr/local/include/$header" "/usr/include/$header")
case "$header" in (/usr/local/*) prefix=/usr/local ;; esac
library=$(findFirstFile \
"$prefix/lib/$library" \
"$prefix/lib$WM_COMPILER_LIB_ARCH/$library" \
)
else
unset header library
unset prefix header library
fi
# ----------------------------------
# Header found?
[ -n "$header" ] || {
......@@ -111,14 +103,15 @@ have_cgal()
# Library found?
[ -n "$library" ] || {
[ -n "$warn" ] && echo "$warn (missing library)"
[ -n "$warn" ] && echo "$warn (no library)"
return 2
}
header="${header%/*}" # Strip one-level (include/CGAL/...)
header="${header%/*}" # Strip one-level (include/CGAL/...)
# OK
export HAVE_CGAL=true
export CGAL_ARCH_PATH
export CGAL_ARCH_PATH="$prefix"
export CGAL_INC_DIR="${header%/*}" # Basename
export CGAL_LIB_DIR="${library%/*}" # Basename
}
......
......@@ -2,7 +2,7 @@
# ========= |
# \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
# \\ / O peration |
# \\ / A nd | Copyright (C) 2018 OpenCFD Ltd.
# \\ / A nd | Copyright (C) 2018-2019 OpenCFD Ltd.
# \\/ M anipulation |
#------------------------------------------------------------------------------
# License
......@@ -54,57 +54,49 @@ echo_fftw()
# -> HAVE_FFTW, FFTW_INC_DIR, FFTW_LIB_DIR
have_fftw()
{
local header library static label settings warn
local prefix header library static settings warn
# warn="==> skip fftw"
# Basic setup/checks
if isNone "$FFTW_ARCH_PATH"
then
[ -n "$warn" ] && echo "$warn (not available)"
return 1
fi
# Setup - from the current environment
# Location
prefix="$FFTW_ARCH_PATH"
# Header/library names
header="fftw3.h"
library="libfftw3$extLibso"
static="libfftw3$extLiba"
if hasAbsdir "$FFTW_ARCH_PATH"
# ----------------------------------
if isNone "$prefix"
then
[ -n "$warn" ] && echo "$warn (disabled)"
return 1
elif hasAbsdir "$prefix"
then
header=$(findFirstFile $FFTW_ARCH_PATH/include/$header)
header=$(findFirstFile "$prefix/include/$header")
library=$(findFirstFile \
"$(thirdExtLib $library)" \
$FFTW_ARCH_PATH/lib/$static \
$FFTW_ARCH_PATH/lib/$library \
$FFTW_ARCH_PATH/lib$WM_COMPILER_LIB_ARCH/$static \
$FFTW_ARCH_PATH/lib$WM_COMPILER_LIB_ARCH/$library \
"$prefix/lib/$static" \
"$prefix/lib/$library" \
"$prefix/lib$WM_COMPILER_LIB_ARCH/$static" \
"$prefix/lib$WM_COMPILER_LIB_ARCH/$library" \
)
elif isSystem "$FFTW_ARCH_PATH"
elif isSystem "$prefix"
then
header=$(findFirstFile /usr/local/include/$header /usr/include/$header)
case "$header" in
/usr/local/*)
library=$(findFirstFile \
/usr/local/lib/$library \
/usr/local/lib$WM_COMPILER_LIB_ARCH/$library \
)
;;
*)
library=$(findFirstFile \
/usr/lib/$library \
/usr/lib$WM_COMPILER_LIB_ARCH/$library \
)
;;
esac
prefix=/usr
header=$(findFirstFile "/usr/local/include/$header" "/usr/include/$header")
case "$header" in (/usr/local/*) prefix=/usr/local ;; esac
library=$(findFirstFile \
"$prefix/lib/$library" \
"$prefix/lib$WM_COMPILER_LIB_ARCH/$library" \
)
else
unset header library
unset prefix header library
fi
# ----------------------------------
# Header found?
[ -n "$header" ] || {
......@@ -114,12 +106,13 @@ have_fftw()
# Library found?
[ -n "$library" ] || {
[ -n "$warn" ] && echo "$warn (missing library)"
[ -n "$warn" ] && echo "$warn (no library)"
return 2
}
# OK
export HAVE_FFTW=true
export FFTW_ARCH_PATH
export FFTW_ARCH_PATH="$prefix"
export FFTW_INC_DIR="${header%/*}" # Basename
export FFTW_LIB_DIR="${library%/*}" # Basename
}
......
......@@ -2,7 +2,7 @@
# ========= |
# \\ / F ield | OpenFOAM: The Open Source CFD Toolbox
# \\ / O peration |
# \\ / A nd | Copyright (C) 2018 OpenCFD Ltd.
# \\ / A nd | Copyright (C) 2018-2019 OpenCFD Ltd.
# \\/ M anipulation |
#------------------------------------------------------------------------------
# License
......@@ -54,62 +54,56 @@ echo_hypre()
# -> HAVE_HYPRE, HYPRE_INC_DIR, HYPRE_LIB_DIR
have_hypre()
{
local header library static label settings warn
local prefix header library static settings warn
warn="==> skip hypre"
# Basic setup/checks. Prefer current environment value? (TDB)
# Setup - prefer current environment value? (TDB)
if [ ! -d "$HYPRE_ARCH_PATH" ]
then
settings=$($WM_PROJECT_DIR/bin/foamEtcFile config.sh/hypre) || {
if settings=$($WM_PROJECT_DIR/bin/foamEtcFile config.sh/hypre)
then
. "$settings"
else
[ -n "$warn" ] && echo "$warn (no config.sh/hypre settings)"
return 1
}
. $settings
fi
if isNone "$HYPRE_ARCH_PATH"
then
[ -n "$warn" ] && echo "$warn (not available)"
return 1
return 2
fi
fi
# Location
prefix="$HYPRE_ARCH_PATH"
# Header/library names
header="HYPRE.h"
library="libHYPRE$extLibso"
if hasAbsdir "$HYPRE_ARCH_PATH"
# ----------------------------------
if isNone "$prefix"
then
[ -n "$warn" ] && echo "$warn (disabled)"
return 1
elif hasAbsdir "$prefix"
then
header=$(findFirstFile $HYPRE_ARCH_PATH/include/$header)
header=$(findFirstFile "$prefix/include/$header")
library=$(findFirstFile \
"$(thirdExtLib $library)" \
$HYPRE_ARCH_PATH/lib/$library \
$HYPRE_ARCH_PATH/lib$WM_COMPILER_LIB_ARCH/$library \
"$prefix/lib/$library" \
"$prefix/lib$WM_COMPILER_LIB_ARCH/$library" \
)
elif isSystem "$HYPRE_ARCH_PATH"
elif isSystem "$prefix"
then
header=$(findFirstFile /usr/local/include/$header /usr/include/$header)
case "$header" in
/usr/local/*)
library=$(findFirstFile \
/usr/local/lib/$library \
/usr/local/lib$WM_COMPILER_LIB_ARCH/$library \
)
;;
*)
library=$(findFirstFile \
/usr/lib/$library \
/usr/lib$WM_COMPILER_LIB_ARCH/$library \
)
;;
esac
prefix=/usr
header=$(findFirstFile "/usr/local/include/$header" "/usr/include/$header")
case "$header" in (/usr/local/*) prefix=/usr/local ;; esac