2007-07-07 06:09:33 +08:00
|
|
|
@echo OFF
|
2007-10-02 00:08:11 +08:00
|
|
|
rem Copyright by The HDF Group.
|
|
|
|
rem Copyright by the Board of Trustees of the University of Illinois.
|
|
|
|
rem All rights reserved.
|
|
|
|
rem
|
|
|
|
rem This file is part of HDF5. The full HDF5 copyright notice, including
|
|
|
|
rem terms governing use, modification, and redistribution, is contained in
|
|
|
|
rem the files COPYING and Copyright.html. COPYING can be found at the root
|
|
|
|
rem of the source code distribution tree; Copyright.html can be found at the
|
|
|
|
rem root level of an installed copy of the electronic HDF5 document set and
|
|
|
|
rem is linked from the top-level documents page. It can also be found at
|
|
|
|
rem http://hdfgroup.org/HDF5/doc/Copyright.html. If you do not have
|
|
|
|
rem access to either file, you may request a copy from help@hdfgroup.org.
|
|
|
|
|
|
|
|
|
|
|
|
rem File Name: hdf5bt.bat
|
|
|
|
rem This batch file is used to build and test HDF5 Libraries and Tools.
|
|
|
|
rem This batch file takes the following options:
|
2008-07-03 03:40:00 +08:00
|
|
|
rem . /vs9 Build HDF5 using Visual Studio 2008
|
2007-10-02 00:08:11 +08:00
|
|
|
rem . /fort Build and test HDF5 with Fortran libraries
|
|
|
|
rem . /useenv Build HDF5 using compiler settings defined
|
2011-02-22 22:55:04 +08:00
|
|
|
rem . in the environment, rather than the IDE.
|
2009-10-13 04:16:31 +08:00
|
|
|
rem . /ivf101 Build HDF5 Fortran using Intel Visual Fortran 10.1
|
|
|
|
rem . /log Log the build and test results in files defined by
|
2008-05-01 03:51:13 +08:00
|
|
|
rem . environment variables HDF5BUILD_LOG and
|
|
|
|
rem . HDF5CHECK_LOG
|
2007-10-02 00:08:11 +08:00
|
|
|
rem . /? Help information
|
|
|
|
|
|
|
|
rem This batch file makes the following assumptions:
|
|
|
|
rem - The appropriate version of Visual Studio is installed and setup
|
|
|
|
rem - The directory structure is setup from a fresh source copy
|
|
|
|
rem - copy_hdf.bat has already been run from the ./windows directory
|
|
|
|
rem - Visual Studio already contains the required paths for external libraries
|
|
|
|
rem - szip and zlib DLLs are already placed in an accessible directory
|
|
|
|
rem - hdf5_ext_szip or hdf5_ext_zlib have been set accordingly
|
|
|
|
rem - if building with the /useenv option, szip and zlib paths have been added
|
|
|
|
rem to %include% and %libpath% as necessary.
|
2008-05-01 03:51:13 +08:00
|
|
|
rem - if using the /log option, hdf5build_log and hdf5_check log should be defined
|
|
|
|
rem - in the environment.
|
2008-05-14 22:46:44 +08:00
|
|
|
rem - The target platform architecture is specified in the environment
|
|
|
|
rem variable PROCESSOR_ARCHITECTURE
|
2007-10-02 00:08:11 +08:00
|
|
|
|
|
|
|
rem By default, only C and C++ libraries are built and tested.
|
|
|
|
|
|
|
|
setlocal enabledelayedexpansion
|
|
|
|
pushd %~dp0
|
|
|
|
|
|
|
|
set nerrors=0
|
2008-05-01 03:51:13 +08:00
|
|
|
if "%1"=="/?" goto help
|
2007-10-02 00:08:11 +08:00
|
|
|
goto main
|
|
|
|
|
|
|
|
rem Print a help message
|
2007-07-07 06:09:33 +08:00
|
|
|
:help
|
|
|
|
|
2007-07-14 04:54:54 +08:00
|
|
|
echo.Builds and tests HDF5 Libraries and Tools.
|
|
|
|
echo.
|
2007-10-02 00:08:11 +08:00
|
|
|
echo Usage: %~nx0 [OPTION]
|
2007-07-14 04:54:54 +08:00
|
|
|
echo.
|
2008-07-03 03:40:00 +08:00
|
|
|
echo. /vs9 Build HDF5 using Visual Studio 2008
|
2007-10-02 00:08:11 +08:00
|
|
|
echo. /fort Build and test HDF5 with Fortran libraries
|
2008-07-01 03:13:27 +08:00
|
|
|
echo. /ivf101 Build HDF5 Fortran using Intel Visual Fortran 10.1
|
2007-10-02 00:08:11 +08:00
|
|
|
echo. /useenv Build HDF5 using compiler settings defined
|
|
|
|
echo. in the environment, rather than the IDE.
|
|
|
|
echo. /? Help information
|
2007-07-07 06:09:33 +08:00
|
|
|
|
2007-10-02 00:08:11 +08:00
|
|
|
exit /b 0
|
2007-07-07 06:09:33 +08:00
|
|
|
|
|
|
|
|
2007-10-02 00:08:11 +08:00
|
|
|
rem Parse through the parameters sent to file, and set appropriate variables
|
|
|
|
:parse_params
|
|
|
|
|
|
|
|
for %%a in (%*) do (
|
2011-02-22 22:55:04 +08:00
|
|
|
if "%%a"=="/vs9" (
|
2008-07-03 03:40:00 +08:00
|
|
|
rem Use Visual Studio 2008 to build
|
|
|
|
set hdf5_vs2008=true
|
|
|
|
|
2008-05-29 22:42:26 +08:00
|
|
|
) else if "%%a"=="/fort" (
|
2007-10-02 00:08:11 +08:00
|
|
|
rem Enable Fortran
|
|
|
|
set hdf5_enablefortran=true
|
|
|
|
|
2008-07-01 03:13:27 +08:00
|
|
|
) else if "%%a"=="/ivf101" (
|
|
|
|
rem Enable Fortran
|
|
|
|
set hdf5_ivf101=true
|
|
|
|
|
2007-10-02 00:08:11 +08:00
|
|
|
) else if "%%a"=="/useenv" (
|
|
|
|
rem Pass /useenv flag to devenv
|
|
|
|
set hdf5_useenv=true
|
|
|
|
|
2008-05-01 03:51:13 +08:00
|
|
|
) else if "%%a"=="/log" (
|
|
|
|
rem Log our results to files defined in environment
|
|
|
|
set hdf5_logresults=true
|
|
|
|
|
2007-10-02 00:08:11 +08:00
|
|
|
) else if "%%a"=="/?" (
|
|
|
|
rem Set errorlevel 1 and send to help
|
|
|
|
call :help
|
|
|
|
exit /b 1
|
|
|
|
|
|
|
|
) else (
|
|
|
|
rem Set errorlevel 2 to send to help if we receive a bad parameter
|
|
|
|
echo.Unknown option: %%a
|
|
|
|
call :help
|
|
|
|
exit /b 2
|
|
|
|
)
|
2007-07-14 04:54:54 +08:00
|
|
|
)
|
2007-10-02 00:08:11 +08:00
|
|
|
|
2007-07-14 04:54:54 +08:00
|
|
|
exit /b 0
|
2007-07-07 06:09:33 +08:00
|
|
|
|
2007-10-02 00:08:11 +08:00
|
|
|
|
|
|
|
rem Setup our environment
|
2007-07-07 06:09:33 +08:00
|
|
|
:setup
|
|
|
|
|
2007-10-02 00:08:11 +08:00
|
|
|
rem All we need to do here is setup the parameters that will be sent to
|
|
|
|
rem hdf5build and hdf5check.
|
|
|
|
set hdf5build_params=
|
|
|
|
set hdf5check_params=enablecpp
|
|
|
|
|
2008-07-03 03:40:00 +08:00
|
|
|
if defined hdf5_vs2008 (
|
|
|
|
set hdf5build_params=%hdf5build_params% /vs9
|
|
|
|
)
|
|
|
|
|
2007-10-02 00:08:11 +08:00
|
|
|
if defined hdf5_enablefortran (
|
|
|
|
set hdf5build_params=%hdf5build_params% /fort
|
|
|
|
set hdf5check_params=enableall
|
|
|
|
)
|
|
|
|
|
2008-07-01 03:13:27 +08:00
|
|
|
if defined hdf5_ivf101 (
|
|
|
|
set hdf5build_params=%hdf5build_params% /ivf101
|
|
|
|
)
|
|
|
|
|
2007-10-02 00:08:11 +08:00
|
|
|
if defined hdf5_useenv (
|
|
|
|
set hdf5build_params=%hdf5build_params% /useenv
|
|
|
|
)
|
|
|
|
|
2008-05-01 03:51:13 +08:00
|
|
|
rem Clear out our log files if they will be used
|
|
|
|
if defined hdf5_logresults (
|
|
|
|
if not defined hdf5build_log (
|
|
|
|
echo.Error: HDF5BUILD_LOG not defined in environment!
|
|
|
|
exit /b 1
|
|
|
|
) else (
|
|
|
|
type nul > !hdf5build_log!
|
|
|
|
)
|
|
|
|
|
|
|
|
if not defined hdf5check_log (
|
|
|
|
echo.Error: HDF5CHECK_LOG not defined in environment!
|
|
|
|
exit /b 1
|
|
|
|
) else (
|
|
|
|
type nul > !hdf5check_log!
|
|
|
|
)
|
|
|
|
)
|
|
|
|
|
2007-07-14 04:54:54 +08:00
|
|
|
exit /b 0
|
2007-07-07 06:09:33 +08:00
|
|
|
|
|
|
|
|
2007-10-02 00:08:11 +08:00
|
|
|
rem Build HDF5 libraries and tools
|
2007-07-07 06:09:33 +08:00
|
|
|
:build
|
|
|
|
|
2008-05-01 03:51:13 +08:00
|
|
|
if defined hdf5_logresults (
|
|
|
|
echo.Calling hdf5bbuild.bat %hdf5build_params%
|
|
|
|
echo.Results logged in %hdf5build_log%
|
|
|
|
call hdf5build.bat %hdf5build_params% > !hdf5build_log! 2>&1
|
|
|
|
) else (
|
|
|
|
call hdf5build.bat %hdf5build_params%
|
|
|
|
)
|
2007-07-07 06:09:33 +08:00
|
|
|
|
2007-07-14 04:54:54 +08:00
|
|
|
exit /b
|
2007-07-07 06:09:33 +08:00
|
|
|
|
|
|
|
|
2007-10-02 00:08:11 +08:00
|
|
|
rem Test our libraries and tools
|
2007-07-07 06:09:33 +08:00
|
|
|
:test
|
2008-05-01 03:51:13 +08:00
|
|
|
if defined hdf5_logresults (
|
|
|
|
echo.Calling hdf5check.bat %hdf5check_params%
|
|
|
|
echo.Results logged in %hdf5check_log%
|
|
|
|
call hdf5check %hdf5check_params% > !hdf5check_log! 2>&1
|
|
|
|
) else (
|
|
|
|
call hdf5check %hdf5check_params%
|
|
|
|
)
|
2007-07-07 06:09:33 +08:00
|
|
|
|
2007-07-14 04:54:54 +08:00
|
|
|
exit /b
|
2007-07-07 06:09:33 +08:00
|
|
|
|
|
|
|
|
2007-10-02 00:08:11 +08:00
|
|
|
rem Handle errors
|
2007-07-07 06:09:33 +08:00
|
|
|
:error
|
|
|
|
|
2007-10-02 00:08:11 +08:00
|
|
|
rem For now, our error handling consists of setting nerrors and quitting
|
|
|
|
echo.HDF5 build-test failed.
|
|
|
|
set /a nerrors=%nerrors%+1
|
|
|
|
goto end
|
2007-07-14 04:54:54 +08:00
|
|
|
|
2007-10-02 00:08:11 +08:00
|
|
|
rem We'll never really get here, but we keep this line for consistency.
|
2007-07-14 04:54:54 +08:00
|
|
|
exit /b
|
2007-07-07 06:09:33 +08:00
|
|
|
|
|
|
|
|
2007-10-02 00:08:11 +08:00
|
|
|
rem This is where the magic happens
|
|
|
|
:main
|
2007-07-07 06:09:33 +08:00
|
|
|
|
2007-10-02 00:08:11 +08:00
|
|
|
call :parse_params %*
|
2009-10-23 05:23:59 +08:00
|
|
|
if not errorlevel 0 (
|
|
|
|
if errorlevel 1 (
|
2007-10-02 00:08:11 +08:00
|
|
|
rem This isn't an error case-- this means /? was specified. Simply
|
|
|
|
rem quit.
|
|
|
|
goto end
|
|
|
|
|
|
|
|
) else (
|
|
|
|
rem Error case.
|
|
|
|
echo.Error parsing parameters!
|
|
|
|
goto error
|
|
|
|
)
|
|
|
|
)
|
2007-07-11 02:32:20 +08:00
|
|
|
|
2007-10-02 00:08:11 +08:00
|
|
|
call :setup
|
2009-10-23 05:23:59 +08:00
|
|
|
if not errorlevel 0 (
|
2008-05-01 03:51:13 +08:00
|
|
|
echo.Error setting up hdf5bt environment!
|
|
|
|
goto error
|
|
|
|
)
|
2007-07-11 02:32:20 +08:00
|
|
|
|
2007-10-02 00:08:11 +08:00
|
|
|
echo.*****************************************************************************
|
|
|
|
echo. Build and Test HDF5 Library and Tools
|
|
|
|
echo.*****************************************************************************
|
|
|
|
echo.
|
2007-07-07 06:09:33 +08:00
|
|
|
|
2007-10-02 00:08:11 +08:00
|
|
|
call :build
|
2009-10-23 21:55:29 +08:00
|
|
|
if not errorlevel 0 (
|
2007-10-02 00:08:11 +08:00
|
|
|
echo.Error building HDF5 libraries!
|
|
|
|
goto error
|
|
|
|
)
|
|
|
|
|
|
|
|
call :test
|
2009-10-23 05:23:59 +08:00
|
|
|
if not errorlevel 0 (
|
2007-10-02 00:08:11 +08:00
|
|
|
echo.Error testing HDF5 libraries!
|
|
|
|
goto error
|
|
|
|
)
|
|
|
|
|
|
|
|
if "%nerrors%"=="0" (
|
|
|
|
echo. All HDF5 libraries and tools build and tested successfully!
|
|
|
|
)
|
|
|
|
rem Fall through to end
|
|
|
|
|
|
|
|
:end
|
|
|
|
popd
|
|
|
|
endlocal & exit /b %nerrors%
|