diff options
Diffstat (limited to 'bin/cmakehdf5')
-rwxr-xr-x | bin/cmakehdf5 | 488 |
1 files changed, 111 insertions, 377 deletions
diff --git a/bin/cmakehdf5 b/bin/cmakehdf5 index 772e54c..6e22e17 100755 --- a/bin/cmakehdf5 +++ b/bin/cmakehdf5 @@ -12,8 +12,6 @@ DPRINT=: #DPRINT=echo -# use the ctest scripting method if --script is given -if [ "$1" != "--script" ]; then # variable names # The "extra" number is the step number and easier to see all logfiles in # the sorted order of steps @@ -126,12 +124,12 @@ STEP() echo "$banner" with output saved in $logfile (TIMESTAMP; nerror=0 ; - echo "eval $command" - eval $command || nerror=1 ; - TIMESTAMP; exit $nerror) < /dev/null > "$logfile" 2>&1 + echo "eval $command" + eval $command || nerror=1 ; + TIMESTAMP; exit $nerror) < /dev/null > "$logfile" 2>&1 if [ $? -ne 0 ]; then - echo "error in '$banner'. $progname aborted." - exit 1 + echo "error in '$banner'. $progname aborted." + exit 1 fi } @@ -145,26 +143,26 @@ INSTALL_HDF5() { myos="`uname -s`" case "$myos" in - Linux) - install_file=./HDF5-${version}-Linux.sh - $install_file --skip-license $* - ;; - Darwin) # Mac OSX DMG file - install_file=HDF5-${version}-Darwin.dmg - test -d hdf5 || mkdir hdf5 - basename=`basename $install_file .dmg` - # mount the DMG file as /Volumes/$basename - # echo 'Y' as yes for license. - echo Y | hdiutil mount $install_file - # copy the contents to the install location - cp -R "/Volumes/$basename/HDF_Group" hdf5 - # unmount the DMG file - hdiutil unmount /Volumes/$basename - ;; - *) # unknown/unsupported OS. - echo "INSTALL_HDF5: Error--unknown/unsupported OS($myos)" - return 1 - ;; + Linux) + install_file=./HDF5-${version}-Linux.sh + $install_file --skip-license $* + ;; + Darwin) # Mac OSX DMG file + install_file=HDF5-${version}-Darwin.dmg + test -d hdf5 || mkdir hdf5 + basename=`basename $install_file .dmg` + # mount the DMG file as /Volumes/$basename + # echo 'Y' as yes for license. + echo Y | hdiutil mount $install_file + # copy the contents to the install location + cp -R "/Volumes/$basename/HDF_Group" hdf5 + # unmount the DMG file + hdiutil unmount /Volumes/$basename + ;; + *) # unknown/unsupported OS. + echo "INSTALL_HDF5: Error--unknown/unsupported OS($myos)" + return 1 + ;; esac } @@ -174,14 +172,14 @@ INSTALL_HDF5() DUMP_LOGFILE() { for x in $*; do - if [ -f $x ]; then - echo "==================================" - echo "Dumping $x" - echo "==================================" - cat $x - echo "==== END $x =====" - echo - fi + if [ -f $x ]; then + echo "==================================" + echo "Dumping $x" + echo "==================================" + cat $x + echo "==== END $x =====" + echo + fi done } @@ -209,84 +207,84 @@ fi # tools Build tools while [ $# -gt 0 ]; do case "$1" in - --enable-fortran) - build_fortran=-DHDF5_BUILD_FORTRAN:BOOL=ON - ;; - --disable-fortran) - build_fortran=-DHDF5_BUILD_FORTRAN:BOOL=OFF - ;; - --enable-cxx) - build_cpp_lib=-DHDF5_BUILD_CPP_LIB:BOOL=ON - ;; - --disable-cxx) - build_cpp_lib=-DHDF5_BUILD_CPP_LIB:BOOL=OFF - ;; - --enable-hl) - build_hl_lib=-DHDF5_BUILD_HL_LIB:BOOL=ON - ;; - --disable-hl) - build_hl_lib=-DHDF5_BUILD_HL_LIB:BOOL=OFF - ;; - --enable-shared) - shared_lib=-DBUILD_SHARED_LIBS:BOOL=ON - ;; - --disable-shared) - shared_lib=-DBUILD_SHARED_LIBS:BOOL=OFF - ;; - --enable-tools) - build_tools=-DHDF5_BUILD_TOOLS:BOOL=ON - ;; - --disable-tools) - build_tools=-DHDF5_BUILD_TOOLS:BOOL=OFF - ;; - --enable-testing) - build_testing=-DBUILD_TESTING:BOOL=ON - ;; - --disable-testing) - build_testing=-DBUILD_TESTING:BOOL=OFF - ;; - --with-zlib) - with_zlib=-DHDF5_ENABLE_Z_LIB_SUPPORT:BOOL=ON - ;; - --with-zlib=*) - xarg=`echo $1 | cut -d= -f2-` - with_zlib="-DHDF5_ENABLE_Z_LIB_SUPPORT:BOOL=ON -DZLIB_ROOT=$xarg" - ;; - --without-zlib) - with_zlib=-DHDF5_ENABLE_Z_LIB_SUPPORT:BOOL=OFF - ;; - --with-szlib) - with_szlib=-DHDF5_ENABLE_SZIP_SUPPORT:BOOL=ON - szlib_path="" # szlib is in default paths - ;; - --with-szlib=*) - xarg=`echo $1 | cut -d= -f2-` - with_szlib="-DHDF5_ENABLE_SZIP_SUPPORT:BOOL=ON" - szlib_path="SZIP_INSTALL=$xarg" - ;; - --without-szlib) - with_szlib=-DHDF5_ENABLE_SZIP_SUPPORT:BOOL=OFF - szlib_path="" # reset the path - ;; - --njobs=*) - njobs=`echo $1 | cut -d= -f2-` - ;; - --enable-verbose) - vflag=1 - ;; - --disable-verbose) - vflag=0 - ;; - --help) - # print the detail help page and exit - HELP - exit 0 - ;; - *) - echo "Unknown options: $1" - HELP - exit 1 - ;; + --enable-fortran) + build_fortran=-DHDF5_BUILD_FORTRAN:BOOL=ON + ;; + --disable-fortran) + build_fortran=-DHDF5_BUILD_FORTRAN:BOOL=OFF + ;; + --enable-cxx) + build_cpp_lib=-DHDF5_BUILD_CPP_LIB:BOOL=ON + ;; + --disable-cxx) + build_cpp_lib=-DHDF5_BUILD_CPP_LIB:BOOL=OFF + ;; + --enable-hl) + build_hl_lib=-DHDF5_BUILD_HL_LIB:BOOL=ON + ;; + --disable-hl) + build_hl_lib=-DHDF5_BUILD_HL_LIB:BOOL=OFF + ;; + --enable-shared) + shared_lib=-DBUILD_SHARED_LIBS:BOOL=ON + ;; + --disable-shared) + shared_lib=-DBUILD_SHARED_LIBS:BOOL=OFF + ;; + --enable-tools) + build_tools=-DHDF5_BUILD_TOOLS:BOOL=ON + ;; + --disable-tools) + build_tools=-DHDF5_BUILD_TOOLS:BOOL=OFF + ;; + --enable-testing) + build_testing=-DBUILD_TESTING:BOOL=ON + ;; + --disable-testing) + build_testing=-DBUILD_TESTING:BOOL=OFF + ;; + --with-zlib) + with_zlib=-DHDF5_ENABLE_Z_LIB_SUPPORT:BOOL=ON + ;; + --with-zlib=*) + xarg=`echo $1 | cut -d= -f2-` + with_zlib="-DHDF5_ENABLE_Z_LIB_SUPPORT:BOOL=ON -DZLIB_ROOT=$xarg" + ;; + --without-zlib) + with_zlib=-DHDF5_ENABLE_Z_LIB_SUPPORT:BOOL=OFF + ;; + --with-szlib) + with_szlib=-DHDF5_ENABLE_SZIP_SUPPORT:BOOL=ON + szlib_path="" # szlib is in default paths + ;; + --with-szlib=*) + xarg=`echo $1 | cut -d= -f2-` + with_szlib="-DHDF5_ENABLE_SZIP_SUPPORT:BOOL=ON" + szlib_path="SZIP_INSTALL=$xarg" + ;; + --without-szlib) + with_szlib=-DHDF5_ENABLE_SZIP_SUPPORT:BOOL=OFF + szlib_path="" # reset the path + ;; + --njobs=*) + njobs=`echo $1 | cut -d= -f2-` + ;; + --enable-verbose) + vflag=1 + ;; + --disable-verbose) + vflag=0 + ;; + --help) + # print the detail help page and exit + HELP + exit 0 + ;; + *) + echo "Unknown options: $1" + HELP + exit 1 + ;; esac shift done @@ -353,267 +351,3 @@ exit_code=$? # Show a closing time stamp TIMESTAMP exit $exit_code - -else -# --------------- -# older version -# --------------- - -# variable names -progname=`basename $0` # program name -cminfile="cmakemin.$$" # Cmake minimum file -cfgfile=$progname.$$ # configure file -ctest_log=ctest.log # output of ctest script -install_log=install.log # output of installation -$DPRINT $cfgfile - -# Remove temporary generated files if exit 0 -trap "rm -f $cminfile $cfgfile" 0 - -#============= -# Function definitions -#============= -TIMESTAMP() -{ - echo "=====" "`date`" "=====" -} - - -#========== -# main -#========== -# Show a start time stamp -TIMESTAMP - -# Explain what and where log files are. -cat <<EOF -$ctest_log: output of ctest script. -$install_log: output of installation -Log files will be stored in Testing/Temporary: - LastConfigure_<timestamp>.log: output of configure - LastBuild_<timestamp>.log: output of build - LastTest_<timestamp>.log: output of testing - LastTestsFailed_<timestamp>.log: list of failed tests - -EOF - -# First generate the two needed input files, the $cimnfile and $cfgfile. -# Then use ctest to use the two input files. - -#========== -# create the configure file -#========== -# Create the cmake minimum required file to be used by the following -# configure file. Though not absolute needed, it is better to generate -# this file before the configure file. Quote the EOF to preven substitution -# in the text. -#========== -#========== -cat > $cfgfile <<'EOF' -cmake_minimum_required(VERSION 3.1.0 FATAL_ERROR) -######################################################## -# This dashboard is maintained by The HDF Group -# For any comments please contact cdashhelp@hdfgroup.org -# -######################################################## - -set (CTEST_DASHBOARD_ROOT ${CTEST_SCRIPT_DIRECTORY}) -set (CTEST_SOURCE_DIRECTORY "../hdf5") -set (CTEST_BINARY_DIRECTORY ".") -set (CTEST_CMAKE_GENERATOR "Unix Makefiles") -set (CTEST_BUILD_CONFIGURATION "Release") -set (CTEST_MAX_N 8) - -# -- CDash variables -set (LOCAL_NO_SUBMIT TRUE) # No CDash submit. -set (MODEL "Experimental") -set (CDASH_LOCAL TRUE) -set (SITE_BUILDNAME_SUFFIX "cmakehdf5") - -# -- URL set for internal check, default is to not update -set (LOCAL_SKIP_UPDATE TRUE) -set (REPOSITORY_URL "http://svn.${hdfgroup_url}/hdf5/branches/hdf5_1_8") -# -- Standard build options -set (ADD_BUILD_OPTIONS "-DCMAKE_INSTALL_PREFIX:PATH=${CTEST_BINARY_DIRECTORY} -DHDF5_ALLOW_EXTERNAL_SUPPORT:STRING=\"SVN\" -DHDF5_PACKAGE_EXTLIBS:BOOL=ON") - -# Use multiple CPU cores to build -include(ProcessorCount) -ProcessorCount(N) -if(NOT N EQUAL 0) - if(N GREATER ${CTEST_MAX_N}) - set(N ${CTEST_MAX_N}) - endif(N GREATER ${CTEST_MAX_N}) - set(CTEST_BUILD_FLAGS -j${N}) - set(ctest_test_args ${ctest_test_args} PARALLEL_LEVEL ${N}) -endif() - -# ----------------------------------------------------------- -# -- Get environment -# ----------------------------------------------------------- - ## -- set hostname - ## -------------------------- - find_program (HOSTNAME_CMD NAMES hostname) - exec_program (${HOSTNAME_CMD} ARGS OUTPUT_VARIABLE HOSTNAME) - set (CTEST_SITE "${HOSTNAME}${CTEST_SITE_EXT}") - find_program (UNAME NAMES uname) - macro (getuname name flag) - exec_program ("${UNAME}" ARGS "${flag}" OUTPUT_VARIABLE "${name}") - endmacro (getuname) - - getuname (osname -s) - getuname (osrel -r) - getuname (cpu -m) - - if (SITE_BUILDNAME_SUFFIX) - set (CTEST_BUILD_NAME "${osname}-${osrel}-${cpu}-${SITE_BUILDNAME_SUFFIX}") - else (SITE_BUILDNAME_SUFFIX) - set (CTEST_BUILD_NAME "${osname}-${osrel}-${cpu}") - endif (SITE_BUILDNAME_SUFFIX) -# ----------------------------------------------------------- - -set (BUILD_OPTIONS "${ADD_BUILD_OPTIONS} -DSITE:STRING=${CTEST_SITE} -DBUILDNAME:STRING=${CTEST_BUILD_NAME}") - -#----------------------------------------------------------------------------- -# MAC machines need special option -#----------------------------------------------------------------------------- -if (APPLE) - # Compiler choice - execute_process(COMMAND xcrun --find cc OUTPUT_VARIABLE XCODE_CC OUTPUT_STRIP_TRAILING_WHITESPACE) - execute_process(COMMAND xcrun --find c++ OUTPUT_VARIABLE XCODE_CXX OUTPUT_STRIP_TRAILING_WHITESPACE) - set(ENV{CC} "${XCODE_CC}") - set(ENV{CXX} "${XCODE_CXX}") - # Shared fortran is not supported, build static - set (BUILD_OPTIONS "${BUILD_OPTIONS} -DBUILD_SHARED_LIBS:BOOL=OFF -DCMAKE_ANSI_CFLAGS:STRING=-fPIC") - set (BUILD_OPTIONS "${BUILD_OPTIONS} -DCTEST_USE_LAUNCHERS:BOOL=ON -DCMAKE_BUILD_WITH_INSTALL_RPATH:BOOL=OFF") -endif (APPLE) - - -# ----------------------------------------------------------- -find_package (Subversion) -set (CTEST_UPDATE_COMMAND "${Subversion_SVN_EXECUTABLE}") -# -- Only clean build folder if LOCAL_CLEAR_BUILD is set -if (LOCAL_CLEAR_BUILD) - set (CTEST_START_WITH_EMPTY_BINARY_DIRECTORY TRUE) - if(NOT EXISTS "${CTEST_BINARY_DIRECTORY}") - file(MAKE_DIRECTORY "${CTEST_BINARY_DIRECTORY}") - else() - ctest_empty_binary_directory(${CTEST_BINARY_DIRECTORY}) - endif() -endif (LOCAL_CLEAR_BUILD) - -#----------------------------------------------------------------------------- -# Send the main script as a note. -list (APPEND CTEST_NOTES_FILES - "${CMAKE_CURRENT_LIST_FILE}" - "${CTEST_SOURCE_DIRECTORY}/config/cmake/cacheinit.cmake" - ) - -# Check for required variables. -foreach (req - CTEST_CMAKE_GENERATOR - CTEST_SITE - CTEST_BUILD_NAME - ) - if (NOT DEFINED ${req}) - message(FATAL_ERROR "The containing script must set ${req}") - endif (NOT DEFINED ${req}) -endforeach (req) - -## -- set output to english -set($ENV{LC_MESSAGES} "en_EN") - -#----------------------------------------------------------------------------- -# Initialize the CTEST commands -#------------------------------ -set (CTEST_CMAKE_COMMAND "\"${CMAKE_COMMAND}\"") -set (CTEST_CONFIGURE_COMMAND - "${CTEST_CMAKE_COMMAND} -C \"${CTEST_SOURCE_DIRECTORY}/config/cmake/cacheinit.cmake\" -DCMAKE_BUILD_TYPE:STRING=${CTEST_BUILD_CONFIGURATION} ${BUILD_OPTIONS} \"-G${CTEST_CMAKE_GENERATOR}\" \"${CTEST_SOURCE_DIRECTORY}\"") - -# Print summary information. -foreach (v - CTEST_SITE - CTEST_BUILD_NAME - CTEST_SOURCE_DIRECTORY - CTEST_BINARY_DIRECTORY - CTEST_CMAKE_GENERATOR - CTEST_BUILD_CONFIGURATION - CTEST_CONFIGURE_COMMAND - CTEST_SCRIPT_DIRECTORY - ) - set (vars "${vars} ${v}=[${${v}}]\n") -endforeach (v) -message ("Dashboard script configuration:\n${vars}\n") - -ctest_start (${MODEL} TRACK ${MODEL}) -if (NOT LOCAL_SKIP_UPDATE) - ctest_update (SOURCE "${CTEST_SOURCE_DIRECTORY}") -endif (NOT LOCAL_SKIP_UPDATE) -if(NOT res STREQUAL "0") - message (FATAL_ERROR "Configure FAILED") -endif() -message ("Configure DONE") -configure_file(${CTEST_SOURCE_DIRECTORY}/config/cmake/CTestCustom.cmake ${CTEST_BINARY_DIRECTORY}/CTestCustom.cmake) -ctest_read_custom_files ("${CTEST_BINARY_DIRECTORY}") -ctest_configure (BUILD "${CTEST_BINARY_DIRECTORY}" RETURN_VALUE res) -if (NOT LOCAL_NO_SUBMIT) - ctest_submit (PARTS Update Configure Notes) -endif (NOT LOCAL_NO_SUBMIT) -ctest_build (BUILD "${CTEST_BINARY_DIRECTORY}" APPEND RETURN_VALUE res) -if (NOT LOCAL_NO_SUBMIT) - ctest_submit (PARTS Build) -endif (NOT LOCAL_NO_SUBMIT) -if(NOT res STREQUAL "0") - message (FATAL_ERROR "Build FAILED") -endif() -message ("build DONE") -if (NOT LOCAL_SKIP_TEST) - ctest_build (BUILD "${CTEST_BINARY_DIRECTORY}" APPEND ${ctest_test_args} RETURN_VALUE res) - if (NOT LOCAL_NO_SUBMIT) - ctest_submit (PARTS Test) - endif (NOT LOCAL_NO_SUBMIT) - if(NOT res STREQUAL "0") - message (FATAL_ERROR "Test FAILED") - endif() - message ("test DONE") -endif (NOT LOCAL_SKIP_TEST) -if(NOT LOCAL_MEMCHECK_TEST) - ##----------------------------------------------- - ## Package the product - ##----------------------------------------------- - execute_process(COMMAND cpack -C ${CTEST_BUILD_CONFIGURATION} -V - WORKING_DIRECTORY ${CTEST_BINARY_DIRECTORY} - RESULT_VARIABLE cpackResult - OUTPUT_VARIABLE cpackLog - ERROR_VARIABLE cpackLog.err - ) - file(WRITE ${CTEST_BINARY_DIRECTORY}/cpack.log "${cpackLog.err}" "${cpackLog}") -endif(NOT LOCAL_MEMCHECK_TEST) -#----------------------------------------------------------------------------- - -message ("DONE") -EOF - - -# Run ctest -ctest -S $cfgfile -C Release -V -O $ctest_log -exit_code=$? -if [ $exit_code = 0 ]; then - echo CTest script completed without error -else - echo Error encountered CTest script -fi -# Using HDF5-*.sh because actual name is unavailable -install_sh=HDF5-*.sh -echo installing with $install_sh ... -./$install_sh --skip-license > $install_log -exit_code=$? -if [ $exit_code = 0 ]; then - echo Complete without error -else - echo Error encountered -fi -TIMESTAMP -exit $exit_code - -fi - |