diff --git a/HDF5Examples/C/H5D/test-pc.sh b/HDF5Examples/C/H5D/test-pc.sh new file mode 100755 index 00000000000..e0cda25152a --- /dev/null +++ b/HDF5Examples/C/H5D/test-pc.sh @@ -0,0 +1,221 @@ +#! /bin/sh +# +# Copyright by The HDF Group. +# All rights reserved. +# +# This file is part of HDF5. The full HDF5 copyright notice, including +# terms governing use, modification, and redistribution, is contained in +# the COPYING file, which can be found at the root of the source code +# distribution tree, or in https://www.hdfgroup.org/licenses. +# If you do not have access to either file, you may request a copy from +# help@hdfgroup.org. + +# This file is for use of h5cc created with the CMake process +# HDF5_HOME is expected to be set + +srcdir=.. +builddir=. +verbose=yes +nerrors=0 + +# HDF5 compile commands, assuming they are in your $PATH. +H5CC=$HDF5_HOME/bin/h5cc +LD_LIBRARY_PATH=$HDF5_HOME/lib +export LD_LIBRARY_PATH + +if ! test -f $H5CC; then + echo "Set paths for H5CC and LD_LIBRARY_PATH in test.sh" + echo "Set environment variable HDF5_HOME to the hdf5 install dir" + echo "h5cc was not found at $H5CC" + exit $EXIT_FAILURE +fi + +H5DUMP=`echo $H5CC | sed -e 's/\/[^/]*$/\/h5dump/'`; +H5_LIBVER=$($H5CC -showconfig | grep -i "HDF5 Version:" | sed 's/^.* //g' | sed 's/[-].*//g') +H5_APIVER=$($H5CC -showconfig | grep -i "Default API mapping:" | sed 's/^.* //g' | sed 's/v//g' | sed 's/1/1_/') + +H5_MAJORVER=$(echo $H5_LIBVER | cut -f1 -d'.' | sed -E 's/\./_/g') +H5_MINORVER=$(echo $H5_LIBVER | cut -f2 -d'.' | sed -E 's/\./_/g') +H5_RELEASEVER=$(echo $H5_LIBVER | cut -f3 -d'.' | sed -E 's/\./_/g') +H5_LIBVER_DIR=$H5_MAJORVER$H5_MINORVER + +# Shell commands used in Makefiles +RM="rm -rf" +DIFF="diff -c" +CMP="cmp -s" +GREP='grep' +CP="cp -p" # Use -p to preserve mode,ownership,timestamps +DIRNAME='dirname' +LS='ls' +AWK='awk' + +# setup plugin path +ENVCMD="env HDF5_PLUGIN_PATH=$LD_LIBRARY_PATH/plugin" + +TESTDIR=$builddir + + +case `echo "testing\c"; echo 1,2,3`,`echo -n testing; echo 1,2,3` in + *c*,-n*) ECHO_N= ECHO_C=' +' ;; + *c*,* ) ECHO_N=-n ECHO_C= ;; + *) ECHO_N= ECHO_C='\c' ;; +esac +ECHO_N="echo $ECHO_N" + + +exout() { + $* +} + +dumpout() { + $H5DUMP $* +} + +# compare current version, required version. +# returns if cur_ver < req_ver is true. +version_compare() { + version_lt=0 + if [ ! "$(printf '%s\n' "$1" "$2" | sort -V | head -n1)" = "$2" ]; then + version_lt=1 + fi +} + + +topics="alloc checksum chunk compact extern fillval gzip hyper \ +rdwr shuffle szip unlimadd unlimgzip unlimmod" +topics18="" + +version_compare "$H5_LIBVER" "1.8.0" +# check if HDF5 version is < 1.8.0 +if [ "$version_lt" = 1 ]; then + dir16="/16" +else + dir16="" + topics18="nbit sofloat soint transform" +fi + +return_val=0 + +#Remove external data file from h5ex_d_extern +rm -f h5ex_d_extern.data + +for topic in $topics +do + $H5CC $srcdir/h5ex_d_$topic.c -o h5ex_d_$topic +done + +for topic in $topics +do + fname=h5ex_d_$topic + $ECHO_N "Testing C/H5D/$fname...$ECHO_C" + exout .$dir16/$fname >tmp.test + status=$? + if test $status -eq 1 + then + echo " Unsupported feature" + status=0 + else + cmp -s tmp.test $srcdir/tfiles/16/$fname.tst + status=$? + if test $status -ne 0 + then + echo " FAILED!" + else + dumpout $fname.h5 >tmp.test + rm -f $fname.h5 + cmp -s tmp.test $srcdir/tfiles/16/$fname.ddl + status=$? + if test $status -ne 0 + then + echo " FAILED!" + else + echo " Passed" + fi + fi + return_val=`expr $status + $return_val` + fi +done + +#######Non-standard tests####### +USE_ALT="" +### Set default tfiles directory for tests +nbitdir="18" +version_compare "$H5_LIBVER" "1.8.23" +# check if HDF5 version is < 1.8.23 +if [ "$version_lt" = 1 ]; then + USE_ALT="22" +else +# check if HDF5 version is >= 1.10.0 and < 1.10.8 + version_compare "$H5_LIBVER" "1.10.0" + if [ "$version_lt" = 0 ]; then + version_compare "$H5_LIBVER" "1.10.8" + if [ "$version_lt" = 1 ]; then + USE_ALT="07" + nbitdir="110" + fi + fi +fi + +for topic in $topics18 +do + $H5CC $srcdir/h5ex_d_$topic.c -o h5ex_d_$topic +done + +for topic in $topics18 +do + fname=h5ex_d_$topic + $ECHO_N "Testing C/H5D/$fname...$ECHO_C" + exout ./$fname >tmp.test + status=$? + if test $status -eq 1 + then + echo " Unsupported feature" + status=0 + else + if [[ $fname == "h5ex_d_nbit" ]] + then + tdir=$nbitdir + if [[ $USE_ALT == "" ]] + then + ### set USE_ALT=07 if not set above + USE_ALT="07" + fi + else + tdir=18 + ### unset USE_ALT for the other topics + USE_ALT="" + fi + cmp -s tmp.test $srcdir/tfiles/18/$fname.tst + status=$? + if test $status -ne 0 + then + echo " FAILED!" + else + if [[ $fname == "h5ex_d_transform" ]] + then + targ="-n" + else + targ="" + fi + dumpout $targ $fname.h5 >tmp.test + rm -f $fname.h5 + cmp -s tmp.test $srcdir/tfiles/$tdir/$fname$USE_ALT.ddl + status=$? + if test $status -ne 0 + then + echo " FAILED!" + else + echo " Passed" + fi + fi + return_val=`expr $status + $return_val` + fi +done + + +#Remove external data file from h5ex_d_extern +rm -f h5ex_d_extern.data +rm -f tmp.test +echo "$return_val tests failed in C/H5D/" +exit $return_val diff --git a/HDF5Examples/C/H5G/test-pc.sh b/HDF5Examples/C/H5G/test-pc.sh new file mode 100755 index 00000000000..4c996a45a58 --- /dev/null +++ b/HDF5Examples/C/H5G/test-pc.sh @@ -0,0 +1,235 @@ +#! /bin/sh +# +# Copyright by The HDF Group. +# Copyright by the Board of Trustees of the University of Illinois. +# All rights reserved. +# +# This file is part of HDF5. The full HDF5 copyright notice, including +# terms governing use, modification, and redistribution, is contained in +# the COPYING file, which can be found at the root of the source code +# distribution tree, or in https://www.hdfgroup.org/licenses. +# If you do not have access to either file, you may request a copy from +# help@hdfgroup.org. + +# This file is for use of h5cc created with the CMake process +# HDF5_HOME is expected to be set + +srcdir=.. +builddir=. +verbose=yes +nerrors=0 + +# HDF5 compile commands, assuming they are in your $PATH. +H5CC=$HDF5_HOME/bin/h5cc +LD_LIBRARY_PATH=$HDF5_HOME/lib +export LD_LIBRARY_PATH + +if ! test -f $H5CC; then + echo "Set paths for H5CC and LD_LIBRARY_PATH in test.sh" + echo "Set environment variable HDF5_HOME to the hdf5 install dir" + echo "h5cc was not found at $H5CC" + exit $EXIT_FAILURE +fi + +H5DUMP=`echo $H5CC | sed -e 's/\/[^/]*$/\/h5dump/'`; +H5_LIBVER=$($H5CC -showconfig | grep -i "HDF5 Version:" | sed 's/^.* //g' | sed 's/[-].*//g') +H5_APIVER=$($H5CC -showconfig | grep -i "Default API mapping:" | sed 's/^.* //g' | sed 's/v//g' | sed 's/1/1_/') + +H5_MAJORVER=$(echo $H5_LIBVER | cut -f1 -d'.' | sed -E 's/\./_/g') +H5_MINORVER=$(echo $H5_LIBVER | cut -f2 -d'.' | sed -E 's/\./_/g') +H5_RELEASEVER=$(echo $H5_LIBVER | cut -f3 -d'.' | sed -E 's/\./_/g') +H5_LIBVER_DIR=$H5_MAJORVER$H5_MINORVER + +# Shell commands used in Makefiles +RM="rm -rf" +DIFF="diff -c" +CMP="cmp -s" +GREP='grep' +CP="cp -p" # Use -p to preserve mode,ownership,timestamps +DIRNAME='dirname' +LS='ls' +AWK='awk' + +# setup plugin path +ENVCMD="env HDF5_PLUGIN_PATH=$LD_LIBRARY_PATH/plugin" + +TESTDIR=$builddir + + +case `echo "testing\c"; echo 1,2,3`,`echo -n testing; echo 1,2,3` in + *c*,-n*) ECHO_N= ECHO_C=' +' ;; + *c*,* ) ECHO_N=-n ECHO_C= ;; + *) ECHO_N= ECHO_C='\c' ;; +esac +ECHO_N="echo $ECHO_N" + + +exout() { + $* +} + +dumpout() { + $H5DUMP $* +} + +$H5CC $srcdir/h5ex_g_create.c -o h5ex_g_create + +$ECHO_N "Testing C/H5G/h5ex_g_create...$ECHO_C" +./h5ex_g_create +dumpout h5ex_g_create.h5 >tmp.test +rm -f h5ex_g_create.h5 +cmp -s tmp.test $srcdir/tfiles/16/h5ex_g_create.ddl +status=$? +if test $status -ne 0 +then + echo " FAILED!" +else + echo " Passed" +fi +return_val=`expr $status + $return_val` + +$H5CC $srcdir/h5ex_g_iterate.c -o h5ex_g_iterate + +$ECHO_N "Testing C/H5G/h5ex_g_iterate...$ECHO_C" +if test -f h5ex_g_iterate.h5 +then + exout ./h5ex_g_iterate >tmp.test +else + cp $srcdir/h5ex_g_iterate.h5 h5ex_g_iterate.h5 + exout ./h5ex_g_iterate >tmp.test + rm -f h5ex_g_iterate.h5 +fi +cmp -s tmp.test $srcdir/tfiles/16/h5ex_g_iterate.tst +status=$? +if test $status -ne 0 +then + echo " FAILED!" +else + echo " Passed" +fi +return_val=`expr $status + $return_val` + +$H5CC $srcdir/h5ex_g_traverse.c -o h5ex_g_traverse + +$ECHO_N "Testing C/H5G/h5ex_g_traverse...$ECHO_C" +if test -f h5ex_g_traverse.h5 +then + exout ./h5ex_g_traverse >tmp.test +else + cp $srcdir/h5ex_g_traverse.h5 h5ex_g_traverse.h5 + exout ./h5ex_g_traverse >tmp.test + rm -f h5ex_g_traverse.h5 +fi +cmp -s tmp.test $srcdir/tfiles/16/h5ex_g_traverse.tst +status=$? +if test $status -ne 0 +then + echo " FAILED!" +else + echo " Passed" +fi +return_val=`expr $status + $return_val` + +$H5CC $srcdir/h5ex_g_visit.c -o h5ex_g_visit + +$ECHO_N "Testing C/H5G/h5ex_g_visit...$ECHO_C" +if test -f h5ex_g_visit.h5 +then + exout ./h5ex_g_visit >tmp.test +else + cp $srcdir/h5ex_g_visit.h5 h5ex_g_visit.h5 + exout ./h5ex_g_visit >tmp.test + rm -f h5ex_g_visit.h5 +fi +cmp -s tmp.test $srcdir/tfiles/18/h5ex_g_visit.tst +status=$? +if test $status -ne 0 +then + echo " FAILED!" +else + echo " Passed" +fi +return_val=`expr $status + $return_val` + +$H5CC $srcdir/h5ex_g_compact.c -o h5ex_g_compact + +$ECHO_N "Testing C/H5G/h5ex_g_compact...$ECHO_C" +exout ./h5ex_g_compact >tmp.test +cmp -s tmp.test $srcdir/tfiles/18/h5ex_g_compact.tst +status=$? +if test $status -ne 0 +then + echo " FAILED!" +else + dumpout h5ex_g_compact1.h5 >tmp.test + cmp -s tmp.test $srcdir/tfiles/18/h5ex_g_compact1.ddl + status=$? + if test $status -ne 0 + then + echo " FAILED!" + else + dumpout h5ex_g_compact2.h5 >tmp.test + cmp -s tmp.test $srcdir/tfiles/18/h5ex_g_compact2.ddl + status=$? + if test $status -ne 0 + then + echo " FAILED!" + else + echo " Passed" + fi + fi +fi +return_val=`expr $status + $return_val` +rm -f h5ex_g_compact1.h5 +rm -f h5ex_g_compact2.h5 + +$H5CC $srcdir/h5ex_g_phase.c -o h5ex_g_phase + +$ECHO_N "Testing C/H5G/h5ex_g_phase...$ECHO_C" +exout ./h5ex_g_phase >tmp.test +cmp -s tmp.test $srcdir/tfiles/18/h5ex_g_phase.tst +status=$? +if test $status -ne 0 +then + echo " FAILED!" +else + echo " Passed" +fi +return_val=`expr $status + $return_val` +rm -f h5ex_g_phase.h5 + +$H5CC $srcdir/h5ex_g_corder.c -o h5ex_g_corder + +$ECHO_N "Testing C/H5G/h5ex_g_corder...$ECHO_C" +exout ./h5ex_g_corder >tmp.test +cmp -s tmp.test $srcdir/tfiles/18/h5ex_g_corder.tst +status=$? +if test $status -ne 0 +then + echo " FAILED!" +else + echo " Passed" +fi +return_val=`expr $status + $return_val` +rm -f h5ex_g_corder.h5 + +$H5CC $srcdir/h5ex_g_intermediate.c -o h5ex_g_intermediate + +$ECHO_N "Testing C/H5G/h5ex_g_intermediate...$ECHO_C" +exout ./h5ex_g_intermediate >tmp.test +cmp -s tmp.test $srcdir/tfiles/18/h5ex_g_intermediate.tst +status=$? +if test $status -ne 0 +then + echo " FAILED!" +else + echo " Passed" +fi +return_val=`expr $status + $return_val` +rm -f h5ex_g_intermediate.h5 + + +rm -f tmp.test +echo "$return_val tests failed in C/H5G/" +exit $return_val diff --git a/HDF5Examples/C/H5T/test-pc.sh b/HDF5Examples/C/H5T/test-pc.sh new file mode 100755 index 00000000000..5a773f6097b --- /dev/null +++ b/HDF5Examples/C/H5T/test-pc.sh @@ -0,0 +1,250 @@ +#! /bin/sh +# +# Copyright by The HDF Group. +# Copyright by the Board of Trustees of the University of Illinois. +# All rights reserved. +# +# This file is part of HDF5. The full HDF5 copyright notice, including +# terms governing use, modification, and redistribution, is contained in +# the COPYING file, which can be found at the root of the source code +# distribution tree, or in https://www.hdfgroup.org/licenses. +# If you do not have access to either file, you may request a copy from +# help@hdfgroup.org. + +# This file is for use of h5cc created with the CMake process +# HDF5_HOME is expected to be set + +srcdir=.. +builddir=. +verbose=yes +nerrors=0 + +# HDF5 compile commands, assuming they are in your $PATH. +H5CC=$HDF5_HOME/bin/h5cc +LD_LIBRARY_PATH=$HDF5_HOME/lib +export LD_LIBRARY_PATH + +if ! test -f $H5CC; then + echo "Set paths for H5CC and LD_LIBRARY_PATH in test.sh" + echo "Set environment variable HDF5_HOME to the hdf5 install dir" + echo "h5cc was not found at $H5CC" + exit $EXIT_FAILURE +fi + +H5DUMP=`echo $H5CC | sed -e 's/\/[^/]*$/\/h5dump/'`; +H5_LIBVER=$($H5CC -showconfig | grep -i "HDF5 Version:" | sed 's/^.* //g' | sed 's/[-].*//g') +H5_APIVER=$($H5CC -showconfig | grep -i "Default API mapping:" | sed 's/^.* //g' | sed 's/v//g' | sed 's/1/1_/') + +H5_MAJORVER=$(echo $H5_LIBVER | cut -f1 -d'.' | sed -E 's/\./_/g') +H5_MINORVER=$(echo $H5_LIBVER | cut -f2 -d'.' | sed -E 's/\./_/g') +H5_RELEASEVER=$(echo $H5_LIBVER | cut -f3 -d'.' | sed -E 's/\./_/g') +H5_LIBVER_DIR=$H5_MAJORVER$H5_MINORVER + +# Shell commands used in Makefiles +RM="rm -rf" +DIFF="diff -c" +CMP="cmp -s" +GREP='grep' +CP="cp -p" # Use -p to preserve mode,ownership,timestamps +DIRNAME='dirname' +LS='ls' +AWK='awk' + +# setup plugin path +ENVCMD="env HDF5_PLUGIN_PATH=$LD_LIBRARY_PATH/plugin" + +TESTDIR=$builddir + + +case `echo "testing\c"; echo 1,2,3`,`echo -n testing; echo 1,2,3` in + *c*,-n*) ECHO_N= ECHO_C=' +' ;; + *c*,* ) ECHO_N=-n ECHO_C= ;; + *) ECHO_N= ECHO_C='\c' ;; +esac +ECHO_N="echo $ECHO_N" + + +exout() { + $* +} + +dumpout() { + $H5DUMP $* +} + +# compare current version, required version. +# returns if cur_ver < req_ver is true. +version_compare() { + version_lt=0 + if [ ! "$(printf '%s\n' "$1" "$2" | sort -V | head -n1)" = "$2" ]; then + version_lt=1 + fi +} + + +topics="array arrayatt bit bitatt cmpd cmpdatt cpxcmpd cpxcmpdatt enum enumatt float floatatt \ +int intatt opaque opaqueatt string stringatt vlstring vlstringatt \ +commit" + +return_val=0 + +for topic in $topics +do + $H5CC $srcdir/h5ex_t_$topic.c -o h5ex_t_$topic +done + +for topic in $topics +do + fname=h5ex_t_$topic + $ECHO_N "Testing C/H5T/$fname...$ECHO_C" + exout ./$fname >tmp.test + cmp -s tmp.test $srcdir/tfiles/16/$fname.tst + status=$? + if test $status -ne 0 + then + echo " FAILED!" + else + if [[ $fname == "h5ex_t_cpxcmpd" || $fname == "h5ex_t_cpxcmpdatt" ]] + then + targ="-n" + else + targ="" + fi + dumpout $targ $fname.h5 >tmp.test + rm -f $fname.h5 + cmp -s tmp.test $srcdir/tfiles/18/$fname.ddl + status=$? + if test $status -ne 0 + then + echo " FAILED!" + else + echo " Passed" + fi + fi + return_val=`expr $status + $return_val` +done + + +#######Non-standard tests####### + +USE_ALT="" +if [ "$H5_LIBVER_DIR" = "110" ]; then + # check if HDF5 version is < 1.10.7 + version_compare "$H5_LIBVER" "1.10.7" + if [ "$version_lt" = 1 ]; then + USE_ALT="06" + fi +else + if [ "$H5_LIBVER_DIR" = "18" ]; then + # check if HDF5 version is < 1.8.22 + version_compare "$H5_LIBVER" "1.8.22" + if [ "$version_lt" = 1 ]; then + USE_ALT="21" + fi + fi +fi + +topics="objref objrefatt regref regrefatt" + +for topic in $topics +do + $H5CC $srcdir/h5ex_t_$topic.c -o h5ex_t_$topic +done + +for topic in $topics +do + fname=h5ex_t_$topic + $ECHO_N "Testing C/H5T/$fname...$ECHO_C" + exout ./$fname >tmp.test + cmp -s tmp.test $srcdir/tfiles/16/$fname.tst + status=$? + if test $status -ne 0 + then + echo " FAILED!" + else + dumpout $fname.h5 >tmp.test + rm -f $fname.h5 + version_compare "$H5_LIBVER" "1.10.0" + if [ "$version_lt" = 1 ]; then + cmp -s tmp.test $srcdir/tfiles/18/$fname$USE_ALT.ddl + else + version_compare "$H5_LIBVER" "1.12.0" + if [ "$version_lt" = 1 ]; then + version_compare "$H5_LIBVER" "1.10.7" + if [ "$version_lt" = 1 ]; then + cmp -s tmp.test $srcdir/tfiles/110/$fname$USE_ALT.ddl + else + cmp -s tmp.test $srcdir/tfiles/18/$fname.ddl + fi + else + cmp -s tmp.test $srcdir/tfiles/112/$fname.ddl + fi + fi + status=$? + if test $status -ne 0 + then + echo " FAILED!" + else + echo " Passed" + fi + fi + return_val=`expr $status + $return_val` +done + +topics="vlen vlenatt" + +for topic in $topics +do + $H5CC $srcdir/h5ex_t_$topic.c -o h5ex_t_$topic +done + +for topic in $topics +do + fname=h5ex_t_$topic + $ECHO_N "Testing C/H5T/$fname...$ECHO_C" + exout ./$fname >tmp.test + cmp -s tmp.test $srcdir/tfiles/16/$fname.tst + status=$? + if test $status -ne 0 + then + echo " FAILED!" + else + dumpout $fname.h5 >tmp.test + rm -f $fname.h5 + version_compare "$H5_LIBVER" "1.14.3" + if [ "$version_lt" = 1 ]; then + cmp -s tmp.test $srcdir/tfiles/18/$fname.ddl + else + cmp -s tmp.test $srcdir/tfiles/114/$fname.ddl + fi + status=$? + if test $status -ne 0 + then + echo " FAILED!" + else + echo " Passed" + fi + fi + return_val=`expr $status + $return_val` +done + +$H5CC $srcdir/h5ex_t_convert.c -o h5ex_t_convert + +fname=h5ex_t_convert +$ECHO_N "Testing C/H5T/$fname...$ECHO_C" +exout ./$fname >tmp.test +cmp -s tmp.test $srcdir/tfiles/16/$fname.tst +status=$? +if test $status -ne 0 +then + echo " FAILED!" +else + echo " Passed" +fi +return_val=`expr $status + $return_val` + + +rm -f tmp.test +echo "$return_val tests failed in C/H5T/" +exit $return_val diff --git a/HDF5Examples/C/H5VDS/test-pc.sh b/HDF5Examples/C/H5VDS/test-pc.sh new file mode 100644 index 00000000000..e0ee85eab53 --- /dev/null +++ b/HDF5Examples/C/H5VDS/test-pc.sh @@ -0,0 +1,133 @@ +#! /bin/sh +# +# Copyright by The HDF Group. +# All rights reserved. +# +# This file is part of HDF5. The full HDF5 copyright notice, including +# terms governing use, modification, and redistribution, is contained in +# the COPYING file, which can be found at the root of the source code +# distribution tree, or in https://www.hdfgroup.org/licenses. +# If you do not have access to either file, you may request a copy from +# help@hdfgroup.org. + +# This file is for use of h5cc created with the CMake process +# HDF5_HOME is expected to be set + +srcdir=.. +builddir=. +verbose=yes +nerrors=0 + +# HDF5 compile commands, assuming they are in your $PATH. +H5CC=$HDF5_HOME/bin/h5cc +LD_LIBRARY_PATH=$HDF5_HOME/lib +export LD_LIBRARY_PATH + +if ! test -f $H5CC; then + echo "Set paths for H5CC and LD_LIBRARY_PATH in test.sh" + echo "Set environment variable HDF5_HOME to the hdf5 install dir" + echo "h5cc was not found at $H5CC" + exit $EXIT_FAILURE +fi + +H5DUMP=`echo $H5CC | sed -e 's/\/[^/]*$/\/h5dump/'`; +H5_LIBVER=$($H5CC -showconfig | grep -i "HDF5 Version:" | sed 's/^.* //g' | sed 's/[-].*//g') +H5_APIVER=$($H5CC -showconfig | grep -i "Default API mapping:" | sed 's/^.* //g' | sed 's/v//g' | sed 's/1/1_/') + +H5_MAJORVER=$(echo $H5_LIBVER | cut -f1 -d'.' | sed -E 's/\./_/g') +H5_MINORVER=$(echo $H5_LIBVER | cut -f2 -d'.' | sed -E 's/\./_/g') +H5_RELEASEVER=$(echo $H5_LIBVER | cut -f3 -d'.' | sed -E 's/\./_/g') +H5_LIBVER_DIR=$H5_MAJORVER$H5_MINORVER + +# Shell commands used in Makefiles +RM="rm -rf" +DIFF="diff -c" +CMP="cmp -s" +GREP='grep' +CP="cp -p" # Use -p to preserve mode,ownership,timestamps +DIRNAME='dirname' +LS='ls' +AWK='awk' + +# setup plugin path +ENVCMD="env HDF5_PLUGIN_PATH=$LD_LIBRARY_PATH/plugin" + +TESTDIR=$builddir + + +case `echo "testing\c"; echo 1,2,3`,`echo -n testing; echo 1,2,3` in + *c*,-n*) ECHO_N= ECHO_C=' +' ;; + *c*,* ) ECHO_N=-n ECHO_C= ;; + *) ECHO_N= ECHO_C='\c' ;; +esac +ECHO_N="echo $ECHO_N" + + +exout() { + $* +} + +dumpout() { + $H5DUMP $* +} + +# compare current version, required version. +# returns if cur_ver < req_ver is true. +version_compare() { + version_lt=0 + if [ ! "$(printf '%s\n' "$1" "$2" | sort -V | head -n1)" = "$2" ]; then + version_lt=1 + fi +} + + +topics="" +topics110="vds vds-exc vds-exclim vds-eiger vds-simpleIO vds-percival vds-percival-unlim vds-percival-unlim-maxmin" + +return_val=0 + +version_compare "$H5_LIBVER" "1.10.0" +if [ "$version_lt" = 0 ]; then + for topic in $topics110 + do + $H5CC $srcdir/h5ex_d_$topic.c -o h5ex_d_$topic + done + + for topic in $topics110 + do + fname=h5ex_$topic + $ECHO_N "Testing C/H5VDS/$fname...$ECHO_C" + exout ./$fname >tmp.test + status=$? + if test $status -eq 1 + then + echo " Unsupported feature" + status=0 + else + cmp -s tmp.test $srcdir/tfiles/110/$fname.tst + status=$? + if test $status -ne 0 + then + echo " FAILED!" + else + dumpout $fname.h5 >tmp.test + rm -f $fname.h5 + cmp -s tmp.test $srcdir/tfiles/110/$fname.ddl + status=$? + if test $status -ne 0 + then + echo " FAILED!" + else + echo " Passed" + fi + fi + return_val=`expr $status + $return_val` + fi + done +fi + + +rm -f tmp.test +echo "$return_val tests failed in C/H5VDS/" +exit $return_val diff --git a/HDF5Examples/FORTRAN/H5D/test-pc.sh b/HDF5Examples/FORTRAN/H5D/test-pc.sh new file mode 100755 index 00000000000..8d77d9782ff --- /dev/null +++ b/HDF5Examples/FORTRAN/H5D/test-pc.sh @@ -0,0 +1,251 @@ +#! /bin/sh +# +# Copyright by The HDF Group. +# All rights reserved. +# +# This file is part of HDF5. The full HDF5 copyright notice, including +# terms governing use, modification, and redistribution, is contained in +# the COPYING file, which can be found at the root of the source code +# distribution tree, or in https://www.hdfgroup.org/licenses. +# If you do not have access to either file, you may request a copy from +# help@hdfgroup.org. + +# This file is for use of h5cc created with the CMake process +# HDF5_HOME is expected to be set + +srcdir=.. +builddir=. +verbose=yes +nerrors=0 + +# HDF5 compile commands, assuming they are in your $PATH. +H5FC=$HDF5_HOME/bin/h5fc +LD_LIBRARY_PATH=$HDF5_HOME/lib +export LD_LIBRARY_PATH + +if ! test -f $H5FC; then + echo "Set paths for H5FC and LD_LIBRARY_PATH in test.sh" + echo "Set environment variable HDF5_HOME to the hdf5 install dir" + echo "h5fc was not found at $H5FC" + exit $EXIT_FAILURE +fi + +H5DUMP=`echo $H5FC | sed -e 's/\/[^/]*$/\/h5dump/'`; +H5_LIBVER=$($H5FC -showconfig | grep -i "HDF5 Version:" | sed 's/^.* //g' | sed 's/[-].*//g') +H5_APIVER=$($H5FC -showconfig | grep -i "Default API mapping:" | sed 's/^.* //g' | sed 's/v//g' | sed 's/1/1_/') + +H5_MAJORVER=$(echo $H5_LIBVER | cut -f1 -d'.' | sed -E 's/\./_/g') +H5_MINORVER=$(echo $H5_LIBVER | cut -f2 -d'.' | sed -E 's/\./_/g') +H5_RELEASEVER=$(echo $H5_LIBVER | cut -f3 -d'.' | sed -E 's/\./_/g') +H5_LIBVER_DIR=$H5_MAJORVER$H5_MINORVER + +# Shell commands used in Makefiles +RM="rm -rf" +DIFF="diff -c" +CMP="cmp -s" +GREP='grep' +CP="cp -p" # Use -p to preserve mode,ownership,timestamps +DIRNAME='dirname' +LS='ls' +AWK='awk' + +# setup plugin path +ENVCMD="env HDF5_PLUGIN_PATH=$LD_LIBRARY_PATH/plugin" + +TESTDIR=$builddir + + +case `echo "testing\c"; echo 1,2,3`,`echo -n testing; echo 1,2,3` in + *c*,-n*) ECHO_N= ECHO_C=' +' ;; + *c*,* ) ECHO_N=-n ECHO_C= ;; + *) ECHO_N= ECHO_C='\c' ;; +esac +ECHO_N="echo $ECHO_N" + + +exout() { + $* +} + +dumpout() { + $H5DUMP $* +} + +# compare current version, required version. +# returns if cur_ver < req_ver is true. +version_compare() { + version_lt=0 + if [ ! "$(printf '%s\n' "$1" "$2" | sort -V | head -n1)" = "$2" ]; then + version_lt=1 + fi +} + + +topics="alloc \ + checksum \ + chunk \ + compact \ + extern \ + fillval \ + gzip \ + hyper \ + rdwr \ + soint \ + szip \ + unlimmod" + +FORTRAN_2003_CONDITIONAL_F="@FORTRAN_2003_CONDITIONAL_F@" + +if [ "$FORTRAN_2003_CONDITIONAL_F" = "Xyes" ]; then + topics="$topics rdwr_kind" +fi + +return_val=0 + +#Remove external data file from h5ex_d_extern +rm -f h5ex_d_extern.data + +for topic in $topics +do + $H5FC $srcdir/h5ex_d_$topic.F90 -o h5ex_d_$topic +done + +for topic in $topics +do + fname=h5ex_d_$topic + $ECHO_N "Testing FORTRAN/H5D/$fname...$ECHO_C" + exout ./$fname >tmp.test + status=$? + if test $status -eq 1 + then + echo " Unsupported feature" + status=0 + else + if [ "$topic" = "alloc" ]; then + # Check if the only difference is the size of the unallocated space. This + # was fixed later in HDF5 to be of zero size. + status=0 + diff tmp.test $srcdir/tfiles/18/$fname.tst > tmp.diff + if [ $? -ne 0 ]; then + NumOfFinds=`grep -c "0 bytes" tmp.diff | wc -l` + rm -f tmp.diff + if [ "$NumOfFinds" -gt "1" ]; then + status=1 + fi + fi + else + cmp -s tmp.test $srcdir/tfiles/18/$fname.tst + status=$? + fi + status=$? + if test $status -ne 0 + then + echo " FAILED!" + else + dumpout $fname.h5 >tmp.test + rm -f $fname.h5 + cmp -s tmp.test $srcdir/tfiles/18/$fname.ddl + status=$? + if test $status -ne 0 + then + # test to see if the only difference is because of big-endian and little-endian + diff tmp.test $srcdir/tfiles/18/$fname.ddl > tmp.diff + echo " " + NumOfFinds=`grep -c "DATATYPE" tmp.diff` + NumOfFinds=`expr $NumOfFinds \* 2` + NumOfLines=`wc -l tmp.test + status=$? + if test $status -eq 1 + then + echo " Unsupported feature" + status=0 + else + if [[ $fname == "h5ex_d_nbit" ]] + then + tdir=$nbitdir + if [[ $USE_ALT == "" ]] + then + ### set USE_ALT=07 if not set above + USE_ALT="07" + fi + else + tdir=18 + ### unset USE_ALT for the other topics + USE_ALT="" + fi + cmp -s tmp.test $srcdir/tfiles/18/$fname.tst + status=$? + if test $status -ne 0 + then + echo " FAILED!" + else + if [[ $fname == "h5ex_d_transform" ]] + then + targ="-n" + else + targ="" + fi + dumpout $targ $fname.h5 >tmp.test + rm -f $fname.h5 + cmp -s tmp.test $srcdir/tfiles/$tdir/$fname$USE_ALT.ddl + status=$? + if test $status -ne 0 + then + echo " FAILED!" + else + echo " Passed" + fi + fi + return_val=`expr $status + $return_val` + fi +done + + +rm -f tmp.test +echo "$return_val tests failed in FORTRAN/H5D/" +exit $return_val diff --git a/HDF5Examples/FORTRAN/H5D/test.sh.in b/HDF5Examples/FORTRAN/H5D/test.sh.in index bdd17c283f8..e67eccd5351 100755 --- a/HDF5Examples/FORTRAN/H5D/test.sh.in +++ b/HDF5Examples/FORTRAN/H5D/test.sh.in @@ -151,7 +151,7 @@ else fi fi -topics="nbit" +topics18="nbit" for topic in $topics18 do fname=h5ex_d_$topic diff --git a/HDF5Examples/FORTRAN/H5G/test-pc.sh b/HDF5Examples/FORTRAN/H5G/test-pc.sh new file mode 100755 index 00000000000..90b02f117dd --- /dev/null +++ b/HDF5Examples/FORTRAN/H5G/test-pc.sh @@ -0,0 +1,151 @@ +#! /bin/sh +# +# Copyright by The HDF Group. +# Copyright by the Board of Trustees of the University of Illinois. +# All rights reserved. +# +# This file is part of HDF5. The full HDF5 copyright notice, including +# terms governing use, modification, and redistribution, is contained in +# the COPYING file, which can be found at the root of the source code +# distribution tree, or in https://www.hdfgroup.org/licenses. +# If you do not have access to either file, you may request a copy from +# help@hdfgroup.org. + +# This file is for use of h5cc created with the CMake process +# HDF5_HOME is expected to be set + +srcdir=.. +builddir=. +verbose=yes +nerrors=0 + +# HDF5 compile commands, assuming they are in your $PATH. +H5FC=$HDF5_HOME/bin/h5fc +LD_LIBRARY_PATH=$HDF5_HOME/lib +export LD_LIBRARY_PATH + +if ! test -f $H5FC; then + echo "Set paths for H5FC and LD_LIBRARY_PATH in test.sh" + echo "Set environment variable HDF5_HOME to the hdf5 install dir" + echo "h5fc was not found at $H5FC" + exit $EXIT_FAILURE +fi + +H5DUMP=`echo $H5FC | sed -e 's/\/[^/]*$/\/h5dump/'`; +H5_LIBVER=$($H5FC -showconfig | grep -i "HDF5 Version:" | sed 's/^.* //g' | sed 's/[-].*//g') +H5_APIVER=$($H5FC -showconfig | grep -i "Default API mapping:" | sed 's/^.* //g' | sed 's/v//g' | sed 's/1/1_/') + +H5_MAJORVER=$(echo $H5_LIBVER | cut -f1 -d'.' | sed -E 's/\./_/g') +H5_MINORVER=$(echo $H5_LIBVER | cut -f2 -d'.' | sed -E 's/\./_/g') +H5_RELEASEVER=$(echo $H5_LIBVER | cut -f3 -d'.' | sed -E 's/\./_/g') +H5_LIBVER_DIR=$H5_MAJORVER$H5_MINORVER + +# Shell commands used in Makefiles +RM="rm -rf" +DIFF="diff -c" +CMP="cmp -s" +GREP='grep' +CP="cp -p" # Use -p to preserve mode,ownership,timestamps +DIRNAME='dirname' +LS='ls' +AWK='awk' + +# setup plugin path +ENVCMD="env HDF5_PLUGIN_PATH=$LD_LIBRARY_PATH/plugin" + +TESTDIR=$builddir + + +case `echo "testing\c"; echo 1,2,3`,`echo -n testing; echo 1,2,3` in + *c*,-n*) ECHO_N= ECHO_C=' +' ;; + *c*,* ) ECHO_N=-n ECHO_C= ;; + *) ECHO_N= ECHO_C='\c' ;; +esac +ECHO_N="echo $ECHO_N" + + +exout() { + $* +} + +dumpout() { + $H5DUMP $* +} + +return_val=0 + + +$ECHO_N "Testing FORTRAN/H5G/h5ex_g_create...$ECHO_C" +./h5ex_g_create +dumpout h5ex_g_create.h5 >tmp.test +rm -f h5ex_g_create.h5 +cmp -s tmp.test $srcdir/tfiles/18/h5ex_g_create.ddl +status=$? +if test $status -ne 0 +then + echo " FAILED!" +else + echo " Passed" +fi +return_val=`expr $status + $return_val` + +$H5FC $srcdir/h5ex_g_compact.F90 -o h5ex_g_compact + +$ECHO_N "Testing FORTRAN/H5G/h5ex_g_compact...$ECHO_C" +./h5ex_g_compact >/dev/null +dumpout h5ex_g_compact1.h5 >tmp.test +cmp -s tmp.test $srcdir/tfiles/18/h5ex_g_compact1.ddl +status=$? +if test $status -ne 0 +then + echo " FAILED!" +else + dumpout h5ex_g_compact2.h5 >tmp.test + cmp -s tmp.test $srcdir/tfiles/18/h5ex_g_compact2.ddl + status=$? + if test $status -ne 0 + then + echo " FAILED!" + else + echo " Passed" + fi +fi +return_val=`expr $status + $return_val` +rm -f h5ex_g_compact1.h5 +rm -f h5ex_g_compact2.h5 + +$H5FC $srcdir/h5ex_g_phase.F90 -o h5ex_g_phase + +$ECHO_N "Testing FORTRAN/H5G/h5ex_g_phase...$ECHO_C" +exout ./h5ex_g_phase >tmp.test +cmp -s tmp.test $srcdir/tfiles/18/h5ex_g_phase.tst +status=$? +if test $status -ne 0 +then + echo " FAILED!" +else + echo " Passed" +fi +return_val=`expr $status + $return_val` +rm -f h5ex_g_phase.h5 + +$H5FC $srcdir/h5ex_g_corder.F90 -o h5ex_g_corder + +$ECHO_N "Testing FORTRAN/H5G/h5ex_g_corder...$ECHO_C" +exout ./h5ex_g_corder >tmp.test +cmp -s tmp.test $srcdir/tfiles/18/h5ex_g_corder.tst +status=$? +if test $status -ne 0 +then + echo " FAILED!" +else + echo " Passed" +fi +return_val=`expr $status + $return_val` +rm -f h5ex_g_corder.h5 + + +rm -f tmp.test +echo "$return_val tests failed in /FORTRAN/H5G/" +exit $return_val diff --git a/HDF5Examples/FORTRAN/H5T/test-pc.sh b/HDF5Examples/FORTRAN/H5T/test-pc.sh new file mode 100755 index 00000000000..c11fa1d8297 --- /dev/null +++ b/HDF5Examples/FORTRAN/H5T/test-pc.sh @@ -0,0 +1,264 @@ +#! /bin/sh +# +# Copyright by The HDF Group. +# Copyright by the Board of Trustees of the University of Illinois. +# All rights reserved. +# +# This file is part of HDF5. The full HDF5 copyright notice, including +# terms governing use, modification, and redistribution, is contained in +# the COPYING file, which can be found at the root of the source code +# distribution tree, or in https://www.hdfgroup.org/licenses. +# If you do not have access to either file, you may request a copy from +# help@hdfgroup.org. + +# This file is for use of h5cc created with the CMake process +# HDF5_HOME is expected to be set + +srcdir=.. +builddir=. +verbose=yes +nerrors=0 + +# HDF5 compile commands, assuming they are in your $PATH. +H5FC=$HDF5_HOME/bin/h5fc +LD_LIBRARY_PATH=$HDF5_HOME/lib +export LD_LIBRARY_PATH + +if ! test -f $H5FC; then + echo "Set paths for H5FC and LD_LIBRARY_PATH in test.sh" + echo "Set environment variable HDF5_HOME to the hdf5 install dir" + echo "h5fc was not found at $H5FC" + exit $EXIT_FAILURE +fi + +H5DUMP=`echo $H5FC | sed -e 's/\/[^/]*$/\/h5dump/'`; +H5_LIBVER=$($H5FC -showconfig | grep -i "HDF5 Version:" | sed 's/^.* //g' | sed 's/[-].*//g') +H5_APIVER=$($H5FC -showconfig | grep -i "Default API mapping:" | sed 's/^.* //g' | sed 's/v//g' | sed 's/1/1_/') + +H5_MAJORVER=$(echo $H5_LIBVER | cut -f1 -d'.' | sed -E 's/\./_/g') +H5_MINORVER=$(echo $H5_LIBVER | cut -f2 -d'.' | sed -E 's/\./_/g') +H5_RELEASEVER=$(echo $H5_LIBVER | cut -f3 -d'.' | sed -E 's/\./_/g') +H5_LIBVER_DIR=$H5_MAJORVER$H5_MINORVER + +# Shell commands used in Makefiles +RM="rm -rf" +DIFF="diff -c" +CMP="cmp -s" +GREP='grep' +CP="cp -p" # Use -p to preserve mode,ownership,timestamps +DIRNAME='dirname' +LS='ls' +AWK='awk' + +# setup plugin path +ENVCMD="env HDF5_PLUGIN_PATH=$LD_LIBRARY_PATH/plugin" + +TESTDIR=$builddir + + +case `echo "testing\c"; echo 1,2,3`,`echo -n testing; echo 1,2,3` in + *c*,-n*) ECHO_N= ECHO_C=' +' ;; + *c*,* ) ECHO_N=-n ECHO_C= ;; + *) ECHO_N= ECHO_C='\c' ;; +esac +ECHO_N="echo $ECHO_N" + + +exout() { + $* +} + +dumpout() { + $H5DUMP $* +} + +# compare current version, required version. +# returns if cur_ver < req_ver is true. +version_compare() { + version_lt=0 + if [ ! "$(printf '%s\n' "$1" "$2" | sort -V | head -n1)" = "$2" ]; then + version_lt=1 + fi +} + +FORTRAN_2003_CONDITIONAL_F="@FORTRAN_2003_CONDITIONAL_F@" + +topics="vlstring" + +if [ "$FORTRAN_2003_CONDITIONAL_F" = "Xyes" ]; then + topics="arrayatt_F03 array_F03 bitatt_F03 bit_F03 cmpdatt_F03 cmpd_F03 \ + Cstring_F03 enumatt_F03 enum_F03 floatatt_F03 float_F03 \ + intatt_F03 int_F03 opaqueatt_F03 opaque_F03 \ + string_F03 $topics" +fi + +return_val=0 + +for topic in $topics +do + $H5FC $srcdir/h5ex_t_$topic.F90 -o h5ex_t_$topic +done + +for topic in $topics +do + fname=h5ex_t_$topic + $ECHO_N "Testing FORTRAN/H5T/$fname...$ECHO_C" + exout ./$fname >tmp.test + cmp -s tmp.test $srcdir/tfiles/18/$fname.tst + status=$? + if test $status -ne 0 + then + echo " FAILED!" + else + if [[ $fname == "h5ex_t_cpxcmpd_F03" || $fname == "h5ex_t_cpxcmpdatt_F03" ]] + then + targ="-n" + else + targ="" + fi + dumpout $targ $fname.h5 >tmp.test + rm -f $fname.h5 + cmp -s tmp.test $srcdir/tfiles/18/$fname.ddl + status=$? + if test $status -ne 0 + then + echo " FAILED!" + else + echo " Passed" + fi + fi + return_val=`expr $status + $return_val` +done + + +#######Non-standard tests####### + +USE_ALT="" +if [ "$H5_LIBVER_DIR" = "110" ]; then + # check if HDF5 version is < 1.10.7 + version_compare "$H5_LIBVER" "1.10.7" + if [ "$version_lt" = 1 ]; then + USE_ALT="06" + fi +else + if [ "$H5_LIBVER_DIR" = "18" ]; then + # check if HDF5 version is < 1.8.22 + version_compare "$H5_LIBVER" "1.8.22" + if [ "$version_lt" = 1 ]; then + USE_ALT="21" + fi + fi +fi + +if [ "$FORTRAN_2003_CONDITIONAL_F" = "Xyes" ]; then + topics="objrefatt_F03 objref_F03 regrefatt_F03 regref_F03" +else + topics="" +fi + +for topic in $topics +do + $H5FC $srcdir/h5ex_t_$topic.F90 -o h5ex_t_$topic +done + +for topic in $topics +do + fname=h5ex_t_$topic + $ECHO_N "Testing FORTRAN/H5T/$fname...$ECHO_C" + exout ./$fname >tmp.test + cmp -s tmp.test $srcdir/tfiles/18/$fname.tst + status=$? + if test $status -ne 0 + then + echo " FAILED!" + else + dumpout $fname.h5 >tmp.test + rm -f $fname.h5 + version_compare "$H5_LIBVER" "1.10.0" + if [ "$version_lt" = 1 ]; then + cmp -s tmp.test $srcdir/tfiles/18/$fname$USE_ALT.ddl + else + version_compare "$H5_LIBVER" "1.12.0" + if [ "$version_lt" = 1 ]; then + version_compare "$H5_LIBVER" "1.10.7" + if [ "$version_lt" = 1 ]; then + cmp -s tmp.test $srcdir/tfiles/110/$fname$USE_ALT.ddl + else + cmp -s tmp.test $srcdir/tfiles/18/$fname.ddl + fi + else + cmp -s tmp.test $srcdir/tfiles/112/$fname.ddl + fi + fi + status=$? + if test $status -ne 0 + then + echo " FAILED!" + else + echo " Passed" + fi + fi + return_val=`expr $status + $return_val` +done + +topics="" +version_compare "$H5_LIBVER" "1.10.0" +if [ "$version_lt" = 0 ]; then + topics=" vlenatt_F03 vlen_F03" +fi + +for topic in $topics +do + $H5FC $srcdir/h5ex_t_$topic.F90 -o h5ex_t_$topic +done + +for topic in $topics +do + fname=h5ex_t_$topic + $ECHO_N "Testing C/H5T/$fname...$ECHO_C" + exout ./$fname >tmp.test + cmp -s tmp.test $srcdir/tfiles/18/$fname.tst + status=$? + if test $status -ne 0 + then + echo " FAILED!" + else + dumpout $fname.h5 >tmp.test + rm -f $fname.h5 + version_compare "$H5_LIBVER" "1.14.3" + if [ "$version_lt" = 1 ]; then + cmp -s tmp.test $srcdir/tfiles/18/$fname.ddl + else + cmp -s tmp.test $srcdir/tfiles/114/$fname.ddl + fi + status=$? + if test $status -ne 0 + then + echo " FAILED!" + else + echo " Passed" + fi + fi + return_val=`expr $status + $return_val` +done + +$H5FC $srcdir/h5ex_t_convert.F90 -o h5ex_t_convert + +#fname=h5ex_t_convert +#$ECHO_N "Testing FORTRAN/H5T/$fname...$ECHO_C" +#exout ./$fname >tmp.test +#cmp -s tmp.test $srcdir/tfiles/18/$fname.test +#status=$? +#if test $status -ne 0 +#then +# echo " FAILED!" +#else +# echo " Passed" +#fi +#return_val=`expr $status + $return_val` + + +rm -f tmp.test +echo "$return_val tests failed in /FORTRAN/H5T/" +exit $return_val diff --git a/config/cmake/LIBAEC/CMakeLists.txt b/config/cmake/LIBAEC/CMakeLists.txt index 29f1fc7f460..5d978275565 100644 --- a/config/cmake/LIBAEC/CMakeLists.txt +++ b/config/cmake/LIBAEC/CMakeLists.txt @@ -1,12 +1,12 @@ cmake_minimum_required (VERSION 3.18) -PROJECT (LIBAEC C) +project (LIBAEC C) #----------------------------------------------------------------------------- # Basic LIBAEC stuff here #----------------------------------------------------------------------------- -set(CMAKE_C_STANDARD 99) -set(CMAKE_C_VISIBILITY_PRESET hidden) -set(CMAKE_POSITION_INDEPENDENT_CODE ON) +set (CMAKE_C_STANDARD 99) +set (CMAKE_C_VISIBILITY_PRESET hidden) +set (CMAKE_POSITION_INDEPENDENT_CODE ON) set (LIBAEC_PACKAGE_EXT ${HDF_PACKAGE_EXT}) set (HDF_USE_GNU_DIRS ${HDF5_USE_GNU_DIRS}) @@ -22,30 +22,30 @@ if (WINDOWS) endif () if (NOT WINDOWS) -include(TestBigEndian) -test_big_endian(WORDS_BIGENDIAN) + include (TestBigEndian) + test_big_endian (WORDS_BIGENDIAN) endif () # Check for __builtin_clzll for faster decoding -include(CheckCSourceCompiles) +include (CheckCSourceCompiles) check_c_source_compiles( "int main(void)\n{return __builtin_clzll(1LL);}" HAVE_DECL___BUILTIN_CLZLL) -if(NOT HAVE_DECL___BUILTIN_CLZLL) +if (NOT HAVE_DECL___BUILTIN_CLZLL) # With MSVC we can use _BitScanReverse64 - check_c_source_compiles( + check_c_source_compiles ( "int main(void){unsigned long foo; unsigned __int64 bar=1LL; return _BitScanReverse64(&foo, bar);}" HAVE_BSR64) -endif() +endif () -include(CheckSymbolExists) -check_symbol_exists(snprintf "stdio.h" HAVE_SNPRINTF) -if(NOT HAVE_SNPRINTF) - check_symbol_exists(_snprintf "stdio.h" HAVE__SNPRINTF) - check_symbol_exists(_snprintf_s "stdio.h" HAVE__SNPRINTF_S) -endif() +include (CheckSymbolExists) +check_symbol_exists (snprintf "stdio.h" HAVE_SNPRINTF) +if (NOT HAVE_SNPRINTF) + check_symbol_exists (_snprintf "stdio.h" HAVE__SNPRINTF) + check_symbol_exists (_snprintf_s "stdio.h" HAVE__SNPRINTF_S) +endif () #----------------------------------------------------------------------------- # Define some CMake variables for use later in the project @@ -89,7 +89,6 @@ set (LIBAEC_PACKAGE_BUGREPORT "help@hdfgroup.org") set (LIBAEC_PACKAGE_SOVERSION "${libaec_VERS_MAJOR}.${libaec_VERS_MINOR}.${libaec_VERS_RELEASE}") set (LIBAEC_PACKAGE_SOVERSION_MAJOR "${libaec_VERS_MAJOR}") - HDF_DIR_PATHS(${LIBAEC_PACKAGE_NAME}) #----------------------------------------------------------------------------- @@ -100,28 +99,20 @@ if (NOT LIBAEC_EXPORTED_TARGETS) set (LIBAEC_EXPORTED_TARGETS "libaec-targets") endif () -#----------------------------------------------------------------------------- -# To include a library in the list exported by the project AT BUILD TIME, -# add it to this variable. This is NOT used by Make Install, but for projects -# which include SZIP as a sub-project within their build tree -#----------------------------------------------------------------------------- set_global_variable (LIBAEC_LIBRARIES_TO_EXPORT "") #----------------------------------------------------------------------------- -# Mac OS X Options +# All libs/tests/examples need the main include directories #----------------------------------------------------------------------------- -if (LIBAEC_BUILD_FRAMEWORKS AND NOT BUILD_SHARED_LIBS) - set (BUILD_SHARED_LIBS ON CACHE BOOL "Build Shared Libraries") -endif () +set_directory_properties (PROPERTIES INCLUDE_DIRECTORIES + "${LIBAEC_BINARY_DIR};${LIBAEC_SOURCE_DIR}/src;${CMAKE_RUNTIME_OUTPUT_DIRECTORY}" +) -set (CMAKE_POSITION_INDEPENDENT_CODE ON) +if (MSVC) + set (CMAKE_MFC_FLAG 0) + set(CMAKE_DEBUG_POSTFIX "d") +endif () -#----------------------------------------------------------------------------- -# When building utility executables that generate other (source) files : -# we make use of the following variables defined in the root CMakeLists. -# Certain systems may add /Debug or /Release to output paths -# and we need to call the executable from inside the CMake configuration -#----------------------------------------------------------------------------- set (EXE_EXT "") if (WIN32) set (EXE_EXT ".exe") @@ -130,10 +121,6 @@ if (WIN32) add_compile_definitions (_CONSOLE) endif () -if (MSVC) - set (CMAKE_MFC_FLAG 0) -endif () - #----------------------------------------------------------------------------- # Compiler specific flags : Shouldn't there be compiler tests for these #----------------------------------------------------------------------------- @@ -159,15 +146,13 @@ configure_file( "${CMAKE_CURRENT_BINARY_DIR}/libaec.h") #----------------------------------------------------------------------------- -# All libs/tests/examples need the main include directories +# Define LIBAEC Library #----------------------------------------------------------------------------- -set_directory_properties(PROPERTIES INCLUDE_DIRECTORIES - "${LIBAEC_BINARY_DIR};${LIBAEC_SOURCE_DIR}/src;${CMAKE_RUNTIME_OUTPUT_DIRECTORY}" + +set (LIBAEC_PUBLIC_HEADERS + ${CMAKE_CURRENT_BINARY_DIR}/libaec.h ) -#----------------------------------------------------------------------------- -# Define LIBAEC Library -#----------------------------------------------------------------------------- set(LIBAEC_SRCS ${LIBAEC_SRC_DIR}/encode.c ${LIBAEC_SRC_DIR}/encode_accessors.c @@ -175,10 +160,6 @@ set(LIBAEC_SRCS ${LIBAEC_SRC_DIR}/vector.c ) -set (LIBAEC_PUBLIC_HEADERS - ${CMAKE_CURRENT_BINARY_DIR}/libaec.h -) - add_library (${LIBAEC_LIB_TARGET} STATIC ${LIBAEC_SRCS} ${LIBAEC_PUBLIC_HEADERS}) target_include_directories (${LIBAEC_LIB_TARGET} PUBLIC "$" @@ -186,7 +167,6 @@ target_include_directories (${LIBAEC_LIB_TARGET} PUBLIC "$" "$") TARGET_C_PROPERTIES (${LIBAEC_LIB_TARGET} STATIC) -target_link_libraries (${LIBAEC_LIB_TARGET} PRIVATE ${LINK_LIBS}) H5_SET_LIB_OPTIONS (${LIBAEC_LIB_TARGET} ${LIBAEC_LIB_NAME} STATIC 0) set_target_properties (${LIBAEC_LIB_TARGET} PROPERTIES VERSION 0.0.12 SOVERSION 0 @@ -216,6 +196,7 @@ set_target_properties (${SZIP_LIB_TARGET} PROPERTIES LINKER_LANGUAGE C INTERFACE_INCLUDE_DIRECTORIES "$/include>" ) + set_global_variable (LIBAEC_LIBRARIES_TO_EXPORT "${LIBAEC_LIBRARIES_TO_EXPORT};${SZIP_LIB_TARGET}") set (install_targets ${install_targets} ${SZIP_LIB_TARGET}) @@ -240,31 +221,6 @@ endif () include (CMakePackageConfigHelpers) -#----------------------------------------------------------------------------- -# Add Target(s) to CMake Install for import into other projects -#----------------------------------------------------------------------------- -if (NOT LIBAEC_EXTERNALLY_CONFIGURED) - install ( - EXPORT ${LIBAEC_EXPORTED_TARGETS} - DESTINATION ${LIBAEC_INSTALL_CMAKE_DIR} - FILE ${LIBAEC_PACKAGE}${LIBAEC_PACKAGE_EXT}-targets.cmake - NAMESPACE ${PACKAGE_NAMESPACE} - COMPONENT configinstall - ) -endif () - -#----------------------------------------------------------------------------- -# Export all exported targets to the build tree for use by parent project -#----------------------------------------------------------------------------- -if (NOT LIBAEC_EXTERNALLY_CONFIGURED) - export ( - TARGETS ${LIBAEC_LIBRARIES_TO_EXPORT} ${LIBAEC_LIB_DEPENDENCIES} - FILE ${LIBAEC_PACKAGE}${LIBAEC_PACKAGE_EXT}-targets.cmake - NAMESPACE ${PACKAGE_NAMESPACE} - ) - export (PACKAGE ${LIBAEC_PACKAGE}${LIBAEC_PACKAGE_EXT}) -endif () - #----------------------------------------------------------------------------- # Set includes needed for build #----------------------------------------------------------------------------- @@ -328,3 +284,28 @@ if (NOT LIBAEC_EXTERNALLY_CONFIGURED) ) endif () +#----------------------------------------------------------------------------- +# Add Target(s) to CMake Install for import into other projects +#----------------------------------------------------------------------------- +if (NOT LIBAEC_EXTERNALLY_CONFIGURED) + install ( + EXPORT ${LIBAEC_EXPORTED_TARGETS} + DESTINATION ${LIBAEC_INSTALL_CMAKE_DIR} + FILE ${LIBAEC_PACKAGE}${LIBAEC_PACKAGE_EXT}-targets.cmake + NAMESPACE ${PACKAGE_NAMESPACE} + COMPONENT configinstall + ) +endif () + +#----------------------------------------------------------------------------- +# Export all exported targets to the build tree for use by parent project +#----------------------------------------------------------------------------- +if (NOT LIBAEC_EXTERNALLY_CONFIGURED) + export ( + TARGETS ${LIBAEC_LIBRARIES_TO_EXPORT} ${LIBAEC_LIB_DEPENDENCIES} + FILE ${LIBAEC_PACKAGE}${LIBAEC_PACKAGE_EXT}-targets.cmake + NAMESPACE ${PACKAGE_NAMESPACE} + ) + export (PACKAGE ${LIBAEC_PACKAGE}${LIBAEC_PACKAGE_EXT}) +endif () + diff --git a/config/cmake/ZLIB/CMakeLists.txt b/config/cmake/ZLIB/CMakeLists.txt index 78d678074b0..3dba6a89657 100644 --- a/config/cmake/ZLIB/CMakeLists.txt +++ b/config/cmake/ZLIB/CMakeLists.txt @@ -1,13 +1,14 @@ -cmake_minimum_required(VERSION 3.12.0) -set(CMAKE_ALLOW_LOOSE_LOOP_CONSTRUCTS ON) +cmake_minimum_required (VERSION 3.18) +set (CMAKE_ALLOW_LOOSE_LOOP_CONSTRUCTS ON) +project (ZLIB C) -project(ZLIB C) - -set(VERSION "1.3") +set (VERSION "1.3") #----------------------------------------------------------------------------- # Basic ZLIB stuff here #----------------------------------------------------------------------------- +set (CMAKE_POSITION_INDEPENDENT_CODE ON) + set (ZLIB_PACKAGE_EXT ${HDF_PACKAGE_EXT}) set (HDF_USE_GNU_DIRS ${HDF5_USE_GNU_DIRS}) set (CMAKE_OSX_ARCHITECTURES ${CMAKE_OSX_ARCHITECTURES}) @@ -21,12 +22,95 @@ if (WINDOWS) set (HAVE_SYS_TYPES_H 1) endif () +include (CheckTypeSize) +include (CheckFunctionExists) +include (CheckIncludeFile) +include (CheckCSourceCompiles) + +check_include_file (sys/types.h HAVE_SYS_TYPES_H) +check_include_file (stdint.h HAVE_STDINT_H) +check_include_file (stddef.h HAVE_STDDEF_H) + +# +# Check to see if we have large file support +# +set (CMAKE_REQUIRED_DEFINITIONS -D_LARGEFILE64_SOURCE=1) +# We add these other definitions here because CheckTypeSize.cmake +# in CMake 2.4.x does not automatically do so and we want +# compatibility with CMake 2.4.x. +if (HAVE_SYS_TYPES_H) + list(APPEND CMAKE_REQUIRED_DEFINITIONS -DHAVE_SYS_TYPES_H) +endif () +if (HAVE_STDINT_H) + list(APPEND CMAKE_REQUIRED_DEFINITIONS -DHAVE_STDINT_H) +endif () +if (HAVE_STDDEF_H) + list(APPEND CMAKE_REQUIRED_DEFINITIONS -DHAVE_STDDEF_H) +endif () +check_type_size (off64_t OFF64_T) +if (HAVE_OFF64_T) + add_definitions(-D_LARGEFILE64_SOURCE=1) +endif () +set (CMAKE_REQUIRED_DEFINITIONS) # clear variable + +# +# Check for fseeko +# +check_function_exists (fseeko HAVE_FSEEKO) +if (NOT HAVE_FSEEKO) + add_definitions (-DNO_FSEEKO) +endif () + +# +# Check for unistd.h +# +check_include_file (unistd.h Z_HAVE_UNISTD_H) + #----------------------------------------------------------------------------- # Define some CMake variables for use later in the project #----------------------------------------------------------------------------- set (ZLIB_RESOURCES_DIR ${HDF_RESOURCES_DIR}/ZLIB) set (ZLIB_SRC_DIR ${ZLIB_SOURCE_DIR}) +#----------------------------------------------------------------------------- +# Set the core names of all the libraries +#----------------------------------------------------------------------------- +set (ZLIB_LIB_CORENAME "zlib-static") + +#----------------------------------------------------------------------------- +# Set the true names of all the libraries if customized by external project +#----------------------------------------------------------------------------- +set (ZLIB_LIB_NAME "${ZLIB_EXTERNAL_LIB_PREFIX}${ZLIB_LIB_CORENAME}") + +#----------------------------------------------------------------------------- +# Set the target names of all the libraries +#----------------------------------------------------------------------------- +set (ZLIB_LIB_TARGET "zlib-static") + +# parse the full version number from zlib.h and include in ZLIB_FULL_VERSION +file (READ ${CMAKE_CURRENT_SOURCE_DIR}/zlib.h _zlib_h_contents) +string (REGEX REPLACE ".*#define[ \t]+ZLIB_VERSION[ \t]+\"([-0-9A-Za-z.]+)\".*" + "\\1" ZLIB_FULL_VERSION ${_zlib_h_contents}) + +set (zlib_VERS_MAJOR 1) +set (zlib_VERS_MINOR 3) +set (zlib_VERS_RELEASE 0) + +#----------------------------------------------------------------------------- +set (ZLIB_PACKAGE "zlib") +set (ZLIB_PACKAGE_NAME "ZLIB") +set (ZLIB_PACKAGE_VERSION "${zlib_VERS_MAJOR}.${zlib_VERS_MINOR}") +set (ZLIB_PACKAGE_VERSION_MAJOR "${zlib_VERS_MAJOR}.${zlib_VERS_MINOR}") +set (ZLIB_PACKAGE_VERSION_MINOR "${zlib_VERS_RELEASE}") +set (ZLIB_PACKAGE_STRING "${ZLIB_PACKAGE_NAME} ${ZLIB_PACKAGE_VERSION}") +set (ZLIB_PACKAGE_TARNAME "${ZLIB_PACKAGE_NAME}${ZLIB_PACKAGE_EXT}") +set (ZLIB_PACKAGE_URL "http://www.hdfgroup.org") +set (ZLIB_PACKAGE_BUGREPORT "help@hdfgroup.org") +set (ZLIB_PACKAGE_SOVERSION "${zlib_VERS_MAJOR}.${zlib_VERS_MINOR}.${zlib_VERS_RELEASE}") +set (ZLIB_PACKAGE_SOVERSION_MAJOR "${zlib_VERS_MAJOR}") + +HDF_DIR_PATHS(${ZLIB_PACKAGE_NAME}) + #----------------------------------------------------------------------------- # Targets built within this project are exported at Install time for use # by other projects @@ -35,69 +119,23 @@ if (NOT ZLIB_EXPORTED_TARGETS) set (ZLIB_EXPORTED_TARGETS "zlib-targets") endif () -set (CMAKE_POSITION_INDEPENDENT_CODE ON) - -HDF_DIR_PATHS(ZLIB) +set_global_variable (ZLIB_LIBRARIES_TO_EXPORT "") #----------------------------------------------------------------------------- # All libs/tests/examples need the main include directories #----------------------------------------------------------------------------- -set_directory_properties(PROPERTIES INCLUDE_DIRECTORIES +set_directory_properties (PROPERTIES INCLUDE_DIRECTORIES "${ZLIB_BINARY_DIR};${ZLIB_SOURCE_DIR};${CMAKE_RUNTIME_OUTPUT_DIRECTORY}" ) -include(CheckTypeSize) -include(CheckFunctionExists) -include(CheckIncludeFile) -include(CheckCSourceCompiles) - -check_include_file(sys/types.h HAVE_SYS_TYPES_H) -check_include_file(stdint.h HAVE_STDINT_H) -check_include_file(stddef.h HAVE_STDDEF_H) - -# -# Check to see if we have large file support -# -set(CMAKE_REQUIRED_DEFINITIONS -D_LARGEFILE64_SOURCE=1) -# We add these other definitions here because CheckTypeSize.cmake -# in CMake 2.4.x does not automatically do so and we want -# compatibility with CMake 2.4.x. -if(HAVE_SYS_TYPES_H) - list(APPEND CMAKE_REQUIRED_DEFINITIONS -DHAVE_SYS_TYPES_H) -endif() -if(HAVE_STDINT_H) - list(APPEND CMAKE_REQUIRED_DEFINITIONS -DHAVE_STDINT_H) -endif() -if(HAVE_STDDEF_H) - list(APPEND CMAKE_REQUIRED_DEFINITIONS -DHAVE_STDDEF_H) -endif() -check_type_size(off64_t OFF64_T) -if(HAVE_OFF64_T) - add_definitions(-D_LARGEFILE64_SOURCE=1) -endif() -set(CMAKE_REQUIRED_DEFINITIONS) # clear variable - -# -# Check for fseeko -# -check_function_exists(fseeko HAVE_FSEEKO) -if(NOT HAVE_FSEEKO) - add_definitions(-DNO_FSEEKO) -endif() - -# -# Check for unistd.h -# -check_include_file(unistd.h Z_HAVE_UNISTD_H) - -if(MSVC) - set(CMAKE_DEBUG_POSTFIX "d") - add_definitions (-D_BIND_TO_CURRENT_VCLIBS_VERSION=1) - add_definitions (-D_CRT_SECURE_NO_WARNINGS) - add_definitions (-D_CONSOLE) - add_definitions(-D_CRT_NONSTDC_NO_DEPRECATE) - include_directories(${CMAKE_CURRENT_SOURCE_DIR}) -endif() +if (MSVC) + set(CMAKE_DEBUG_POSTFIX "d") + add_definitions (-D_BIND_TO_CURRENT_VCLIBS_VERSION=1) + add_definitions (-D_CRT_SECURE_NO_WARNINGS) + add_definitions (-D_CONSOLE) + add_definitions(-D_CRT_NONSTDC_NO_DEPRECATE) + include_directories(${CMAKE_CURRENT_SOURCE_DIR}) +endif () if(NOT CMAKE_CURRENT_SOURCE_DIR STREQUAL CMAKE_CURRENT_BINARY_DIR) # If we're doing an out of source build and the user has a zconf.h @@ -115,9 +153,9 @@ configure_file( ${CMAKE_CURRENT_SOURCE_DIR}/zconf.h.cmakein include_directories(${CMAKE_CURRENT_BINARY_DIR} ${CMAKE_SOURCE_DIR}) -#============================================================================ -# zlib -#============================================================================ +#----------------------------------------------------------------------------- +# Define ZLIB Library +#----------------------------------------------------------------------------- set(ZLIB_PUBLIC_HDRS ${CMAKE_CURRENT_BINARY_DIR}/zconf.h @@ -152,47 +190,40 @@ set(ZLIB_SRCS zutil.c ) -# parse the full version number from zlib.h and include in ZLIB_FULL_VERSION -file(READ ${CMAKE_CURRENT_SOURCE_DIR}/zlib.h _zlib_h_contents) -string(REGEX REPLACE ".*#define[ \t]+ZLIB_VERSION[ \t]+\"([-0-9A-Za-z.]+)\".*" - "\\1" ZLIB_FULL_VERSION ${_zlib_h_contents}) - -add_library(zlib-static STATIC ${ZLIB_SRCS} ${ZLIB_PUBLIC_HDRS} ${ZLIB_PRIVATE_HDRS}) +add_library(${ZLIB_LIB_TARGET} STATIC ${ZLIB_SRCS} ${ZLIB_PUBLIC_HDRS} ${ZLIB_PRIVATE_HDRS}) +target_include_directories(${ZLIB_LIB_TARGET} PRIVATE "${CMAKE_BINARY_DIR}") if (MSVC AND CMAKE_CL_64) - set_target_properties (zlib-static PROPERTIES STATIC_LIBRARY_FLAGS "/machine:x64") + set_target_properties (${ZLIB_LIB_TARGET} PROPERTIES STATIC_LIBRARY_FLAGS "/machine:x64") endif () -target_include_directories(zlib-static PRIVATE "${CMAKE_BINARY_DIR}") -set_target_properties(zlib-static PROPERTIES +set_target_properties(${ZLIB_LIB_TARGET} PROPERTIES PUBLIC_HEADER "" LINKER_LANGUAGE C INTERFACE_INCLUDE_DIRECTORIES "$/include>" ) -set_global_variable (ZLIB_LIBRARIES_TO_EXPORT "zlib-static") -set (install_targets zlib-static) #----------------------------------------------------------------------------- -# Compiler specific flags : Shouldn't there be compiler tests for these +# Compiler specific flags #----------------------------------------------------------------------------- if (CMAKE_C_COMPILER_ID STREQUAL "GNU") - target_compile_options(zlib-static PRIVATE -Wno-strict-prototypes -Wno-implicit-function-declaration) + target_compile_options(${ZLIB_LIB_TARGET} PRIVATE -Wno-strict-prototypes -Wno-implicit-function-declaration) endif () if (CMAKE_C_COMPILER_ID MATCHES "IntelLLVM" OR CMAKE_C_COMPILER_ID MATCHES "[Cc]lang") - target_compile_options(zlib-static PRIVATE -Wno-implicit-function-declaration) + target_compile_options(${ZLIB_LIB_TARGET} PRIVATE -Wno-implicit-function-declaration) endif () - -#----------------------------------------------------------------------------- -# This is in here to help some of the GCC based IDES like Eclipse -# and code blocks parse the compiler errors and warnings better. -#----------------------------------------------------------------------------- if (CMAKE_C_COMPILER_ID STREQUAL "GNU") - target_compile_options(zlib-static PRIVATE -fmessage-length=0) + target_compile_options(${ZLIB_LIB_TARGET} PRIVATE -fmessage-length=0) endif () +set_target_properties(${ZLIB_LIB_TARGET} PROPERTIES OUTPUT_NAME zlib-static) + +set_global_variable (ZLIB_LIBRARIES_TO_EXPORT "${ZLIB_LIB_TARGET}") +set (install_targets ${ZLIB_LIB_TARGET}) + #----------------------------------------------------------------------------- # Add Target(s) to CMake Install for import into other projects #----------------------------------------------------------------------------- if (ZLIB_EXPORTED_TARGETS) - INSTALL_TARGET_PDB (zlib-static ${ZLIB_INSTALL_BIN_DIR} libraries) + INSTALL_TARGET_PDB (${ZLIB_LIB_TARGET} ${ZLIB_INSTALL_BIN_DIR} libraries) install ( TARGETS @@ -228,7 +259,7 @@ configure_package_config_file ( #----------------------------------------------------------------------------- set (INCLUDE_INSTALL_DIR ${ZLIB_INSTALL_INCLUDE_DIR}) set (SHARE_INSTALL_DIR "${CMAKE_INSTALL_PREFIX}/${ZLIB_INSTALL_CMAKE_DIR}" ) -set (CURRENT_BUILD_DIR "${CMAKE_INSTALL_PREFIX}" ) +set (CURRENT_BUILD_DIR "${CMAKE_INSTALL_PREFIX}") configure_package_config_file ( ${ZLIB_RESOURCES_DIR}/zlib-config.cmake.in "${ZLIB_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/zlib-config.cmake" diff --git a/config/cmake/ZLIBNG/CMakeLists.txt b/config/cmake/ZLIBNG/CMakeLists.txt index 64e39d7500c..5bb5da961e1 100644 --- a/config/cmake/ZLIBNG/CMakeLists.txt +++ b/config/cmake/ZLIBNG/CMakeLists.txt @@ -1,4 +1,6 @@ -cmake_minimum_required(VERSION 3.12) +cmake_minimum_required(VERSION 3.18) +project(ZLIB VERSION ${ZLIB_HEADER_VERSION} LANGUAGES C) + message(STATUS "Using CMake version ${CMAKE_VERSION}") # If not specified on the command line, enable C11 as the default @@ -27,8 +29,6 @@ string(REGEX REPLACE ".*#define[ \t]+ZLIBNG_VERSION[ \t]+\"([-0-9A-Za-z.]+)\".*" message(STATUS "ZLIB_HEADER_VERSION: ${ZLIB_HEADER_VERSION}") message(STATUS "ZLIBNG_HEADER_VERSION: ${ZLIBNG_HEADER_VERSION}") -project(ZLIB VERSION ${ZLIB_HEADER_VERSION} LANGUAGES C) - #----------------------------------------------------------------------------- # Basic ZLIB stuff here #----------------------------------------------------------------------------- @@ -983,9 +983,9 @@ if(NOT CMAKE_CURRENT_SOURCE_DIR STREQUAL CMAKE_CURRENT_BINARY_DIR) endif() -#============================================================================ -# zlib -#============================================================================ +#----------------------------------------------------------------------------- +# Define ZLIB Library +#----------------------------------------------------------------------------- set(ZLIB_PUBLIC_HDRS ${CMAKE_CURRENT_BINARY_DIR}/zconf${SUFFIX}.h @@ -1075,7 +1075,7 @@ set_global_variable (ZLIB_LIBRARIES_TO_EXPORT "zlib-static") set (install_targets zlib-static) #----------------------------------------------------------------------------- -# Compiler specific flags : Shouldn't there be compiler tests for these +# Compiler specific flags #----------------------------------------------------------------------------- if (CMAKE_C_COMPILER_ID STREQUAL "GNU") target_compile_options(zlib-static PRIVATE -Wno-strict-prototypes -Wno-implicit-function-declaration) @@ -1167,7 +1167,7 @@ configure_package_config_file ( #----------------------------------------------------------------------------- set (INCLUDE_INSTALL_DIR ${ZLIB_INSTALL_INCLUDE_DIR}) set (SHARE_INSTALL_DIR "${CMAKE_INSTALL_PREFIX}/${ZLIB_INSTALL_CMAKE_DIR}" ) -set (CURRENT_BUILD_DIR "${CMAKE_INSTALL_PREFIX}" ) +set (CURRENT_BUILD_DIR "${CMAKE_INSTALL_PREFIX}") configure_package_config_file ( ${ZLIB_RESOURCES_DIR}/zlib-config.cmake.in "${ZLIB_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/zlib-config.cmake" diff --git a/config/cmake/libh5cc.in b/config/cmake/libh5cc.in index 4d2584809c4..9bdce64f7df 100644 --- a/config/cmake/libh5cc.in +++ b/config/cmake/libh5cc.in @@ -21,11 +21,12 @@ fi dir=$( cd -P -- "$(dirname -- "$prg")/.." && pwd -P ) || exit -prg=$dir/$(basename -- "$prg") || exit +prg=$dir/bin/$(basename -- "$prg") || exit -printf '%s\n' "$prg" -printf 'dir is %s\n' "$dir" +#printf '%s\n' "$prg" +#printf 'dir is %s\n' "$dir" +pc_args="" # Show the configuration summary of the library recorded in the # libhdf5.settings file residing in the lib directory. @@ -35,6 +36,27 @@ showconfigure() status=$? } +usage() { + # "How-to use" message. + echo "usage: $prg [OPTIONS] " + echo " OPTIONS:" + echo " -help This help message." + echo " -show Show the commands without executing them" + echo " -showconfig Show the HDF5 library configuration summary" + echo " " + echo " - the pkg-config compile line options for the compiler" + echo " that was used to compile HDF5." + echo " Use pkg-config --help for more information" + echo " on which options are available. $prg passes pkg-config options" + echo " through as those options use double-underscores." + echo " " + echo " NOTE: pkg-config is required to be installed on your system and" + echo " using --static requires a static version of the C runtime library" + echo " to be have been installed on your system." + echo " " + exit $EXIT_FAILURE +} + export PKG_CONFIG_PATH=$dir/lib/pkgconfig for arg in $@ ; do @@ -43,8 +65,20 @@ for arg in $@ ; do showconfigure exit $status ;; + -show) + echo @_PKG_CONFIG_COMPILER@ $@ `pkg-config $pc_args --define-variable=prefix=$dir --cflags --libs @_PKG_CONFIG_LIBNAME@` + exit $status + ;; + -help) + usage + exit $status + ;; + --*) + # gather pkg-config specific options + pc_args="$pc_args $arg" + ;; *) - @_PKG_CONFIG_COMPILER@ $@ `pkg-config --define-variable=prefix=$dir --cflags --libs @_PKG_CONFIG_LIBNAME@` + @_PKG_CONFIG_COMPILER@ $@ `pkg-config $pc_args --define-variable=prefix=$dir --cflags --libs @_PKG_CONFIG_LIBNAME@` status=$? exit $status ;; diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index 010470e5fbf..4499fa67292 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -1212,20 +1212,21 @@ if (${HDF_CFG_NAME} MATCHES "Debug" OR ${HDF_CFG_NAME} MATCHES "Developer") set (PKGCONFIG_LIBNAME "${PKGCONFIG_LIBNAME}${CMAKE_DEBUG_POSTFIX}") endif () -foreach (libs ${LINK_LIBS}) - set (_PKG_CONFIG_LIBS_PRIVATE "${_PKG_CONFIG_LIBS_PRIVATE} -l${libs}") -endforeach () +#foreach (libs ${LINK_LIBS}) +# set (_PKG_CONFIG_LIBS_PRIVATE "${_PKG_CONFIG_LIBS_PRIVATE} -l${libs}") +#endforeach () # The settings for the compression libs depends on if they have pkconfig support # Assuming they don't foreach (libs ${LINK_COMP_LIBS}) # set (_PKG_CONFIG_REQUIRES_PRIVATE "${_PKG_CONFIG_REQUIRES_PRIVATE} -l${libs}") - set (_PKG_CONFIG_LIBS_PRIVATE "${_PKG_CONFIG_LIBS_PRIVATE} -l${libs}") + get_target_property (libname ${libs} OUTPUT_NAME) + set (_PKG_CONFIG_LIBS_PRIVATE "${_PKG_CONFIG_LIBS_PRIVATE} -l${libname}") endforeach () -if (BUILD_STATIC_LIBS) - set (_PKG_CONFIG_LIBS "${_PKG_CONFIG_LIBS} -l${PKGCONFIG_LIBNAME}") -endif () +#if (BUILD_STATIC_LIBS) +# set (_PKG_CONFIG_LIBS "${_PKG_CONFIG_LIBS} -l${PKGCONFIG_LIBNAME}") +#endif () if (BUILD_SHARED_LIBS) set (_PKG_CONFIG_SH_LIBS "${_PKG_CONFIG_SH_LIBS} -l${PKGCONFIG_LIBNAME}") endif ()