diff options
author | Scott Wegner <swegner@hdfgroup.org> | 2007-07-13 20:54:54 (GMT) |
---|---|---|
committer | Scott Wegner <swegner@hdfgroup.org> | 2007-07-13 20:54:54 (GMT) |
commit | 31a2af29ca7aa91fcd47eb018a02ff2e425c5b55 (patch) | |
tree | a1af397401c3d49940f98657831737d5b8e0b20d | |
parent | 2b89d6d73c71d4bd7d90bb8b564992fd8f8b4628 (diff) | |
download | hdf5-31a2af29ca7aa91fcd47eb018a02ff2e425c5b55.zip hdf5-31a2af29ca7aa91fcd47eb018a02ff2e425c5b55.tar.gz hdf5-31a2af29ca7aa91fcd47eb018a02ff2e425c5b55.tar.bz2 |
[svn-r13977] Purpose: Misc. Windows autotest code-cleanup
Description:
This cleans up a lot of different things we were doing in the Windows batch scripts. For one, we now use "exit /b" to better emulate functions in batch scripts. Also changed error-checking to look for negative return values as well.
This also adds initial support for Visual Studio 2005 command-line builds in hdf5build.BAT
Tested:
WinXP
-rwxr-xr-x | windows/hdf5bt.BAT | 121 | ||||
-rwxr-xr-x | windows/hdf5build.BAT | 272 |
2 files changed, 216 insertions, 177 deletions
diff --git a/windows/hdf5bt.BAT b/windows/hdf5bt.BAT index 4d35cdf..cc920dd 100755 --- a/windows/hdf5bt.BAT +++ b/windows/hdf5bt.BAT @@ -33,119 +33,110 @@ :: By default, only C and C++ libraries are built and tested.
-if defined hdf5_debug echo ON
-
if "x%1"=="x" goto main
goto help
:: Print a help message
:help
-echo.Builds and tests HDF5 Libraries and Tools.
-echo.
-echo %0 [OPTION]
-echo.
-echo.Please use one of the following options!
-echo.
-echo. %0 Build and tests HDF5 C/C++ Library and Tools
-echo. %0 /? Help information
-if defined hdf5_debug pause
-goto :eof
+ echo.Builds and tests HDF5 Libraries and Tools.
+ echo.
+ echo %~nx0 [OPTION]
+ echo.
+ echo.Please use one of the following options!
+ echo.
+ echo. %~nx0 Build and tests HDF5 C/C++ Library and Tools
+ echo. %~nx0 /? Help information
+
+ exit /b
:: This is where the magic happens
:main
-call :setup
+ call :setup
-echo.Build and testing all HDF5 libraries and tools
-echo.
+ echo.Build and testing all HDF5 libraries and tools
+ echo.
-echo.***************************************************************************** >> %bt_results%
-echo. Build and Test HDF5 Library and Tools >> %bt_results%
-echo.***************************************************************************** >> %bt_results%
-echo. >> %bt_results%
+ echo.***************************************************************************** >> %bt_results%
+ echo. Build and Test HDF5 Library and Tools >> %bt_results%
+ echo.***************************************************************************** >> %bt_results%
+ echo. >> %bt_results%
-call :build
-if errorlevel 1 (
- echo.Error building HDF5 libraries!
- goto error
-)
+ call :build
+ if %errorlevel% neq 0 (
+ echo.Error building HDF5 libraries!
+ goto error
+ )
-call :test
-if errorlevel 1 (
- echo.Error testing HDF5 libraries!
- goto error
-)
+ call :test
+ if %errorlevel% neq 0 (
+ echo.Error testing HDF5 libraries!
+ goto error
+ )
-echo. All HDF5 libraries and tools build and tested successfully!
-echo. All HDF5 libraries and tools build and tested successfully! >> %build_results%
+ echo. All HDF5 libraries and tools build and tested successfully!
+ echo. All HDF5 libraries and tools build and tested successfully! >> %build_results%
-call :cleanup
+ call :cleanup
-if defined hdf5_debug pause
-goto :eof
+ exit /b 0
:: Setup our environment
:setup
-:: Put us in the directory of the batch file.
-pushd %~dp0
+ :: Put us in the directory of the batch file.
+ pushd %~dp0
-:: Constants
-if "x%bt_results%"=="x" set bt_results="%CD%\bt_results.txt"
-if "x%build_results%"=="x" set build_results="%CD%\build_results.txt"
+ :: Constants
+ if "x%bt_results%"=="x" set bt_results="%CD%\bt_results.txt"
+ if "x%build_results%"=="x" set build_results="%CD%\build_results.txt"
-:: Create our results file
-type nul > %bt_results%
+ :: Create our results file
+ type nul > %bt_results%
-if defined hdf5_debug pause
-goto :eof
+ exit /b 0
:: Build HDF5 libraries and tools
:build
-call hdf5build.BAT
-type %build_results% >> %bt_results%
+ call hdf5build.BAT
+ type %build_results% >> %bt_results%
-if defined hdf5_debug pause
-goto :eof
+ exit /b
:: Test our libraries and tools
:test
-call hdf5check enablecpp
-type check_results.txt >> %bt_results%
+ call hdf5check enablecpp
+ type check_results.txt >> %bt_results%
-if defined hdf5_debug pause
-goto :eof
+ exit /b
:: Handle errors
:error
-:: For now, our error handling just consists of calling cleanup, and exiting
-echo.hdf5bt failed.
-echo.hdf5bt failed. >> %bt_results%
-call :cleanup
-set errorlevel=1
-
-if defined hdf5_debug pause
-goto :eof
+ :: For now, our error handling just consists of calling cleanup, and exiting
+ echo.hdf5bt failed.
+ echo.hdf5bt failed. >> %bt_results%
+ call :cleanup
+
+ exit /b
:: Cleanup our environment
:cleanup
-set build_results=
+ set build_results=
-:: Don't unset bt_results if it is being used by autotest_hdf5.bat
-if "x%hdf5_auto_results%"=="x" set bt_results=
+ :: Don't unset bt_results if it is being used by autotest_hdf5.bat
+ if "x%hdf5_auto_results%"=="x" set bt_results=
-popd
+ popd
-if defined hdf5_debug pause
-goto :eof
+ exit /b 0
diff --git a/windows/hdf5build.BAT b/windows/hdf5build.BAT index 9e2cee9..9fc55fa 100755 --- a/windows/hdf5build.BAT +++ b/windows/hdf5build.BAT @@ -20,10 +20,10 @@ :: 1. hdf5build -- Build HDF5 tools and c library
:: By Xuan Bai
:: Created: Aug. 16, 2004
-:: Last Updated: July 7, 2007
+:: Last Updated: July 13, 2007
:: This batch file makes the following assumptions:
-:: - Visual Studio .NET is installed, and VS71COMNTOOLS variable is set
+:: - The appropriate version of Visual Studio is installed and setup
:: - The directory structure is setup from a fresh source copy
:: - copy_hdf.bat has already been run from the ./windows directory
:: - Visual Studio already contains the required paths for external libraries
@@ -33,152 +33,200 @@ :: By default, only C and C++ libraries are built.
-if defined hdf5_debug echo ON
-
-if "x%1"=="x" goto main
-goto help
+goto main
:: Print a help message
:help
-echo.Builds HDF5 Libraries and Tools.
-echo.
-echo %0 [OPTION]
-echo.
-echo.Please use one of the following options!
-echo.
-echo. %0 Build HDF5 C Library and Tools
-echo. %0 /? Help information
-goto :eof
-
-
-
-:: This is where the magic happens
-:main
-
-call :setup
-
-echo.Building HDF5 Libraries and Tools
-echo.
-echo.***************************************************************************** >> %build_results%
-echo. Build HDF5 Libraries and Tools >> %build_results%
-echo.***************************************************************************** >> %build_results%
-echo. >> %build_results%
+ echo.Builds HDF5 Libraries and Tools.
+ echo.
+ echo %~nx0 [OPTION]
+ echo.
+ echo.Please use one of the following options!
+ echo.
+ echo. %~nx0 Build HDF5 C Library and Tools
+ echo. %~nx0 /? Help information
+
+ exit /b 0
+
+
+:: Parse through the parameters sent to file, and set appropriate variables
+:parse_params
+
+ for %%a in (%*) do (
+ if "%1"=="/vs8" (
+ :: Use VS2005 as our compiler
+ set hdf5_use_vs2005=true
+
+ ) else if "%1"=="/fort" (
+ :: Enable Fortran
+ set hdf5_enablefortran=true
+
+ ) else if "%1"=="/?" (
+ :: Set errorlevel 1 and send to help
+ call :help
+ exit /b 1
+
+ ) else (
+ :: Set errorlevel 2 to send to help if we receive a bad parameter (or /?)
+ call :help
+ exit /b 2
+ )
+ )
+
+ exit /b 0
-call :h5tinit
-if errorlevel 1 (
- echo. Error building h5tinit!
- echo. Error building h5tinit! >> %build_results%
- goto error
-)
-
-call :all
-if errorlevel 1 (
- echo. Error building HDF5 libraries!
- echo. Error building HDF5 libraries! >> %build_results%
+:: Setup our environment
+:setup
- goto error
-)
+ echo. Setting up environment >> %build_results%
+
+ :: Put us in the directory of the batch file.
+ pushd %~dp0
+
+ :: Constants
+ if "x%build_results%"=="x" set build_results="%CD%\build_results.txt"
+ type nul > %build_results%
+
+ if "x%zlib_name%"=="x" set zlib_name=zdll.lib
+ if "x%szip_name%"=="x" set szip_name=szlibdll.lib
+
+ :: By default, use all.sln, unless hdf5_enablefortran is set
+ if defined hdf5_enablefortran (
+ echo.Building Fortran projects enabled
+ echo.Building Fortran projects enabled >> %build_results%
+ set hdf5_sln="%CD%\windows\proj\all_fortran\all_fortran.sln"
+ ) else set hdf5_sln="%CD%\windows\proj\all\all.sln"
+
+ :: Set external libraries if they aren't already set
+ if x%hdf5_ext_zlib%==x set hdf5_ext_zlib=%zlib_name%
+ if x%hdf5_ext_szip%==x set hdf5_ext_szip=%szip_name%
+
+
+ :: Setup Visual Studio environment. By default, use the Visual Studio .NET environment
+ if defined hdf5_use_vs2005 (
+ echo.Using Visual Studio 2005
+ echo.Using Visual Studio 2005 >> %build_results%
+ call "%vs80comntools%\vsvars32.bat" >> %build_results%
+ ) else (
+ echo.Using Visual Studio .NET 2003
+ echo.Using Visual Studio .NET 2003 >> %build_results%
+ call "%vs71comntools%\vsvars32.bat" >> %build_results%
+
+ :: If we are building Fortran libraries with .NET, we need to manually edit
+ :: some project files
+ if defined hdf5_enablefortran (
+ echo.Building Fortran from commandline with .NET not yet implemented!
+ echo.Building Fortran from commandline with .NET not yet implemented! >> %build_results%
+ exit /b 1
+ )
+
+ exit /b 0
-echo. All HDF5 libraries and tools build successfully!
-echo. All HDF5 libraries and tools build successfully! >> %build_results%
-call :cleanup
+:: Build H5tinit.exe and generate h4tinit.c
+:h5tinit
-if defined hdf5_debug pause
-goto :eof
+ echo. Generating H5tint.c
-:: Setup our environment
-:setup
+ echo.***************************************************************************** >> %build_results%
+ echo. Build H5Tinit.exe >> %build_results%
+ echo.***************************************************************************** >> %build_results%
+ echo. >> %build_results%
+ devenv .\windows\misc\typegen\typegen.sln /rebuild Debug >> %build_results% 2>&1
+ if %errorlevel% neq 0 exit /b
-echo. Setting up environment >> %build_results%
+ :: Use output to generate h5tinit.c
+ .\src\h5tinit.exe > .\src\h5tinit.c
-:: Put us in the directory of the batch file.
-pushd %~dp0
+ exit /b
-:: Constants
-if "x%zlib_name%"=="x" set zlib_name=zdll.lib
-if "x%szip_name%"=="x" set szip_name=szlibdll.lib
-if "x%build_results%"=="x" set build_results="%CD%\build_results.txt"
-:: Create our results file
-type nul > %build_results%
+:: Build the HDF5 libraries. By default, C and C++ libraries are built.
+:all
-:: Set external libraries if they aren't already set
-if x%hdf5_ext_zlib%==x set hdf5_ext_zlib=%zlib_name%
-if x%hdf5_ext_szip%==x set hdf5_ext_szip=%szip_name%
+ echo. Building HDF5
-:: By default, use the Visual Studio .NET environment
-call "%vs71comntools%\vsvars32.bat" >> %build_results%
+ echo.***************************************************************************** >> %build_results%
+ echo. Build HDF5 C Library and Tools >> %build_results%
+ echo.***************************************************************************** >> %build_results%
+ echo. >> %build_results%
-if defined hdf5_debug pause
-goto :eof
+ :: Build both debug and release versions
+ for %%a in (debug release) DO (
+ echo. Building %%a libraries...
+ echo. Building %%a libraries... >> %build_results%
+ devenv .\windows\proj\all\all.sln /rebuild %%a >> %build_results% 2>&1
+ if %errorlevel% neq 0 exit /b
+ )
+ exit /b
-:: Build H5tinit.exe and generate h4tinit.c
-:h5tinit
-echo. Generating H5tint.c
+:: Handle errors
+:error
-echo.***************************************************************************** >> %build_results%
-echo. Build H5Tinit.exe >> %build_results%
-echo.***************************************************************************** >> %build_results%
-echo. >> %build_results%
-devenv .\windows\misc\typegen\typegen.sln /rebuild Debug >> %build_results% 2>&1
-if errorlevel 1 goto :eof
+ :: For now, our error handling just consists of calling cleanup, and setting errorlevel
+ echo.HDF5 build failed.
+ echo.HDF5 build failed. >> %build_results%
+ call :cleanup
-:: Use output to generate h5tinit.c
-.\src\h5tinit.exe > .\src\h5tinit.c
+ exit /b 1
-if defined hdf5_debug pause
-goto :eof
+:: Cleanup our environment
+:cleanup
-:: Build the HDF5 libraries. By default, C and C++ libraries are built.
-:all
+ set zlib_name=
+ set szip_name=
+ set hdf5_enablefortran=
+ set hdf5_use_vs2005=
-echo. Building HDF5
+ :: Don't unset build_results if it is being used by hdf5bt.BAT
+ if "x%bt_results%"=="x" set build_results=
+ popd
-echo.***************************************************************************** >> %build_results%
-echo. Build HDF5 C Library and Tools >> %build_results%
-echo.***************************************************************************** >> %build_results%
-echo. >> %build_results%
+ exit /b 0
-:: Build both debug and release versions
-for %%a in (debug release) DO (
- echo. Building %%a libraries...
- echo. Building %%a libraries... >> %build_results%
- devenv .\windows\proj\all\all.sln /rebuild %%a >> %build_results% 2>&1
- if errorlevel 1 goto :eof
-)
-if defined hdf5_debug pause
-goto :eof
+:: This is where the magic happens
+:main
+ call :parse_params %*
+ if %errorlevel% neq 0 (
+ if %errorlevel% equ 2 echo.Error parsing parameters!
+ exit /b
+ )
+
+ call :setup
-:: Handle errors
-:error
+ echo.Building HDF5 Libraries and Tools
+ echo.
-:: For now, our error handling just consists of calling cleanup, and setting errorlevel
-echo.HDF5 build failed.
-echo.HDF5 build failed. >> %build_results%
-call :cleanup
-set errorlevel=1
+ echo.***************************************************************************** >> %build_results%
+ echo. Build HDF5 Libraries and Tools >> %build_results%
+ echo.***************************************************************************** >> %build_results%
+ echo. >> %build_results%
-if defined hdf5_debug pause
-goto :eof
+ call :h5tinit
+ if %errorlevel% neq 0 (
+ echo. Error building h5tinit!
+ echo. Error building h5tinit! >> %build_results%
+ goto error
+ )
-:: Cleanup our environment
-:cleanup
+ call :all
+ if %errorlevel% neq 0 (
+ echo. Error building HDF5 libraries!
+ echo. Error building HDF5 libraries! >> %build_results%
+ goto error
+ )
-set zlib_name=
-set szip_name=
+ echo. All HDF5 libraries and tools build successfully!
+ echo. All HDF5 libraries and tools build successfully! >> %build_results%
-:: Don't unset build_results if it is being used by hdf5bt.BAT
-if "x%bt_results%"=="x" set build_results=
-popd
+ call :cleanup
-if defined hdf5_debug pause
-goto :eof
+ exit /b 0
|