diff --git a/.github/workflows/cmake-bintest.yml b/.github/workflows/cmake-bintest.yml index 0220f497240..e087680f54e 100644 --- a/.github/workflows/cmake-bintest.yml +++ b/.github/workflows/cmake-bintest.yml @@ -204,3 +204,58 @@ jobs: cmake --workflow --preset=ci-StdShar-macos-Clang --fresh shell: bash + test_h5cc_linux: + # Linux (Ubuntu) w/ gcc + CMake + # + name: "Ubuntu h5cc Binary Test" + runs-on: ubuntu-latest + steps: + - name: Install CMake Dependencies (Linux) + run: | + sudo apt-get update + sudo apt-get install ninja-build doxygen graphviz + + - name: Set up JDK 19 + uses: actions/setup-java@v4 + with: + java-version: '19' + distribution: 'temurin' + + - name: Get published binary (Linux) + uses: actions/download-artifact@d3f86a106a0bac45b974a628896c90dbdf5c8093 # v4.3.0 + with: + name: tgz-ubuntu-2404_gcc-${{ inputs.build_mode }}-binary + path: ${{ github.workspace }} + + - name: Uncompress hdf5 binary (Linux) + run: | + cd "${{ github.workspace }}" + tar -zxvf ${{ github.workspace }}/HDF5-*-Linux.tar.gz --strip-components 1 + + - name: set hdf5lib name + id: set-hdf5lib-name + run: | + HDF5DIR=${{ github.workspace }}/HDF_Group/HDF5/ + FILE_NAME_HDF5=$(ls ${{ github.workspace }}/HDF_Group/HDF5) + echo "HDF5_ROOT=$HDF5DIR$FILE_NAME_HDF5" >> $GITHUB_OUTPUT + echo "HDF5_PLUGIN_PATH=$HDF5_ROOT/lib/plugin" >> $GITHUB_OUTPUT + + - name: List files for the binaries (Linux) + run: | + ls -l ${{ github.workspace }}/HDF_Group/HDF5 + + - name: List files for the space (Linux) + run: | + ls -l ${{ github.workspace }} + ls ${{ runner.workspace }} + + - name: Run testpc (Linux) + env: + HDF5_HOME: ${{ steps.set-hdf5lib-name.outputs.HDF5_ROOT }} + HDF5_PLUGIN_PATH: ${{ steps.set-hdf5lib-name.outputs.HDF5_PLUGIN_PATH }} + run: | + mkdir "${{ steps.set-hdf5lib-name.outputs.HDF5_ROOT }}/share/build" + cd "${{ steps.set-hdf5lib-name.outputs.HDF5_ROOT }}/share/HDF5Examples" + sh ./test-pc.sh ${{ steps.set-hdf5lib-name.outputs.HDF5_ROOT }}/share/HDF5Examples ${{ steps.set-hdf5lib-name.outputs.HDF5_ROOT }}/share/build . + shell: bash + diff --git a/HDF5Examples/C/H5D/test-pc.sh b/HDF5Examples/C/H5D/test-pc.sh index e0a03223c8f..e79b0777bce 100755 --- a/HDF5Examples/C/H5D/test-pc.sh +++ b/HDF5Examples/C/H5D/test-pc.sh @@ -10,14 +10,20 @@ # 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 +# This file is for use of h5cc created with the CMake process. +# Environment variable, HDF5_HOME is expected to be set. +# $1 is the path name of the source directory. +# $2 is the path name of the build directory. +# $3 is the current path name. -srcdir=.. -builddir=. +top_srcdir=$1 +top_builddir=$2 +currentpath=$3 verbose=yes nerrors=0 +echo "Current build directory: $top_builddir/$currentpath" + # HDF5 compile commands, assuming they are in your $PATH. H5CC=$HDF5_HOME/bin/h5cc LD_LIBRARY_PATH=$HDF5_HOME/lib @@ -52,7 +58,7 @@ AWK='awk' # setup plugin path ENVCMD="env HDF5_PLUGIN_PATH=$LD_LIBRARY_PATH/plugin" -TESTDIR=$builddir +TESTDIR=$top_builddir/$currentpath case `echo "testing\c"; echo 1,2,3`,`echo -n testing; echo 1,2,3` in @@ -65,11 +71,18 @@ ECHO_N="echo $ECHO_N" exout() { - $* + cd $TESTDIR + "$@" } dumpout() { - $H5DUMP $* + cd $TESTDIR + $H5DUMP "$@" +} + +compileout() { + cd $TESTDIR + $H5CC "$@" } # compare current version, required version. @@ -102,29 +115,29 @@ rm -f h5ex_d_extern.data for topic in $topics do - $H5CC $srcdir/h5ex_d_$topic.c -o h5ex_d_$topic + compileout $top_srcdir/$currentpath/$dir16/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 + exout ./$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 + cmp -s $TESTDIR/tmp.test $top_srcdir/$currentpath/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 + rm -f $TESTDIR/$fname.h5 + cmp -s $TESTDIR/tmp.test $top_srcdir/$currentpath/tfiles/16/$fname.ddl status=$? if test $status -ne 0 then @@ -159,7 +172,7 @@ fi for topic in $topics18 do - $H5CC $srcdir/h5ex_d_$topic.c -o h5ex_d_$topic + compileout $top_srcdir/$currentpath/h5ex_d_$topic.c -o h5ex_d_$topic done for topic in $topics18 @@ -173,11 +186,9 @@ do echo " Unsupported feature" status=0 else - if [[ $fname == "h5ex_d_nbit" ]] - then + if [ "$fname" = "h5ex_d_nbit" ]; then tdir=$nbitdir - if [[ $USE_ALT == "" ]] - then + if [ "$USE_ALT" = "" ]; then ### set USE_ALT=07 if not set above USE_ALT="07" fi @@ -186,21 +197,20 @@ do ### unset USE_ALT for the other topics USE_ALT="" fi - cmp -s tmp.test $srcdir/tfiles/18/$fname.tst + cmp -s $TESTDIR/tmp.test $top_srcdir/$currentpath/tfiles/18/$fname.tst status=$? if test $status -ne 0 then echo " FAILED!" else - if [[ $fname == "h5ex_d_transform" ]] - then + 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 + rm -f $TESTDIR/$fname.h5 + cmp -s $TESTDIR/tmp.test $top_srcdir/$currentpath/tfiles/$tdir/$fname$USE_ALT.ddl status=$? if test $status -ne 0 then @@ -215,7 +225,7 @@ done #Remove external data file from h5ex_d_extern -rm -f h5ex_d_extern.data -rm -f tmp.test +rm -f $TESTDIR/h5ex_d_extern.data +rm -f $TESTDIR/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 index b8af1cffa16..8fe63318409 100755 --- a/HDF5Examples/C/H5G/test-pc.sh +++ b/HDF5Examples/C/H5G/test-pc.sh @@ -10,14 +10,20 @@ # 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 +# This file is for use of h5cc created with the CMake process. +# Environment variable, HDF5_HOME is expected to be set. +# $1 is the path name of the source directory. +# $2 is the path name of the build directory. +# $3 is the current path name. -srcdir=.. -builddir=. +top_srcdir=$1 +top_builddir=$2 +currentpath=$3 verbose=yes nerrors=0 +echo "Current build directory: $top_builddir/$currentpath" + # HDF5 compile commands, assuming they are in your $PATH. H5CC=$HDF5_HOME/bin/h5cc LD_LIBRARY_PATH=$HDF5_HOME/lib @@ -52,7 +58,7 @@ AWK='awk' # setup plugin path ENVCMD="env HDF5_PLUGIN_PATH=$LD_LIBRARY_PATH/plugin" -TESTDIR=$builddir +TESTDIR=$top_builddir/$currentpath case `echo "testing\c"; echo 1,2,3`,`echo -n testing; echo 1,2,3` in @@ -65,20 +71,29 @@ ECHO_N="echo $ECHO_N" exout() { - $* + cd $TESTDIR + "$@" } dumpout() { - $H5DUMP $* + cd $TESTDIR + $H5DUMP "$@" } -$H5CC $srcdir/h5ex_g_create.c -o h5ex_g_create +compileout() { + cd $TESTDIR + $H5CC "$@" +} + +return_val=0 + +compileout $top_srcdir/$currentpath/h5ex_g_create.c -o h5ex_g_create $ECHO_N "Testing C/H5G/h5ex_g_create...$ECHO_C" -./h5ex_g_create +exout ./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 +rm -f $TESTDIR/h5ex_g_create.h5 +cmp -s $TESTDIR/tmp.test $top_srcdir/$currentpath/tfiles/16/h5ex_g_create.ddl status=$? if test $status -ne 0 then @@ -88,18 +103,18 @@ else fi return_val=`expr $status + $return_val` -$H5CC $srcdir/h5ex_g_iterate.c -o h5ex_g_iterate +compileout $top_srcdir/$currentpath/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 +if test -f $TESTDIR/h5ex_g_iterate.h5 then exout ./h5ex_g_iterate >tmp.test else - cp $srcdir/h5ex_g_iterate.h5 h5ex_g_iterate.h5 + cp $top_srcdir/$currentpath/h5ex_g_iterate.h5 $TESTDIR/h5ex_g_iterate.h5 exout ./h5ex_g_iterate >tmp.test - rm -f h5ex_g_iterate.h5 + rm -f $TESTDIR/h5ex_g_iterate.h5 fi -cmp -s tmp.test $srcdir/tfiles/16/h5ex_g_iterate.tst +cmp -s $TESTDIR/tmp.test $top_srcdir/$currentpath/tfiles/16/h5ex_g_iterate.tst status=$? if test $status -ne 0 then @@ -109,18 +124,18 @@ else fi return_val=`expr $status + $return_val` -$H5CC $srcdir/h5ex_g_traverse.c -o h5ex_g_traverse +compileout $top_srcdir/$currentpath/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 +if test -f $TESTDIR/h5ex_g_traverse.h5 then exout ./h5ex_g_traverse >tmp.test else - cp $srcdir/h5ex_g_traverse.h5 h5ex_g_traverse.h5 + cp $top_srcdir/$currentpath/h5ex_g_traverse.h5 $TESTDIR/h5ex_g_traverse.h5 exout ./h5ex_g_traverse >tmp.test - rm -f h5ex_g_traverse.h5 + rm -f $TESTDIR/h5ex_g_traverse.h5 fi -cmp -s tmp.test $srcdir/tfiles/16/h5ex_g_traverse.tst +cmp -s $TESTDIR/tmp.test $top_srcdir/$currentpath/tfiles/16/h5ex_g_traverse.tst status=$? if test $status -ne 0 then @@ -130,18 +145,18 @@ else fi return_val=`expr $status + $return_val` -$H5CC $srcdir/h5ex_g_visit.c -o h5ex_g_visit +compileout $top_srcdir/$currentpath/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 +if test -f $TESTDIR/h5ex_g_visit.h5 then exout ./h5ex_g_visit >tmp.test else - cp $srcdir/h5ex_g_visit.h5 h5ex_g_visit.h5 + cp $top_srcdir/$currentpath/h5ex_g_visit.h5 $TESTDIR/h5ex_g_visit.h5 exout ./h5ex_g_visit >tmp.test - rm -f h5ex_g_visit.h5 + rm -f $TESTDIR/h5ex_g_visit.h5 fi -cmp -s tmp.test $srcdir/tfiles/18/h5ex_g_visit.tst +cmp -s $TESTDIR/tmp.test $top_srcdir/$currentpath/tfiles/18/h5ex_g_visit.tst status=$? if test $status -ne 0 then @@ -151,25 +166,25 @@ else fi return_val=`expr $status + $return_val` -$H5CC $srcdir/h5ex_g_compact.c -o h5ex_g_compact +compileout $top_srcdir/$currentpath/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 +cmp -s $TESTDIR/tmp.test $top_srcdir/$currentpath/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 + cmp -s $TESTDIR/tmp.test $top_srcdir/$currentpath/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 + cmp -s $TESTDIR/tmp.test $top_srcdir/$currentpath/tfiles/18/h5ex_g_compact2.ddl status=$? if test $status -ne 0 then @@ -180,14 +195,14 @@ else fi fi return_val=`expr $status + $return_val` -rm -f h5ex_g_compact1.h5 -rm -f h5ex_g_compact2.h5 +rm -f $TESTDIR/h5ex_g_compact1.h5 +rm -f $TESTDIR/h5ex_g_compact2.h5 -$H5CC $srcdir/h5ex_g_phase.c -o h5ex_g_phase +compileout $top_srcdir/$currentpath/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 +cmp -s $TESTDIR/tmp.test $top_srcdir/$currentpath/tfiles/18/h5ex_g_phase.tst status=$? if test $status -ne 0 then @@ -196,13 +211,13 @@ else echo " Passed" fi return_val=`expr $status + $return_val` -rm -f h5ex_g_phase.h5 +rm -f $TESTDIR/h5ex_g_phase.h5 -$H5CC $srcdir/h5ex_g_corder.c -o h5ex_g_corder +compileout $top_srcdir/$currentpath/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 +cmp -s $TESTDIR/tmp.test $top_srcdir/$currentpath/tfiles/18/h5ex_g_corder.tst status=$? if test $status -ne 0 then @@ -211,13 +226,13 @@ else echo " Passed" fi return_val=`expr $status + $return_val` -rm -f h5ex_g_corder.h5 +rm -f $TESTDIR/h5ex_g_corder.h5 -$H5CC $srcdir/h5ex_g_intermediate.c -o h5ex_g_intermediate +compileout $top_srcdir/$currentpath/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 +cmp -s $TESTDIR/tmp.test $top_srcdir/$currentpath/tfiles/18/h5ex_g_intermediate.tst status=$? if test $status -ne 0 then @@ -226,9 +241,9 @@ else echo " Passed" fi return_val=`expr $status + $return_val` -rm -f h5ex_g_intermediate.h5 +rm -f $TESTDIR/h5ex_g_intermediate.h5 -rm -f tmp.test +rm -f $TESTDIR/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 index 5b43873fb1d..ab29512266b 100755 --- a/HDF5Examples/C/H5T/test-pc.sh +++ b/HDF5Examples/C/H5T/test-pc.sh @@ -10,14 +10,20 @@ # 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 +# This file is for use of h5cc created with the CMake process. +# Environment variable, HDF5_HOME is expected to be set. +# $1 is the path name of the source directory. +# $2 is the path name of the build directory. +# $3 is the current path name. -srcdir=.. -builddir=. +top_srcdir=$1 +top_builddir=$2 +currentpath=$3 verbose=yes nerrors=0 +echo "Current build directory: $top_builddir/$currentpath" + # HDF5 compile commands, assuming they are in your $PATH. H5CC=$HDF5_HOME/bin/h5cc LD_LIBRARY_PATH=$HDF5_HOME/lib @@ -52,7 +58,7 @@ AWK='awk' # setup plugin path ENVCMD="env HDF5_PLUGIN_PATH=$LD_LIBRARY_PATH/plugin" -TESTDIR=$builddir +TESTDIR=$top_builddir/$currentpath case `echo "testing\c"; echo 1,2,3`,`echo -n testing; echo 1,2,3` in @@ -65,11 +71,18 @@ ECHO_N="echo $ECHO_N" exout() { - $* + cd $TESTDIR + "$@" } dumpout() { - $H5DUMP $* + cd $TESTDIR + $H5DUMP "$@" +} + +compileout() { + cd $TESTDIR + $H5CC "$@" } # compare current version, required version. @@ -90,7 +103,7 @@ return_val=0 for topic in $topics do - $H5CC $srcdir/h5ex_t_$topic.c -o h5ex_t_$topic + compileout $top_srcdir/$currentpath/h5ex_t_$topic.c -o h5ex_t_$topic done for topic in $topics @@ -98,21 +111,20 @@ 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 + cmp -s $TESTDIR/tmp.test $top_srcdir/$currentpath/tfiles/16/$fname.tst status=$? if test $status -ne 0 then echo " FAILED!" else - if [[ $fname == "h5ex_t_cpxcmpd" || $fname == "h5ex_t_cpxcmpdatt" ]] - then + if [ "$fname" = "h5ex_t_cpxcmpd" -o "$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 + rm -f $TESTDIR/$fname.h5 + cmp -s $TESTDIR/tmp.test $top_srcdir/$currentpath/tfiles/18/$fname.ddl status=$? if test $status -ne 0 then @@ -148,7 +160,7 @@ topics="objref objrefatt regref regrefatt" for topic in $topics do - $H5CC $srcdir/h5ex_t_$topic.c -o h5ex_t_$topic + compileout $top_srcdir/$currentpath/h5ex_t_$topic.c -o h5ex_t_$topic done for topic in $topics @@ -156,28 +168,28 @@ 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 + cmp -s $TESTDIR/tmp.test $top_srcdir/$currentpath/tfiles/16/$fname.tst status=$? if test $status -ne 0 then echo " FAILED!" else dumpout $fname.h5 >tmp.test - rm -f $fname.h5 + rm -f $TESTDIR/$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 + cmp -s $TESTDIR/tmp.test $top_srcdir/$currentpath/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 + cmp -s $TESTDIR/tmp.test $top_srcdir/$currentpath/tfiles/110/$fname$USE_ALT.ddl else - cmp -s tmp.test $srcdir/tfiles/18/$fname.ddl + cmp -s $TESTDIR/tmp.test $top_srcdir/$currentpath/tfiles/18/$fname.ddl fi else - cmp -s tmp.test $srcdir/tfiles/112/$fname.ddl + cmp -s $TESTDIR/tmp.test $top_srcdir/$currentpath/tfiles/112/$fname.ddl fi fi status=$? @@ -195,7 +207,7 @@ topics="vlen vlenatt" for topic in $topics do - $H5CC $srcdir/h5ex_t_$topic.c -o h5ex_t_$topic + compileout $top_srcdir/$currentpath/h5ex_t_$topic.c -o h5ex_t_$topic done for topic in $topics @@ -203,19 +215,19 @@ 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 + cmp -s $TESTDIR/tmp.test $top_srcdir/$currentpath/tfiles/16/$fname.tst status=$? if test $status -ne 0 then echo " FAILED!" else dumpout $fname.h5 >tmp.test - rm -f $fname.h5 + rm -f $TESTDIR/$fname.h5 version_compare "$H5_LIBVER" "1.14.3" if [ "$version_lt" = 1 ]; then - cmp -s tmp.test $srcdir/tfiles/18/$fname.ddl + cmp -s tmp.test $top_srcdir/$currentpath/tfiles/18/$fname.ddl else - cmp -s tmp.test $srcdir/tfiles/114/$fname.ddl + cmp -s tmp.test $top_srcdir/$currentpath/tfiles/114/$fname.ddl fi status=$? if test $status -ne 0 @@ -228,12 +240,12 @@ do return_val=`expr $status + $return_val` done -$H5CC $srcdir/h5ex_t_convert.c -o h5ex_t_convert +compileout $top_srcdir/$currentpath/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 +cmp -s $TESTDIR/tmp.test $top_srcdir/$currentpath/tfiles/16/$fname.tst status=$? if test $status -ne 0 then @@ -244,6 +256,6 @@ fi return_val=`expr $status + $return_val` -rm -f tmp.test +rm -f $TESTDIR/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 old mode 100644 new mode 100755 index d323473ebee..bb14e0e5a80 --- a/HDF5Examples/C/H5VDS/test-pc.sh +++ b/HDF5Examples/C/H5VDS/test-pc.sh @@ -10,14 +10,20 @@ # 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 +# This file is for use of h5cc created with the CMake process. +# Environment variable, HDF5_HOME is expected to be set. +# $1 is the path name of the source directory. +# $2 is the path name of the build directory. +# $3 is the current path name. -srcdir=.. -builddir=. +top_srcdir=$1 +top_builddir=$2 +currentpath=$3 verbose=yes nerrors=0 +echo "Current build directory: $top_builddir/$currentpath" + # HDF5 compile commands, assuming they are in your $PATH. H5CC=$HDF5_HOME/bin/h5cc LD_LIBRARY_PATH=$HDF5_HOME/lib @@ -52,7 +58,7 @@ AWK='awk' # setup plugin path ENVCMD="env HDF5_PLUGIN_PATH=$LD_LIBRARY_PATH/plugin" -TESTDIR=$builddir +TESTDIR=$top_builddir/$currentpath case `echo "testing\c"; echo 1,2,3`,`echo -n testing; echo 1,2,3` in @@ -65,11 +71,18 @@ ECHO_N="echo $ECHO_N" exout() { - $* + cd $TESTDIR + "$@" } dumpout() { - $H5DUMP $* + cd $TESTDIR + $H5DUMP "$@" +} + +compileout() { + cd $TESTDIR + $H5CC "$@" } # compare current version, required version. @@ -83,15 +96,15 @@ version_compare() { topics="" -topics110="vds vds-exc vds-exclim vds-eiger vds-simpleIO vds-percival vds-percival-unlim vds-percival-unlim-maxmin" - +topics110="vds vds-exc vds-eiger vds-simpleIO vds-percival vds-percival-unlim vds-percival-unlim-maxmin" +# not tested vds-exclim 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 + compileout $top_srcdir/$currentpath/h5ex_$topic.c -o h5ex_$topic done for topic in $topics110 @@ -105,15 +118,15 @@ if [ "$version_lt" = 0 ]; then echo " Unsupported feature" status=0 else - cmp -s tmp.test $srcdir/tfiles/110/$fname.tst + cmp -s $TESTDIR/tmp.test $top_srcdir/$currentpath/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 + rm -f $TESTDIR/$fname.h5 + cmp -s $TESTDIR/tmp.test $top_srcdir/$currentpath/tfiles/110/$fname.ddl status=$? if test $status -ne 0 then @@ -128,6 +141,6 @@ if [ "$version_lt" = 0 ]; then fi -rm -f tmp.test +rm -f $TESTDIR/tmp.test echo "$return_val tests failed in C/H5VDS/" exit $return_val diff --git a/HDF5Examples/C/HL/test-pc.sh b/HDF5Examples/C/HL/test-pc.sh index b496b58b830..d9ef9620b72 100755 --- a/HDF5Examples/C/HL/test-pc.sh +++ b/HDF5Examples/C/HL/test-pc.sh @@ -10,14 +10,20 @@ # 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 +# This file is for use of h5cc created with the CMake process. +# Environment variable, HDF5_HOME is expected to be set. +# $1 is the path name of the source directory. +# $2 is the path name of the build directory. +# $3 is the current path name. -srcdir=.. -builddir=. +top_srcdir=$1 +top_builddir=$2 +currentpath=$3 verbose=yes nerrors=0 +echo "Current build directory: $top_builddir/$currentpath" + # HDF5 compile commands, assuming they are in your $PATH. H5CC=$HDF5_HOME/bin/h5cc LD_LIBRARY_PATH=$HDF5_HOME/lib @@ -52,7 +58,7 @@ AWK='awk' # setup plugin path ENVCMD="env HDF5_PLUGIN_PATH=$LD_LIBRARY_PATH/plugin" -TESTDIR=$builddir +TESTDIR=$top_builddir/$currentpath case `echo "testing\c"; echo 1,2,3`,`echo -n testing; echo 1,2,3` in @@ -65,11 +71,18 @@ ECHO_N="echo $ECHO_N" exout() { - $* + cd $TESTDIR + "$@" } dumpout() { - $H5DUMP $* + cd $TESTDIR + $H5DUMP "$@" +} + +compileout() { + cd $TESTDIR + $H5CC "$@" } # compare current version, required version. @@ -81,7 +94,6 @@ version_compare() { fi } - topics="h5ex_lite3 h5ex_packet_table_FL \ h5ex_image1 h5ex_image2 \ h5ex_table_01 h5ex_table_02 h5ex_table_03 h5ex_table_04 \ @@ -93,23 +105,29 @@ return_val=0 for topic in $topics do - $H5CC $srcdir/$topic.c -o $topic + compileout $top_srcdir/$currentpath/$topic.c -o $topic done +# h5ex_image2 needs data files +cp $top_srcdir/$currentpath/tfiles/image8.txt $TESTDIR/image8.txt +cp $top_srcdir/$currentpath/tfiles/image24pixel.txt $TESTDIR/image24pixel.txt + for topic in $topics do fname=$topic $ECHO_N "Testing C/HL/$fname...$ECHO_C" exout ./$fname >tmp.test - cmp -s tmp.test $srcdir/tfiles/$fname.tst + cmp -s $TESTDIR/tmp.test $top_srcdir/$currentpath/tfiles/$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/$fname.ddl + rm -f $TESTDIR/$fname.h5 + if [ !"$fname" = "h5ex_ds1" ]; then + cmp -s $TESTDIR/tmp.test $top_srcdir/$currentpath/tfiles/$fname.ddl + fi status=$? if test $status -ne 0 then @@ -122,12 +140,12 @@ do done -$H5CC $srcdir/h5ex_lite1.c -o h5ex_lite1 -$H5CC $srcdir/h5ex_lite2.c -o h5ex_lite2 +compileout $top_srcdir/$currentpath/h5ex_lite1.c -o h5ex_lite1 +compileout $top_srcdir/$currentpath/h5ex_lite2.c -o h5ex_lite2 $ECHO_N "Testing C/HL/h5ex_lite1...$ECHO_C" exout ./h5ex_lite1 >tmp.test -cmp -s tmp.test $srcdir/tfiles/h5ex_lite1.tst +cmp -s $TESTDIR/tmp.test $top_srcdir/$currentpath/tfiles/h5ex_lite1.tst status=$? if test $status -ne 0 then @@ -135,7 +153,7 @@ then else $ECHO_N "Testing C/HL/h5ex_lite2...$ECHO_C" exout ./h5ex_lite2 >tmp.test - cmp -s tmp.test $srcdir/tfiles/h5ex_lite2.tst + cmp -s $TESTDIR/tmp.test $top_srcdir/$currentpath/tfiles/h5ex_lite2.tst status=$? if test $status -ne 0 then @@ -147,6 +165,6 @@ fi return_val=`expr $status + $return_val` -rm -f tmp.test +rm -f $TESTDIR/tmp.test echo "$return_val tests failed in C/HL/" exit $return_val diff --git a/HDF5Examples/C/test-pc.sh b/HDF5Examples/C/test-pc.sh new file mode 100755 index 00000000000..c4ea8229ba0 --- /dev/null +++ b/HDF5Examples/C/test-pc.sh @@ -0,0 +1,56 @@ +#! /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 LICENSE 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. +# Environment variable, HDF5_HOME is expected to be set. +# $1 is the path name of the source directory. +# $2 is the path name of the build directory. +# $3 is the current path name. + +top_srcdir=$1 +top_builddir=$2 +currentpath=$3 +verbose=yes +nerrors=0 + +return_val=0 + +echo "Current build directory: $top_builddir$currentpath" +# Loop through all subdirectories +for dir in */; do + if [ -d "$dir" ] && [ ! -L "$dir" ]; then + #check if test-pc.sh exists + if [ -f "$dir/test-pc.sh" ]; + then + echo "Entering directory: $dir" + ( + mkdir "$top_builddir/$currentpath/$dir" + cd "$dir" + ./test-pc.sh $top_srcdir $top_builddir $currentpath/$dir # Execute script in the subdirectory + status=$? + exit $status + ) + return_val=$? + if test $return_val -ne 0 + then + echo "Exiting directory: $dir with $return_val tests FAILED" + else + echo "Exiting directory: $dir Passed" + fi + nerrors=`expr $return_val + $nerrors` + fi + fi +done + +echo "$nerrors tests failed in $currentpath" +exit $nerrors + diff --git a/HDF5Examples/CXX/test-pc.sh b/HDF5Examples/CXX/test-pc.sh new file mode 100755 index 00000000000..5f0b45d99e6 --- /dev/null +++ b/HDF5Examples/CXX/test-pc.sh @@ -0,0 +1,55 @@ +#! /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 LICENSE 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. +# Environment variable, HDF5_HOME is expected to be set. +# $1 is the path name of the source directory. +# $2 is the path name of the build directory. +# $3 is the current path name. + +top_srcdir=$1 +top_builddir=$2 +currentpath=$3 +verbose=yes +nerrors=0 + +return_val=0 + +echo "Current build directory: $top_builddir$currentpath" +# Loop through all subdirectories +for dir in */; do + if [ -d "$dir" ] && [ ! -L "$dir" ]; then + #check if test-pc.sh exists + if [ -f "$dir/test-pc.sh" ]; + then + echo "Entering directory: $dir" + ( + mkdir "$top_builddir/$currentpath/$dir" + cd "$dir" + ./test-pc.sh $top_srcdir $top_builddir $currentpath/$dir # Execute script in the subdirectory + status=$? + exit $status + ) + return_val=$? + if test $return_val -ne 0 + then + echo "Exiting directory: $dir with $return_val tests FAILED" + else + echo "Exiting directory: $dir Passed" + fi + nerrors=`expr $return_val + $nerrors` + fi + fi +done + +echo "$nerrors tests failed in $currentpath" +exit $nerrors diff --git a/HDF5Examples/FORTRAN/H5D/test-pc.sh b/HDF5Examples/FORTRAN/H5D/test-pc.sh index 95edf49d52b..da4f85da311 100755 --- a/HDF5Examples/FORTRAN/H5D/test-pc.sh +++ b/HDF5Examples/FORTRAN/H5D/test-pc.sh @@ -10,14 +10,20 @@ # 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 +# This file is for use of h5cc created with the CMake process. +# Environment variable, HDF5_HOME is expected to be set. +# $1 is the path name of the source directory. +# $2 is the path name of the build directory. +# $3 is the current path name. -srcdir=.. -builddir=. +top_srcdir=$1 +top_builddir=$2 +currentpath=$3 verbose=yes nerrors=0 +echo "Current build directory: $top_builddir/$currentpath" + # HDF5 compile commands, assuming they are in your $PATH. H5FC=$HDF5_HOME/bin/h5fc LD_LIBRARY_PATH=$HDF5_HOME/lib @@ -52,7 +58,7 @@ AWK='awk' # setup plugin path ENVCMD="env HDF5_PLUGIN_PATH=$LD_LIBRARY_PATH/plugin" -TESTDIR=$builddir +TESTDIR=$top_builddir/$currentpath case `echo "testing\c"; echo 1,2,3`,`echo -n testing; echo 1,2,3` in @@ -65,11 +71,18 @@ ECHO_N="echo $ECHO_N" exout() { - $* + cd $TESTDIR + "$@" } dumpout() { - $H5DUMP $* + cd $TESTDIR + $H5DUMP "$@" +} + +compileout() { + cd $TESTDIR + $H5FC "$@" } # compare current version, required version. @@ -81,12 +94,11 @@ version_compare() { fi } +# require h5_version.h generated +# topics="chunk compact extern" topics="alloc \ checksum \ - chunk \ - compact \ - extern \ fillval \ gzip \ hyper \ @@ -108,7 +120,7 @@ rm -f h5ex_d_extern.data for topic in $topics do - $H5FC $srcdir/h5ex_d_$topic.F90 -o h5ex_d_$topic + compileout $top_srcdir/$currentpath/h5ex_d_$topic.F90 -o h5ex_d_$topic done for topic in $topics @@ -126,16 +138,16 @@ do # 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 + diff $TESTDIR/tmp.test $top_srcdir/$currentpath/tfiles/18/$fname.tst > $TESTDIR/tmp.diff if [ $? -ne 0 ]; then NumOfFinds=`grep -c "0 bytes" tmp.diff | wc -l` - rm -f tmp.diff + rm -f $TESTDIR/tmp.diff if [ "$NumOfFinds" -gt "1" ]; then status=1 fi fi else - cmp -s tmp.test $srcdir/tfiles/18/$fname.tst + cmp -s $TESTDIR/tmp.test $top_srcdir/$currentpath/tfiles/18/$fname.tst status=$? fi status=$? @@ -144,18 +156,18 @@ do echo " FAILED!" else dumpout $fname.h5 >tmp.test - rm -f $fname.h5 - cmp -s tmp.test $srcdir/tfiles/18/$fname.ddl + rm -f $TESTDIR/$fname.h5 + cmp -s $TESTDIR/tmp.test $top_srcdir/$currentpath/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 + diff $TESTDIR/tmp.test $top_srcdir/$currentpath/tfiles/18/$fname.ddl > $TESTDIR/tmp.diff echo " " NumOfFinds=`grep -c "DATATYPE" tmp.diff` NumOfFinds=`expr $NumOfFinds \* 2` NumOfLines=`wc -l tmp.test - rm -f $fname.h5 - cmp -s tmp.test $srcdir/tfiles/$tdir/$fname$USE_ALT.ddl + rm -f $TESTDIR/$fname.h5 + cmp -s $TESTDIR/tmp.test $top_srcdir/$currentpath/tfiles/$tdir/$fname$USE_ALT.ddl status=$? if test $status -ne 0 then @@ -246,6 +258,6 @@ do done -rm -f tmp.test +rm -f $TESTDIR/tmp.test echo "$return_val tests failed in FORTRAN/H5D/" exit $return_val diff --git a/HDF5Examples/FORTRAN/H5G/test-pc.sh b/HDF5Examples/FORTRAN/H5G/test-pc.sh index 4f04ef3f7ac..aaaa87d14e4 100755 --- a/HDF5Examples/FORTRAN/H5G/test-pc.sh +++ b/HDF5Examples/FORTRAN/H5G/test-pc.sh @@ -10,14 +10,20 @@ # 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 +# This file is for use of h5cc created with the CMake process. +# Environment variable, HDF5_HOME is expected to be set. +# $1 is the path name of the source directory. +# $2 is the path name of the build directory. +# $3 is the current path name. -srcdir=.. -builddir=. +top_srcdir=$1 +top_builddir=$2 +currentpath=$3 verbose=yes nerrors=0 +echo "Current build directory: $top_builddir/$currentpath" + # HDF5 compile commands, assuming they are in your $PATH. H5FC=$HDF5_HOME/bin/h5fc LD_LIBRARY_PATH=$HDF5_HOME/lib @@ -52,7 +58,7 @@ AWK='awk' # setup plugin path ENVCMD="env HDF5_PLUGIN_PATH=$LD_LIBRARY_PATH/plugin" -TESTDIR=$builddir +TESTDIR=$top_builddir/$currentpath case `echo "testing\c"; echo 1,2,3`,`echo -n testing; echo 1,2,3` in @@ -65,21 +71,29 @@ ECHO_N="echo $ECHO_N" exout() { - $* + cd $TESTDIR + "$@" } dumpout() { - $H5DUMP $* + cd $TESTDIR + $H5DUMP "$@" +} + +compileout() { + cd $TESTDIR + $H5FC "$@" } return_val=0 +compileout $top_srcdir/$currentpath/h5ex_g_create.F90 -o h5ex_g_create $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 +rm -f $TESTDIR/h5ex_g_create.h5 +cmp -s $TESTDIR/tmp.test $top_srcdir/$currentpath/tfiles/18/h5ex_g_create.ddl status=$? if test $status -ne 0 then @@ -89,19 +103,19 @@ else fi return_val=`expr $status + $return_val` -$H5FC $srcdir/h5ex_g_compact.F90 -o h5ex_g_compact +compileout $top_srcdir/$currentpath/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 +cmp -s $TESTDIR/tmp.test $top_srcdir/$currentpath/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 + cmp -s $TESTDIR/tmp.test $top_srcdir/$currentpath/tfiles/18/h5ex_g_compact2.ddl status=$? if test $status -ne 0 then @@ -111,14 +125,14 @@ else fi fi return_val=`expr $status + $return_val` -rm -f h5ex_g_compact1.h5 -rm -f h5ex_g_compact2.h5 +rm -f $TESTDIR/h5ex_g_compact1.h5 +rm -f $TESTDIR/h5ex_g_compact2.h5 -$H5FC $srcdir/h5ex_g_phase.F90 -o h5ex_g_phase +compileout $top_srcdir/$currentpath/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 +cmp -s $TESTDIR/tmp.test $top_srcdir/$currentpath/tfiles/18/h5ex_g_phase.tst status=$? if test $status -ne 0 then @@ -127,13 +141,13 @@ else echo " Passed" fi return_val=`expr $status + $return_val` -rm -f h5ex_g_phase.h5 +rm -f $TESTDIR/h5ex_g_phase.h5 -$H5FC $srcdir/h5ex_g_corder.F90 -o h5ex_g_corder +compileout $top_srcdir/$currentpath/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 +cmp -s $TESTDIR/tmp.test $top_srcdir/$currentpath/tfiles/18/h5ex_g_corder.tst status=$? if test $status -ne 0 then @@ -142,9 +156,9 @@ else echo " Passed" fi return_val=`expr $status + $return_val` -rm -f h5ex_g_corder.h5 +rm -f $TESTDIR/h5ex_g_corder.h5 -rm -f tmp.test +rm -f $TESTDIR/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 index b8fb2b35b93..59891726546 100755 --- a/HDF5Examples/FORTRAN/H5T/test-pc.sh +++ b/HDF5Examples/FORTRAN/H5T/test-pc.sh @@ -10,14 +10,20 @@ # 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 +# This file is for use of h5cc created with the CMake process. +# Environment variable, HDF5_HOME is expected to be set. +# $1 is the path name of the source directory. +# $2 is the path name of the build directory. +# $3 is the current path name. -srcdir=.. -builddir=. +top_srcdir=$1 +top_builddir=$2 +currentpath=$3 verbose=yes nerrors=0 +echo "Current build directory: $top_builddir/$currentpath" + # HDF5 compile commands, assuming they are in your $PATH. H5FC=$HDF5_HOME/bin/h5fc LD_LIBRARY_PATH=$HDF5_HOME/lib @@ -52,7 +58,7 @@ AWK='awk' # setup plugin path ENVCMD="env HDF5_PLUGIN_PATH=$LD_LIBRARY_PATH/plugin" -TESTDIR=$builddir +TESTDIR=$top_builddir/$currentpath case `echo "testing\c"; echo 1,2,3`,`echo -n testing; echo 1,2,3` in @@ -65,11 +71,18 @@ ECHO_N="echo $ECHO_N" exout() { - $* + cd $TESTDIR + "$@" } dumpout() { - $H5DUMP $* + cd $TESTDIR + $H5DUMP "$@" +} + +compileout() { + cd $TESTDIR + $H5FC "$@" } # compare current version, required version. @@ -96,7 +109,7 @@ return_val=0 for topic in $topics do - $H5FC $srcdir/h5ex_t_$topic.F90 -o h5ex_t_$topic + compileout $top_srcdir/$currentpath/h5ex_t_$topic.F90 -o h5ex_t_$topic done for topic in $topics @@ -104,13 +117,13 @@ 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 + cmp -s $TESTDIR/tmp.test $top_srcdir/$currentpath/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" ]] + if [ "$fname" = "h5ex_t_cpxcmpd_F03" -o "$fname" = "h5ex_t_cpxcmpdatt_F03" ]; then targ="-n" else @@ -118,7 +131,7 @@ do fi dumpout $targ $fname.h5 >tmp.test rm -f $fname.h5 - cmp -s tmp.test $srcdir/tfiles/18/$fname.ddl + cmp -s $TESTDIR/tmp.test $top_srcdir/$currentpath/tfiles/18/$fname.ddl status=$? if test $status -ne 0 then @@ -158,7 +171,7 @@ fi for topic in $topics do - $H5FC $srcdir/h5ex_t_$topic.F90 -o h5ex_t_$topic + compileout $top_srcdir/$currentpath/h5ex_t_$topic.F90 -o h5ex_t_$topic done for topic in $topics @@ -166,28 +179,28 @@ 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 + cmp -s $TESTDIR/tmp.test $top_srcdir/$currentpath/tfiles/18/$fname.tstc status=$? if test $status -ne 0 then echo " FAILED!" else dumpout $fname.h5 >tmp.test - rm -f $fname.h5 + rm -f $TESTDIR/$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 + cmp -s $TESTDIR/tmp.test $top_srcdir/$currentpath/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 + cmp -s $TESTDIR/tmp.test $top_srcdir/$currentpath/tfiles/110/$fname$USE_ALT.ddl else - cmp -s tmp.test $srcdir/tfiles/18/$fname.ddl + cmp -s $TESTDIR/tmp.test $top_srcdir/$currentpath/tfiles/18/$fname.ddl fi else - cmp -s tmp.test $srcdir/tfiles/112/$fname.ddl + cmp -s $TESTDIR/tmp.test $top_srcdir/$currentpath/tfiles/112/$fname.ddl fi fi status=$? @@ -209,7 +222,7 @@ fi for topic in $topics do - $H5FC $srcdir/h5ex_t_$topic.F90 -o h5ex_t_$topic + compileout $top_srcdir/$currentpath/h5ex_t_$topic.F90 -o h5ex_t_$topic done for topic in $topics @@ -217,19 +230,19 @@ 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 + cmp -s $TESTDIR/tmp.test $top_srcdir/$currentpath/tfiles/18/$fname.tst status=$? if test $status -ne 0 then echo " FAILED!" else dumpout $fname.h5 >tmp.test - rm -f $fname.h5 + rm -f $TESTDIR/$fname.h5 version_compare "$H5_LIBVER" "1.14.3" if [ "$version_lt" = 1 ]; then - cmp -s tmp.test $srcdir/tfiles/18/$fname.ddl + cmp -s $TESTDIR/tmp.test $top_srcdir/$currentpath/tfiles/18/$fname.ddl else - cmp -s tmp.test $srcdir/tfiles/114/$fname.ddl + cmp -s $TESTDIR/tmp.test $top_srcdir/$currentpath/tfiles/114/$fname.ddl fi status=$? if test $status -ne 0 @@ -242,12 +255,12 @@ do return_val=`expr $status + $return_val` done -$H5FC $srcdir/h5ex_t_convert.F90 -o h5ex_t_convert +#compileout $top_srcdir/$currentpath/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 +#cmp -s $TESTDIR/tmp.test $top_srcdir/$currentpath/tfiles/18/$fname.test #status=$? #if test $status -ne 0 #then @@ -258,6 +271,6 @@ $H5FC $srcdir/h5ex_t_convert.F90 -o h5ex_t_convert #return_val=`expr $status + $return_val` -rm -f tmp.test +rm -f $TESTDIR/tmp.test echo "$return_val tests failed in /FORTRAN/H5T/" exit $return_val diff --git a/HDF5Examples/FORTRAN/HL/test-pc.sh b/HDF5Examples/FORTRAN/HL/test-pc.sh index d797074587f..8468ce9c0a8 100755 --- a/HDF5Examples/FORTRAN/HL/test-pc.sh +++ b/HDF5Examples/FORTRAN/HL/test-pc.sh @@ -10,14 +10,20 @@ # 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 +# This file is for use of h5cc created with the CMake process. +# Environment variable, HDF5_HOME is expected to be set. +# $1 is the path name of the source directory. +# $2 is the path name of the build directory. +# $3 is the current path name. -srcdir=.. -builddir=. +top_srcdir=$1 +top_builddir=$2 +currentpath=$3 verbose=yes nerrors=0 +echo "Current build directory: $top_builddir/$currentpath" + # HDF5 compile commands, assuming they are in your $PATH. H5FC=$HDF5_HOME/bin/h5fc LD_LIBRARY_PATH=$HDF5_HOME/lib @@ -52,7 +58,7 @@ AWK='awk' # setup plugin path ENVCMD="env HDF5_PLUGIN_PATH=$LD_LIBRARY_PATH/plugin" -TESTDIR=$builddir +TESTDIR=$top_builddir/$currentpath case `echo "testing\c"; echo 1,2,3`,`echo -n testing; echo 1,2,3` in @@ -65,11 +71,18 @@ ECHO_N="echo $ECHO_N" exout() { - $* + cd $TESTDIR + "$@" } dumpout() { - $H5DUMP $* + cd $TESTDIR + $H5DUMP "$@" +} + +compileout() { + cd $TESTDIR + $H5FC "$@" } # compare current version, required version. @@ -86,7 +99,7 @@ return_val=0 for topic in $topics do - $H5FC $srcdir/$topic.F90 -o $topic + compileout $top_srcdir/$currentpath/$topic.F90 -o $topic done for topic in $topics @@ -94,7 +107,7 @@ do fname=$topic $ECHO_N "Testing FORTRAN/HL/$fname...$ECHO_C" exout ./$fname >tmp.test - cmp -s tmp.test $srcdir/tfiles/$fname.tst + cmp -s $TESTDIR/tmp.test $top_srcdir/$currentpath/tfiles/$fname.tst status=$? if test $status -ne 0 then @@ -102,7 +115,9 @@ do else dumpout $fname.h5 >tmp.test rm -f $fname.h5 - cmp -s tmp.test $srcdir/tfiles/$fname.ddl + if [ !"$fname" = "h5ex_ds1" ]; then + cmp -s $TESTDIR/tmp.test $top_srcdir/$currentpath/tfiles/$fname.ddl + fi status=$? if test $status -ne 0 then @@ -115,6 +130,6 @@ do done -rm -f tmp.test +rm -f $TESTDIR/tmp.test echo "$return_val tests failed in /FORTRAN/HL/" exit $return_val diff --git a/HDF5Examples/FORTRAN/test-pc.sh b/HDF5Examples/FORTRAN/test-pc.sh new file mode 100755 index 00000000000..5f0b45d99e6 --- /dev/null +++ b/HDF5Examples/FORTRAN/test-pc.sh @@ -0,0 +1,55 @@ +#! /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 LICENSE 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. +# Environment variable, HDF5_HOME is expected to be set. +# $1 is the path name of the source directory. +# $2 is the path name of the build directory. +# $3 is the current path name. + +top_srcdir=$1 +top_builddir=$2 +currentpath=$3 +verbose=yes +nerrors=0 + +return_val=0 + +echo "Current build directory: $top_builddir$currentpath" +# Loop through all subdirectories +for dir in */; do + if [ -d "$dir" ] && [ ! -L "$dir" ]; then + #check if test-pc.sh exists + if [ -f "$dir/test-pc.sh" ]; + then + echo "Entering directory: $dir" + ( + mkdir "$top_builddir/$currentpath/$dir" + cd "$dir" + ./test-pc.sh $top_srcdir $top_builddir $currentpath/$dir # Execute script in the subdirectory + status=$? + exit $status + ) + return_val=$? + if test $return_val -ne 0 + then + echo "Exiting directory: $dir with $return_val tests FAILED" + else + echo "Exiting directory: $dir Passed" + fi + nerrors=`expr $return_val + $nerrors` + fi + fi +done + +echo "$nerrors tests failed in $currentpath" +exit $nerrors diff --git a/HDF5Examples/JAVA/test-pc.sh b/HDF5Examples/JAVA/test-pc.sh new file mode 100755 index 00000000000..5f0b45d99e6 --- /dev/null +++ b/HDF5Examples/JAVA/test-pc.sh @@ -0,0 +1,55 @@ +#! /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 LICENSE 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. +# Environment variable, HDF5_HOME is expected to be set. +# $1 is the path name of the source directory. +# $2 is the path name of the build directory. +# $3 is the current path name. + +top_srcdir=$1 +top_builddir=$2 +currentpath=$3 +verbose=yes +nerrors=0 + +return_val=0 + +echo "Current build directory: $top_builddir$currentpath" +# Loop through all subdirectories +for dir in */; do + if [ -d "$dir" ] && [ ! -L "$dir" ]; then + #check if test-pc.sh exists + if [ -f "$dir/test-pc.sh" ]; + then + echo "Entering directory: $dir" + ( + mkdir "$top_builddir/$currentpath/$dir" + cd "$dir" + ./test-pc.sh $top_srcdir $top_builddir $currentpath/$dir # Execute script in the subdirectory + status=$? + exit $status + ) + return_val=$? + if test $return_val -ne 0 + then + echo "Exiting directory: $dir with $return_val tests FAILED" + else + echo "Exiting directory: $dir Passed" + fi + nerrors=`expr $return_val + $nerrors` + fi + fi +done + +echo "$nerrors tests failed in $currentpath" +exit $nerrors diff --git a/HDF5Examples/README.md b/HDF5Examples/README.md index 2067a4e9bb6..f2265ae8dc6 100644 --- a/HDF5Examples/README.md +++ b/HDF5Examples/README.md @@ -1,6 +1,6 @@ HDF5 Examples -*Please refer to the Using_CMake.txt file for installation instructions.* +*Please refer to the Using_CMake.txt file for CMake instructions.* Note that this HDF5Examples directory structure is also provided as a stand-alone project distributed with library binaries as well as compiled and tested during a HDF5 Library build. @@ -14,7 +14,25 @@ The HDF Group is the developer, maintainer, and steward of HDF5 software. Find m information about The HDF Group, the HDF5 Community, and other HDF5 software projects, tools, and services at [The HDF Group's website](https://www.hdfgroup.org/). +We suggest using the presets method with CMake for building the examples. However, if you prefer to use the +h5cc pkg-config wrappers, you can use the following commands to build the examples: + export HDF5_HOME="hdf5 installation root" + export PKG_CONFIG_PATH="$HDF5_HOME/lib/pkgconfig" + export LD_LIBRARY_PATH="$HDF5_HOME/lib:$LD_LIBRARY_PATH" + export PATH="$HDF5_HOME/bin:$PATH" + +Then, you can compile the examples with: + + h5cc -o example1 example1.c + h5c++ -o example2 example2.cpp + h5fc -o example3 example3.f90 + +The test-pc.sh script can test the examples with the h5*cc pkg-config wrappers with: + cd \ + export HDF5_HOME="hdf5 installation root"; sh ./test-pc.sh \ \ . + Notice that period (.) at the end of the command is important, it tells the script to use the current + directory as the source directory. HELP AND SUPPORT ---------------- diff --git a/HDF5Examples/Using_CMake.txt b/HDF5Examples/Using_CMake.txt index 3fa456d246d..9ac0458428c 100644 --- a/HDF5Examples/Using_CMake.txt +++ b/HDF5Examples/Using_CMake.txt @@ -157,6 +157,12 @@ These steps are described in more detail below. recommend choosing either Debug or Release to match the build step on Windows. + 4.1 Alternative command line example using the pkg-config shell scripts: + + export HDF5_HOME=/HDF_Group/HDF5/2.0.0 + cd /HDF5Examples/ + sh ./test-pc.sh /HDF5Examples/ /H5EX_BUILD/ . + 5. The files that support building with CMake are all of the files in the config/cmake folder, the CMakeLists.txt files in each source folder, and CTestConfig.cmake. CTestConfig.cmake is specific to the internal testing diff --git a/HDF5Examples/test-pc.sh b/HDF5Examples/test-pc.sh new file mode 100755 index 00000000000..61f624aa93d --- /dev/null +++ b/HDF5Examples/test-pc.sh @@ -0,0 +1,56 @@ +#! /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 LICENSE 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. +# Environment variable, HDF5_HOME is expected to be set. +# $1 is the path name of the source directory. +# $2 is the path name of the build directory. +# $3 is the current path name. + +top_srcdir=$1 +top_builddir=$2 +currentpath=. +verbose=yes +nerrors=0 + +return_val=0 + +mkdir "$top_builddir" +cd "$top_srcdir" +# Loop through all subdirectories +for dir in */; do + if [ -d "$dir" ] && [ ! -L "$dir" ]; then + #check if test-pc.sh exists + if [ -f "$dir/test-pc.sh" ]; + then + echo "Entering directory: $dir" + ( + mkdir "$top_builddir/$dir" + cd "$dir" + ./test-pc.sh $top_srcdir/ $top_builddir/ $dir # Execute script in the subdirectory + status=$? + exit $status + ) + return_val=$? + if test $return_val -ne 0 + then + echo "Exiting directory: $dir with $return_val tests FAILED" + else + echo "Exiting directory: $dir Passed" + fi + nerrors=`expr $return_val + $nerrors` + fi + fi +done + +echo "$nerrors tests failed in HDF5Examples" +exit $nerrors diff --git a/bin/h5cc.in b/bin/h5cc.in deleted file mode 100644 index a9162889b3d..00000000000 --- a/bin/h5cc.in +++ /dev/null @@ -1,391 +0,0 @@ -#! /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 LICENSE 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 tool is adapted from the mpicc command of the MPICH Software. - -############################################################################ -## ## -## Things You May Have to Modify: ## -## ## -## If the following paths don't point to the place were HDF5 is installed ## -## on your system (i.e., you received a binary distribution or moved the ## -## files from the originally installed directory to another directory) ## -## then modify them accordingly to represent the new paths. ## -## ## -############################################################################ -prefix="@prefix@" -exec_prefix="@exec_prefix@" -libdir="@libdir@" -includedir="@includedir@" -HL="@HL@" - -############################################################################ -## ## -## Things You Can Modify to Override HDF5 Library Build Components: ## -## ## -## (Advanced usage - know what you're doing - you're on your own here.) ## -## The four variables below can be used to insert paths and flags in ## -## CPPFLAGS, CFLAGS, LDFLAGS, or LIBS in the h5cc compile line: ## -## $CLINKER $H5BLD_CPPFLAGS $CPPFLAGS $H5BLD_CFLAGS $CFLAGS $LDFLAGS ## -## $LIBS $clibpath $link_objs $link_args $shared_link ## -## ## -## These settings can be overridden by setting HDF5_CFLAGS, ## -## HDF5_CPPFLAGS, HDF5_LDFLAGS, or HDF5_LIBS in the environment. ## -## ## -############################################################################ -CFLAGSBASE="" -CPPFLAGSBASE="" -LDFLAGSBASE="" -LIBSBASE="" - -############################################################################ -## ## -## You shouldn't have to modify anything below this line. ## -## ## -############################################################################ - -# Constants definitions -EXIT_SUCCESS=0 -EXIT_FAILURE=1 - -host_os="@host_os@" - -prog_name="`basename $0`" - -qargs="" -compile_args="" -libraries="" -link_args="" -link_objs="" -clibpath="" - -do_link="yes" -do_compile="no" -dash_c="" -get_output_file="no" - -SHOW="eval" -CCBASE="@CC@" -CLINKERBASE="@CC@" - -# CFLAGS, CPPFLAGS and LDFLAGS are reserved for use by the script user. -# FLAGS brought from the hdf5 build are put in H5BLD_*FLAGS. - -# User's CPPFLAGS and CFLAGS come after their H5BLD counterparts. User's -# LDFLAGS come just before clibpath, user's LIBS come after $link_objs and -# before the hdf5 libraries in $link_args, followed by any external library -# paths and libraries from AM_LDFLAGS, LDFLAGS, AM_LIBS or LIBS carried in -# from the hdf5 build. The order of the flags is intended to give precedence -# to the user's flags. -H5BLD_CFLAGS="@AM_CFLAGS@ @CFLAGS@" -H5BLD_CPPFLAGS="@AM_CPPFLAGS@ @CPPFLAGS@" -H5BLD_LDFLAGS="@AM_LDFLAGS@ @LDFLAGS@" -H5BLD_LIBS="@LIBS@" - -CC="${HDF5_CC:-$CCBASE}" -CLINKER="${HDF5_CLINKER:-$CLINKERBASE}" -CFLAGS="${HDF5_CFLAGS:-$CFLAGSBASE}" -CPPFLAGS="${HDF5_CPPFLAGS:-$CPPFLAGSBASE}" -LDFLAGS="${HDF5_LDFLAGS:-$LDFLAGSBASE}" -LIBS="${HDF5_LIBS:-$LIBSBASE}" - -# If a static library is available, the default will be to use it. If the only -# available library is shared, it will be used by default. The user can -# override either default, although choosing an unavailable library will result -# in link errors. -STATIC_AVAILABLE="@enable_static@" -if test "${STATIC_AVAILABLE}" = "yes"; then - USE_SHARED_LIB="${HDF5_USE_SHLIB:-no}" -else - USE_SHARED_LIB="${HDF5_USE_SHLIB:-yes}" -fi - - -usage() { - # A wonderfully informative "usage" message. - echo "usage: $prog_name [OPTIONS] " - echo " OPTIONS:" - echo " -help | --help | -h This help message." - echo " -echo Show all the shell commands executed" - echo " -prefix=DIR Prefix directory to find HDF5 lib/ and include/" - echo " subdirectories [default: $prefix]" - echo " -show Show the commands without executing them" - echo " -showconfig Show the HDF5 library configuration summary" - echo " -shlib Compile with shared HDF5 libraries [default for hdf5 built" - echo " without static libraries]" - echo " -noshlib Compile with static HDF5 libraries [default for hdf5 built" - echo " with static libraries]" - echo " " - echo " - the normal compile line options for your compiler." - echo " $prog_name uses the same compiler you used to compile" - echo " HDF5. Check with your compiler's man pages for more" - echo " information on which options are needed." - echo " " - echo " You can override the compiler, linker, and whether or not to use static" - echo " or shared libraries to compile your program by setting the following" - echo " environment variables accordingly:" - echo " " - echo " HDF5_CC - use a different C compiler" - echo " HDF5_CLINKER - use a different linker" - echo " HDF5_USE_SHLIB=[yes|no] - use shared or static version of the HDF5 library" - echo " [default: no except when built with only" - echo " shared libraries]" - echo " " - echo " You can also add or change paths and flags to the compile line using" - echo " the following environment variables or by assigning them to their counterparts" - echo " in the 'Things You Can Modify to Override...'" section of $prog_name - echo " " - echo " Variable Current value to be replaced" - echo " HDF5_CPPFLAGS \"$CPPFLAGSBASE\"" - echo " HDF5_CFLAGS \"$CFLAGSBASE\"" - echo " HDF5_LDFLAGS \"$LDFLAGSBASE\"" - echo " HDF5_LIBS \"$LIBSBASE\"" - echo " " - echo " Note that adding library paths to HDF5_LDFLAGS where another hdf5 version" - echo " is located may link your program with that other hdf5 library version." - echo " " - exit $EXIT_FAILURE -} - -# Show the configuration summary of the library recorded in the -# libhdf5.settings file reside in the lib directory. -showconfigure() -{ - cat ${libdir}/libhdf5.settings - status=$? -} - -# Main -status=$EXIT_SUCCESS - -if test "$#" = "0"; then - # No parameters specified, issue usage statement and exit. - usage -fi - -case "$CC" in - gcc) - kind="gcc" - ;; - mpicc|mpcc|mpicc_r) - # Is this gcc masquerading as an MPI compiler? - if test "`${CC} -v 2>&1 | sed -n 2p | cut -c1-3`" = "gcc"; then - kind="gcc" - else - # Nope - kind="$host_os" - fi - ;; - *) - kind="$host_os" - ;; -esac - -for arg in "$@" ; do - if test "x$get_output_file" = "xyes"; then - link_args="$link_args $arg" - output_file="$arg" - get_output_file="no" - continue - fi - - case "$arg" in - -c) - compile_args="$compile_args $arg" - - if test "x$do_link" = "xyes" -a -n "$output_file"; then - compile_args="$compile_args -o $output_file" - fi - - do_link="no" - dash_c="-c" - ;; - -o) - if test "x$dash_c" = "x-c"; then - compile_args="$compile_args $arg" - else - link_args="$link_args $arg" - do_link="yes" - get_output_file="yes" - fi - ;; - -E|-M|-MT) - compile_args="$compile_args $arg" - dash_c="-c" - do_link="no" - ;; - -l*) - libraries=" $libraries $arg " - ;; - -prefix=*) - prefix="`expr "$arg" : '-prefix=\(.*\)'`" - ;; - -echo) - set -x - ;; - -show) - SHOW="echo" - ;; - -showconfig) - showconfigure - exit $status - ;; - -shlib) - USE_SHARED_LIB="yes" - ;; - -noshlib) - USE_SHARED_LIB="no" - ;; - -help) - usage - ;; - --help) - usage - ;; - -h) - usage - ;; - *\"*) - qarg="'"$arg"'" - qargs="$qargs $qarg" - ;; - *\'*) - qarg='"'"$arg"'"' - qargs="$qargs $qarg" - ;; - *\ *) - qarg=$arg - qargs="$qargs $qarg" - ;; - *) - if test -s "$arg"; then - ext=`expr "$arg" : '.*\(\..*\)'` - - if test "x$ext" = "x.c"; then - do_compile="yes" - compile_args="$compile_args $arg" - fname=`basename $arg .c` - link_objs="$link_objs $fname.o" - elif test "x$ext" = "x.o"; then - if test "x$dash_c" = "x-c"; then - compile_args="$compile_args $arg" - else - do_link="yes" - link_objs="$link_objs $arg" - fi - elif test "x$ext" = "x.a"; then - # This is an archive that we're linking in - libraries=" $libraries $arg " - else - compile_args="$compile_args $arg" - link_args="$link_args $arg" - fi - else - compile_args="$compile_args $arg" - link_args="$link_args $arg" - fi - ;; - esac -done -link_args="$link_args $qargs" -if test "$dash_c" = "-c" -a "$do_compile" = no -a "$do_link" = no ; then - # -c was specified. Force do_compile on. - do_compile=yes -fi - -if test "x$do_compile" = "xyes"; then - if test "x$dash_c" = "x"; then - dash_c="-c" - fi - $SHOW $CC -I$includedir $H5BLD_CPPFLAGS $CPPFLAGS $H5BLD_CFLAGS $CFLAGS $dash_c $qargs $compile_args - status=$? - - if test "$status" != "0"; then - exit $status - fi -fi - -if test "x$do_link" = "xyes"; then - shared_link="" -# conditionally link with the hl library - if test "X$HL" = "Xhl"; then - libraries=" $libraries -lhdf5_hl -lhdf5 " - else - libraries=" $libraries -lhdf5 " - fi - link_args="$link_args -L${libdir}" - - if test "x$USE_SHARED_LIB" = "xyes"; then - case "$kind" in - gcc|linux*) - # MacOS X doesn't support the "-Wl,-rpath -Wl," style of linker flags. - # It appears to want none of them specified. - case "$host_os" in - darwin*) flag="" ;; - *) flag="-Wl,-rpath -Wl," ;; - esac - ;; - hpux*) flag="-Wl,+b -Wl," ;; - freebsd*|solaris*) flag="-R" ;; - rs6000*|aix*) flag="-L" ;; - sgi) flag="-rpath " ;; - *) flag="" ;; - esac - - if test -n "$flag"; then - shared_link="${flag}${libdir}" - fi - else - # The "-lhdf5" & "-lhdf5_hl" flags are in here already...This is a static - # compile though, so change it to the static version (.a) of the library. - new_libraries="" - for lib in $libraries; do - case "$lib" in - -lhdf5) - new_libraries="$new_libraries ${libdir}/libhdf5.a" - ;; - -lhdf5_hl) - new_libraries="$new_libraries ${libdir}/libhdf5_hl.a" - ;; - *) - new_libraries="$new_libraries $lib" - ;; - esac - done - libraries="$new_libraries" - fi - - for lib in $libraries; do - if echo $link_args | grep " $lib " > /dev/null || - echo $link_args | grep " $lib$" > /dev/null; then - : - else - link_args="$link_args $lib " - fi - done - - # The LIBS are just a bunch of -l* libraries necessary for the HDF5 - # module. It's okay if they're included twice in the compile line. - link_args="$link_args $H5BLD_LDFLAGS $H5BLD_LIBS" - - # User's CPPFLAGS and CFLAGS come after their H5BLD counterparts. User's - # LDFLAGS come just before clibpath, user's LIBS come after $link_objs and - # before the hdf5 libraries in $link_args, followed by any external library - # paths and libraries from AM_LDFLAGS, LDFLAGS, AM_LIBS or LIBS carried in - # from the hdf5 build. The order of the flags is intended to give precedence - # to the user's flags. - $SHOW $CLINKER $H5BLD_CPPFLAGS $CPPFLAGS $H5BLD_CFLAGS $CFLAGS $LDFLAGS $clibpath $link_objs $LIBS $link_args $shared_link - status=$? -fi - -exit $status diff --git a/bin/h5redeploy.in b/bin/h5redeploy.in deleted file mode 100644 index f4f518af6f1..00000000000 --- a/bin/h5redeploy.in +++ /dev/null @@ -1,215 +0,0 @@ -#! /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 LICENSE 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. -# - -## Update HDF5 compiler tools after the HDF5 software has been installed ## -## in a new location. ## -## For help page, use "h5redeploy -help" ## -## ## - -# Constants definitions -EXIT_SUCCESS=0 -EXIT_FAILURE=1 - -# Function definitions - -# show help page -usage() { - # A wonderfully informative "usage" message. - echo "usage: $prog_name [OPTIONS]" - echo " OPTIONS:" - echo " -help|help This help message" - echo " -echo Show all the shell commands executed" - echo " -force No prompt, just do it" - echo " -prefix=DIR New directory to find HDF5 lib/ and include/" - echo " subdirectories [default: current directory]" - echo " -exec-prefix=DIR New directory to find HDF5 lib/" - echo " subdirectory [default: ]" - echo " -libdir=DIR New directory for the HDF5 lib directory" - echo " [default: /lib]" - echo " -includedir=DIR New directory for the HDF5 header files" - echo " [default: /include]" - echo " -tool=TOOL Tool to update. TOOL must be in the current" - echo " directory and writable. [default: $h5tools]" - echo " -show Show the commands without executing them" - echo " " - exit $EXIT_FAILURE -} - -# display variable values -dump_vars(){ - echo "====Showing all variable values=====" - echo prefix=$prefix - echo h5tools=$h5tools - echo "====End Showing=====" -} - -# show actions to be taken -show_action() -{ - echo "Update the following tools because they are now installed at a new directory" - for t in $foundtools; do - echo "${t}:" - echo " current setting=`sed -e '/^prefix=/s/prefix=//p' -e d $t`" - echo " new setting="\""$prefix"\" - done -} - - -# Report Error message -ERROR() -{ - echo "***ERROR***" - echo "$1" -} - -# Main -# -############################################################################ -## Installation directories: ## -## prefix architecture-independent files. ## -## exec_prefix architecture-dependent files, default is . ## -## libdir libraries, default is /lib. ## -## includedir header files, default is . ## -## Not used here: ## -## bindir executables, . ## -############################################################################ -# Initialization -h5tools="h5cc h5pcc h5fc h5pfc h5c++" # possible hdf5 tools -foundtools= # tools found and will be modified -fmode= # force mode, default is off -prefix= -exec_prefix= -libdir= -includedir= - -# Parse options -for arg in $@ ; do - case "$arg" in - -prefix=*) - prefix="`echo $arg | cut -f2 -d=`" - ;; - -exec-prefix=*) - exec_prefix="`echo $arg | cut -f2 -d=`" - ;; - -libdir=*) - libdir="`echo $arg | cut -f2 -d=`" - ;; - -includedir=*) - includedir="`echo $arg | cut -f2 -d=`" - ;; - -echo) - set -x - ;; - -show) - SHOW="echo" - ;; - -tool=*) - h5tools="`echo $arg | cut -f2 -d=`" - ;; - -help|help) - usage - ;; - -force) - fmode=yes - ;; - *) - ERROR "Unknown Option($arg)" - usage - exit $EXIT_FAILURE - ;; - esac -done - -# Set to default value, one above where i am, if not given by user -if [ -z "$prefix" ]; then - prefix=`(cd ..;pwd)` -fi -if [ -z "$exec_prefix" ]; then - exec_prefix='${prefix}' # use single quotes to prevent expansion of $ -fi -if [ -z "$libdir" ]; then - libdir='${exec_prefix}'/lib # use single quotes to prevent expansion of $ -fi -if [ -z "$includedir" ]; then - includedir='${prefix}'/include # use single quotes to prevent expansion of $ -fi - -for x in $h5tools; do - if [ -f $x ]; then - foundtools="$foundtools $x" - if [ ! -w $x ]; then - ERROR "h5tool($x) is not writable" - exit $EXIT_FAILURE - fi - fi -done - -if [ -z "$foundtools" ]; then - ERROR "found no tools to modify" - exit $EXIT_FAILURE -fi - -# Show actions to be taken and get consent -show_action -# Ask confirmation unless fmode is on -if [ x-$fmode = x- ]; then - echo "Continue? (yes/no)" - read ansx - ans=`echo $ansx | tr "[A-Z]" "[a-z]"` - if [ x-$ans != x-yes ]; then - echo ABORT. No tools changed. - exit $EXIT_FAILURE - fi -fi - - -# Create the update commands -CMDFILE=/tmp/h5redeploy.$$ -touch $CMDFILE -chmod 0600 $CMDFILE -echo "/^prefix=/c" >> $CMDFILE -echo prefix=\""$prefix"\" >> $CMDFILE -echo . >> $CMDFILE -echo "/^exec_prefix=/c" >> $CMDFILE -echo exec_prefix=\""$exec_prefix"\" >> $CMDFILE -echo . >> $CMDFILE -echo "/^libdir=/c" >> $CMDFILE -echo libdir=\""$libdir"\" >> $CMDFILE -echo . >> $CMDFILE -echo "/^includedir=/c" >> $CMDFILE -echo includedir=\""$includedir"\" >> $CMDFILE -echo . >> $CMDFILE -(echo w; echo q) >> $CMDFILE - - -# Update them -if [ "$SHOW" = "echo" ]; then - echo "===Update commands are:====" - cat $CMDFILE - echo "===End Update commands=====" -fi - -for t in $foundtools; do - echo Update $t ... - COMMAND="ed - $t" - if [ "$SHOW" = "echo" ]; then - echo $COMMAND - else - $COMMAND < $CMDFILE - fi -done - - -# Cleanup -rm -f $CMDFILE -exit $EXIT_SUCCESS diff --git a/c++/src/CMakeLists.txt b/c++/src/CMakeLists.txt index 10e02862463..08b90e0981c 100644 --- a/c++/src/CMakeLists.txt +++ b/c++/src/CMakeLists.txt @@ -205,7 +205,7 @@ install ( COMPONENT cpplibraries ) -if (NOT WIN32 AND NOT MINGW) +if (H5_HAVE_PKGCONFIG AND NOT HDF5_BUILD_HL_LIB) set (_PKG_CONFIG_COMPILER ${HDF5_H5CC_CXX_COMPILER}) configure_file ( ${HDF_CONFIG_DIR}/libh5cc.in diff --git a/config/ConfigureChecks.cmake b/config/ConfigureChecks.cmake index 65b8c8de5ba..6b94cebe912 100644 --- a/config/ConfigureChecks.cmake +++ b/config/ConfigureChecks.cmake @@ -1094,3 +1094,14 @@ endif () if (NOT ${HDF_PREFIX}_HAVE__FLOAT16) set (HDF5_ENABLE_NONSTANDARD_FEATURE_FLOAT16 OFF CACHE BOOL "Enable support for _Float16 C datatype" FORCE) endif () + +#----------------------------------------------------------------------------- +# Check if the platform has pkg-config support +find_package(PkgConfig) +if (PKG_CONFIG_FOUND) + set (${HDF_PREFIX}_HAVE_PKGCONFIG 1) +else () + set (${HDF_PREFIX}_HAVE_PKGCONFIG 0) +endif () + +#----------------------------------------------------------------------------- \ No newline at end of file diff --git a/doxygen/dox/IntroHDF5.dox b/doxygen/dox/IntroHDF5.dox index c80c2e242ac..b0008355e52 100644 --- a/doxygen/dox/IntroHDF5.dox +++ b/doxygen/dox/IntroHDF5.dox @@ -200,7 +200,7 @@ as providing templates for storing objects. Following is a list of the High Leve \subsubsection subsec_intro_desc_soft_tools Tools Useful tools for working with HDF5 files include: \li \ref sec_cltools_h5dump : A utility to dump or display the contents of an HDF5 File -\li h5cc, h5c++, h5fc : Unix scripts for compiling applications +\li h5cc, h5c++, h5fc : pkg-config based shell scripts for compiling applications \li HDFView : A java browser to view HDF (HDF4 and HDF5) files

h5dump

diff --git a/doxygen/dox/LearnBasics3.dox b/doxygen/dox/LearnBasics3.dox index 8a4fc161c73..e188a5f55ce 100644 --- a/doxygen/dox/LearnBasics3.dox +++ b/doxygen/dox/LearnBasics3.dox @@ -738,18 +738,18 @@ This tutorial section will discuss the use of compile scripts on Linux. See the \ref secLBCompilingVS section for compiling with Visual Studio. \section secLBCompilingLinux Compile Scripts -When the library is built, the following compile scripts are included: -\li h5cc: compile script for HDF5 C programs -\li h5fc: compile script for HDF5 F90 programs -\li h5c++: compile script for HDF5 C++ programs +When the library is built, the following compile shell scripts are included: +\li h5cc: pkg-config based compile shell script for HDF5 C programs +\li h5fc: pkg-config based compile shell script for HDF5 F90 programs +\li h5c++: pkg-config based compile shell script for HDF5 C++ programs These scripts are easily used to compile single file applications, such as those included in the tutorial. -
Warning The h5cc/h5fc/h5c++ compile scripts are included when building with configure. Versions of -these compile scripts have also been added to CMake for Linux ONLY. The CMake versions rely on pkgconfig files. +The h5cc/h5fc/h5c++ pkg-config compile scripts are included when building with configure. These +versions rely on the pkg-config files in the lib/pkgconfig.
@@ -771,7 +771,7 @@ To see how the libraries linked in with a compile script were configured and bui \endcode

Detailed Description of Unix Compile Scripts:

-The h5cc, h5c++, and h5fc compile scripts come with the HDF5 binary distributions (include files, +The h5cc, h5c++, and h5fc pkg-config compile scripts come with the HDF5 binary distributions (include files, libraries, and utilities) for the platforms we support. The h5c++ and h5fc utilities are ONLY present if the library was built with C++ and Fortran. diff --git a/fortran/src/CMakeLists.txt b/fortran/src/CMakeLists.txt index a765baea5c0..c1b106ede4d 100644 --- a/fortran/src/CMakeLists.txt +++ b/fortran/src/CMakeLists.txt @@ -617,7 +617,7 @@ install ( COMPONENT fortlibraries ) -if (NOT WIN32 AND NOT MINGW) +if (H5_HAVE_PKGCONFIG AND NOT HDF5_BUILD_HL_LIB) set (_PKG_CONFIG_COMPILER ${HDF5_H5CC_Fortran_COMPILER}) configure_file ( ${HDF_CONFIG_DIR}/libh5cc.in diff --git a/hl/c++/src/CMakeLists.txt b/hl/c++/src/CMakeLists.txt index bba872ffc62..38c3a1cee53 100644 --- a/hl/c++/src/CMakeLists.txt +++ b/hl/c++/src/CMakeLists.txt @@ -123,17 +123,17 @@ install ( COMPONENT hlcpplibraries ) -if (NOT WIN32 AND NOT MINGW) +if (H5_HAVE_PKGCONFIG) set (_PKG_CONFIG_COMPILER ${HDF5_H5CC_CXX_COMPILER}) configure_file ( ${HDF_CONFIG_DIR}/libh5cc.in - ${HDF5_BINARY_DIR}/CMakeFiles/h5hlc++ + ${HDF5_BINARY_DIR}/CMakeFiles/h5c++ @ONLY ) install ( - FILES ${HDF5_BINARY_DIR}/CMakeFiles/h5hlc++ + FILES ${HDF5_BINARY_DIR}/CMakeFiles/h5c++ DESTINATION ${HDF5_INSTALL_BIN_DIR} PERMISSIONS OWNER_READ OWNER_WRITE OWNER_EXECUTE GROUP_READ GROUP_EXECUTE WORLD_READ WORLD_EXECUTE - COMPONENT hlcpplibraries + COMPONENT cpplibraries ) endif () diff --git a/hl/fortran/src/CMakeLists.txt b/hl/fortran/src/CMakeLists.txt index a068d472077..6e96e9f0193 100644 --- a/hl/fortran/src/CMakeLists.txt +++ b/hl/fortran/src/CMakeLists.txt @@ -366,17 +366,30 @@ install ( COMPONENT hlfortlibraries ) -if (NOT WIN32 AND NOT MINGW) +if (H5_HAVE_PKGCONFIG) set (_PKG_CONFIG_COMPILER ${HDF5_H5CC_Fortran_COMPILER}) configure_file ( ${HDF_CONFIG_DIR}/libh5cc.in - ${HDF5_BINARY_DIR}/CMakeFiles/h5hlfc + ${HDF5_BINARY_DIR}/CMakeFiles/h5fc @ONLY ) install ( - FILES ${HDF5_BINARY_DIR}/CMakeFiles/h5hlfc + FILES ${HDF5_BINARY_DIR}/CMakeFiles/h5fc DESTINATION ${HDF5_INSTALL_BIN_DIR} PERMISSIONS OWNER_READ OWNER_WRITE OWNER_EXECUTE GROUP_READ GROUP_EXECUTE WORLD_READ WORLD_EXECUTE - COMPONENT hlfortlibraries + COMPONENT fortlibraries ) + if (HDF5_ENABLE_PARALLEL AND MPI_Fortran_FOUND) + configure_file ( + ${HDF_CONFIG_DIR}/libh5cc.in + ${HDF5_BINARY_DIR}/CMakeFiles/h5pfc + @ONLY + ) + install ( + FILES ${HDF5_BINARY_DIR}/CMakeFiles/h5pfc + DESTINATION ${HDF5_INSTALL_BIN_DIR} + PERMISSIONS OWNER_READ OWNER_WRITE OWNER_EXECUTE GROUP_READ GROUP_EXECUTE WORLD_READ WORLD_EXECUTE + COMPONENT fortlibraries + ) + endif () endif () diff --git a/hl/src/CMakeLists.txt b/hl/src/CMakeLists.txt index 1544efacedd..3d6f8c850f5 100644 --- a/hl/src/CMakeLists.txt +++ b/hl/src/CMakeLists.txt @@ -155,19 +155,33 @@ install ( COMPONENT hllibraries ) -if (NOT WIN32 AND NOT MINGW) +if (H5_HAVE_PKGCONFIG) set (_PKG_CONFIG_COMPILER ${HDF5_H5CC_C_COMPILER}) configure_file ( ${HDF_CONFIG_DIR}/libh5cc.in - ${HDF5_BINARY_DIR}/CMakeFiles/h5hlcc + ${HDF5_BINARY_DIR}/CMakeFiles/h5cc @ONLY ) install ( - FILES ${HDF5_BINARY_DIR}/CMakeFiles/h5hlcc + FILES ${HDF5_BINARY_DIR}/CMakeFiles/h5cc DESTINATION ${HDF5_INSTALL_BIN_DIR} PERMISSIONS OWNER_READ OWNER_WRITE OWNER_EXECUTE GROUP_READ GROUP_EXECUTE WORLD_READ WORLD_EXECUTE - COMPONENT hllibraries + COMPONENT libraries ) + if (HDF5_ENABLE_PARALLEL AND MPI_C_FOUND) + #legacy requires a different name + configure_file ( + ${HDF_CONFIG_DIR}/libh5cc.in + ${HDF5_BINARY_DIR}/CMakeFiles/h5pcc + @ONLY + ) + install ( + FILES ${HDF5_BINARY_DIR}/CMakeFiles/h5pcc + DESTINATION ${HDF5_INSTALL_BIN_DIR} + PERMISSIONS OWNER_READ OWNER_WRITE OWNER_EXECUTE GROUP_READ GROUP_EXECUTE WORLD_READ WORLD_EXECUTE + COMPONENT libraries + ) + endif () endif () #----------------------------------------------------------------------------- diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index 6401b738633..672a2bdb663 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -1376,7 +1376,7 @@ install ( COMPONENT libraries ) -if (NOT WIN32) +if (H5_HAVE_PKGCONFIG AND NOT HDF5_BUILD_HL_LIB) set (_PKG_CONFIG_COMPILER ${HDF5_H5CC_C_COMPILER}) configure_file ( ${HDF_CONFIG_DIR}/libh5cc.in