2024-09-04 12:10:02 +00:00
|
|
|
#!/usr/bin/env bash
|
|
|
|
|
|
|
|
ECCODES_VERSION_STR="@eccodes_VERSION_STR@"
|
|
|
|
ECCODES_MAJOR_VERSION=@eccodes_VERSION_MAJOR@
|
|
|
|
ECCODES_MINOR_VERSION=@eccodes_VERSION_MINOR@
|
|
|
|
ECCODES_PATCH_VERSION=@eccodes_VERSION_PATCH@
|
2024-09-04 12:38:12 +00:00
|
|
|
# ECCODES_VERSION="$ECCODES_MAJOR_VERSION.$ECCODES_MINOR_VERSION.$ECCODES_PATCH_VERSION"
|
2024-09-04 12:10:02 +00:00
|
|
|
|
|
|
|
ECCODES_GIT_SHA1="@eccodes_GIT_SHA1@"
|
2024-10-07 11:12:18 +00:00
|
|
|
if [ "x$ECCODES_GIT_SHA1" = "x" ]; then
|
|
|
|
ECCODES_GIT_SHA1="unknown"
|
|
|
|
fi
|
2024-09-04 12:10:02 +00:00
|
|
|
|
|
|
|
#################################################################
|
|
|
|
# Commands
|
|
|
|
#################################################################
|
|
|
|
usage()
|
|
|
|
{
|
|
|
|
echo "Usage: $0 [--version] [--info] [--git]"
|
|
|
|
exit $1
|
|
|
|
}
|
|
|
|
|
|
|
|
version()
|
|
|
|
{
|
2024-09-04 12:38:12 +00:00
|
|
|
echo "${ECCODES_VERSION_STR}"
|
2024-09-04 12:10:02 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
print_feature()
|
|
|
|
{
|
|
|
|
if [ -z "$1" ]; then
|
|
|
|
echo "OFF"
|
|
|
|
elif [[ $1 =~ (true|TRUE|ON|1) ]]; then
|
|
|
|
echo "ON"
|
|
|
|
else
|
|
|
|
echo "OFF"
|
|
|
|
fi
|
|
|
|
}
|
|
|
|
|
2024-09-04 14:09:09 +00:00
|
|
|
build_type="@CMAKE_BUILD_TYPE@"
|
2024-09-04 12:10:02 +00:00
|
|
|
info()
|
|
|
|
{
|
2024-09-06 13:00:40 +00:00
|
|
|
echo "ecCodes version ${ECCODES_VERSION_STR}, git-sha1 ${ECCODES_GIT_SHA1}"
|
2024-09-04 12:10:02 +00:00
|
|
|
echo ""
|
|
|
|
echo "Build:"
|
|
|
|
echo " build type : @CMAKE_BUILD_TYPE@"
|
|
|
|
echo " timestamp : @EC_BUILD_TIMESTAMP@"
|
|
|
|
echo " op. system : @CMAKE_SYSTEM@ (@EC_OS_NAME@.@EC_OS_BITS@)"
|
|
|
|
echo " processor : @CMAKE_SYSTEM_PROCESSOR@"
|
|
|
|
echo " sources : @PROJECT_SOURCE_DIR@"
|
|
|
|
echo " c++ compiler : @CMAKE_CXX_COMPILER_ID@ @CMAKE_CXX_COMPILER_VERSION@"
|
2024-09-04 14:09:09 +00:00
|
|
|
# Add the most common build type
|
|
|
|
if [ $build_type = "RelWithDebInfo" ]; then
|
|
|
|
echo " flags : @CMAKE_CXX_FLAGS_RELWITHDEBINFO@"
|
|
|
|
else
|
|
|
|
echo " flags : @CMAKE_CXX_FLAGS@"
|
|
|
|
fi
|
2024-09-04 12:10:02 +00:00
|
|
|
# echo " fortran compiler: @CMAKE_Fortran_COMPILER_ID@ @CMAKE_Fortran_COMPILER_VERSION@"
|
|
|
|
# echo " flags : @ECCODES_Fortran_FLAGS@"
|
|
|
|
echo ""
|
|
|
|
echo "Features:"
|
2024-09-06 13:00:40 +00:00
|
|
|
echo " FORTRAN : $(print_feature @HAVE_FORTRAN@)"
|
2024-09-05 13:46:32 +00:00
|
|
|
echo " AEC : $(print_feature @HAVE_AEC@)"
|
|
|
|
echo " MEMFS : $(print_feature @HAVE_MEMFS@)"
|
|
|
|
echo " ECCODES_THREADS : $(print_feature @GRIB_PTHREADS@)"
|
|
|
|
echo " ECCODES_OMP_THREADS : $(print_feature @GRIB_OMP_THREADS@)"
|
|
|
|
echo " JPG : $(print_feature @HAVE_JPEG@)"
|
|
|
|
echo " PNG : $(print_feature @HAVE_PNG@)"
|
|
|
|
echo " NETCDF : $(print_feature @HAVE_NETCDF@)"
|
2024-09-04 12:10:02 +00:00
|
|
|
echo ""
|
|
|
|
# echo "Dependencies: "
|
2024-09-04 12:38:12 +00:00
|
|
|
# if [ -n "@ECCODES_HAVE_ECKIT@" ]; then
|
2024-09-04 12:10:02 +00:00
|
|
|
# echo " eckit version (@eckit_VERSION@), git-sha1 $(short_gitsha1 @eckit_GIT_SHA1@)"
|
|
|
|
# else
|
|
|
|
# echo " None"
|
|
|
|
# fi
|
|
|
|
}
|
|
|
|
|
|
|
|
gitsha1()
|
|
|
|
{
|
|
|
|
echo "${ECCODES_GIT_SHA1}"
|
|
|
|
}
|
|
|
|
|
|
|
|
short_gitsha1()
|
|
|
|
{
|
|
|
|
if [ -z "$1" ]; then
|
|
|
|
echo "unknown"
|
|
|
|
else
|
|
|
|
echo $1 | head -c 13
|
|
|
|
fi
|
|
|
|
}
|
|
|
|
|
|
|
|
#################################################################
|
|
|
|
# Parse command-line
|
|
|
|
#################################################################
|
|
|
|
|
|
|
|
if test $# -eq 0; then
|
2024-09-04 12:38:12 +00:00
|
|
|
info
|
|
|
|
# usage 1
|
2024-09-04 12:10:02 +00:00
|
|
|
fi
|
|
|
|
|
|
|
|
while test $# -gt 0; do
|
|
|
|
|
|
|
|
# Split --option=value in $opt="--option" and $val="value"
|
|
|
|
|
|
|
|
opt=""
|
|
|
|
val=""
|
|
|
|
|
|
|
|
case "$1" in
|
|
|
|
--*=*)
|
|
|
|
opt=`echo "$1" | sed 's/=.*//'`
|
|
|
|
val=`echo "$1" | sed 's/--[_a-zA-Z0-9]*=//'`
|
|
|
|
;;
|
|
|
|
--*)
|
|
|
|
opt=$1
|
|
|
|
;;
|
|
|
|
*)
|
|
|
|
break
|
|
|
|
;;
|
|
|
|
esac
|
|
|
|
|
|
|
|
# Parse options
|
|
|
|
case "$opt" in
|
|
|
|
--version)
|
|
|
|
version
|
|
|
|
;;
|
|
|
|
--git)
|
|
|
|
gitsha1
|
|
|
|
;;
|
|
|
|
--info)
|
|
|
|
info
|
|
|
|
;;
|
|
|
|
--)
|
|
|
|
shift
|
|
|
|
break
|
|
|
|
;;
|
|
|
|
*)
|
|
|
|
echo "unknown option: $opt"
|
|
|
|
usage 1
|
|
|
|
;;
|
|
|
|
esac
|
|
|
|
shift
|
|
|
|
done
|