summaryrefslogtreecommitdiffstats
path: root/windows/hdf5bt.BAT
diff options
context:
space:
mode:
authorScott Wegner <swegner@hdfgroup.org>2007-10-01 16:08:11 (GMT)
committerScott Wegner <swegner@hdfgroup.org>2007-10-01 16:08:11 (GMT)
commit1d80caa6921ba35107970ac45ea0bd5429b5d7fd (patch)
tree7875eca54f584b8c14ae7f46bc6efb22d888b874 /windows/hdf5bt.BAT
parent48eb736b681f9362743dfce4591c6de5e0a7438a (diff)
downloadhdf5-1d80caa6921ba35107970ac45ea0bd5429b5d7fd.zip
hdf5-1d80caa6921ba35107970ac45ea0bd5429b5d7fd.tar.gz
hdf5-1d80caa6921ba35107970ac45ea0bd5429b5d7fd.tar.bz2
[svn-r14166] Purpose: Update Windows command-line build scripts
Description: This updates the command-line build process to handle structural changes we've made in the HDF5 project files. Also, we add support for two new options: /fort - to build Fortran libraries /useenv - to allow users to specify include and libpath directories on the command line as well. Also updated documentation to reflect these change. Tested: VS2005 on WinXP
Diffstat (limited to 'windows/hdf5bt.BAT')
-rwxr-xr-xwindows/hdf5bt.BAT243
1 files changed, 140 insertions, 103 deletions
diff --git a/windows/hdf5bt.BAT b/windows/hdf5bt.BAT
index cc920dd..26b1e14 100755
--- a/windows/hdf5bt.BAT
+++ b/windows/hdf5bt.BAT
@@ -1,142 +1,179 @@
-@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.
-
@echo OFF
-
-:: File Name: hdf5bt.bat
-:: This batch file is used to build and test HDF5 Libraries and Tools.
-:: There are currently only 2 options for this batch file:
-:: hdf5bt /? -- Print a usage message and quit.
-:: hdf5bt -- Build and test HDF5 tools and C/C++ libraries
-:: By Xuan Bai
-:: Created: Aug. 16, 2004
-:: Last Updated: July 6, 2007
-
-:: This batch file makes the following assumptions:
-:: - Visual Studio .NET is installed, and VS71COMNTOOLS variable is set
-:: - 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
-:: - szip and zlib DLLs are already placed in an accessible directory
-:: - If HDF5_EXT_SZIP or HDF5_EXT_ZLIB are not set, then %SZIP_NAME% and %ZLIB_NAME%
-:: will be used, respectively (defined in hdfbuild.BAT)
-
-:: By default, only C and C++ libraries are built and tested.
-
-if "x%1"=="x" goto main
-goto help
-
-:: Print a help message
+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:
+rem . /fort Build and test HDF5 with Fortran libraries
+rem . /useenv Build HDF5 using compiler settings defined
+rem . in the environment, rather than the IDE.
+rem . /? Help information
+rem By Xuan Bai
+rem Created: Aug. 16, 2004
+rem Last Updated: Scott Wegner, 10/1/07
+
+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.
+
+rem By default, only C and C++ libraries are built and tested.
+
+setlocal enabledelayedexpansion
+pushd %~dp0
+
+set nerrors=0
+goto main
+
+rem Print a help message
:help
echo.Builds and tests HDF5 Libraries and Tools.
echo.
- echo %~nx0 [OPTION]
+ echo Usage: %~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
+ echo. /fort Build and test HDF5 with Fortran libraries
+ echo. /useenv Build HDF5 using compiler settings defined
+ echo. in the environment, rather than the IDE.
+ echo. /? Help information
- call :setup
-
- echo.Build and testing all HDF5 libraries and tools
- echo.
+ exit /b 0
- echo.***************************************************************************** >> %bt_results%
- echo. Build and Test HDF5 Library and Tools >> %bt_results%
- echo.***************************************************************************** >> %bt_results%
- echo. >> %bt_results%
- call :build
- if %errorlevel% neq 0 (
- echo.Error building HDF5 libraries!
- goto error
- )
-
- call :test
- if %errorlevel% neq 0 (
- echo.Error testing HDF5 libraries!
- goto error
+rem Parse through the parameters sent to file, and set appropriate variables
+:parse_params
+
+ for %%a in (%*) do (
+ if "%%a"=="/fort" (
+ rem Enable Fortran
+ set hdf5_enablefortran=true
+
+ ) else if "%%a"=="/useenv" (
+ rem Pass /useenv flag to devenv
+ set hdf5_useenv=true
+
+ ) 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
+ )
)
-
- echo. All HDF5 libraries and tools build and tested successfully!
- echo. All HDF5 libraries and tools build and tested successfully! >> %build_results%
-
- call :cleanup
-
+
exit /b 0
-
-:: Setup our environment
+
+rem Setup our environment
:setup
- :: 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"
-
- :: Create our results file
- type nul > %bt_results%
-
+ 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
+
+ if defined hdf5_enablefortran (
+ set hdf5build_params=%hdf5build_params% /fort
+ set hdf5check_params=enableall
+ )
+
+ if defined hdf5_useenv (
+ set hdf5build_params=%hdf5build_params% /useenv
+ )
+
exit /b 0
-:: Build HDF5 libraries and tools
+rem Build HDF5 libraries and tools
:build
- call hdf5build.BAT
- type %build_results% >> %bt_results%
+ call hdf5build.bat %hdf5build_params%
exit /b
-:: Test our libraries and tools
+rem Test our libraries and tools
:test
- call hdf5check enablecpp
- type check_results.txt >> %bt_results%
+ call hdf5check %hdf5check_params%
exit /b
-:: Handle errors
+rem 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
+ rem For now, our error handling consists of setting nerrors and quitting
+ echo.HDF5 build-test failed.
+ set /a nerrors=%nerrors%+1
+ goto end
+ rem We'll never really get here, but we keep this line for consistency.
exit /b
-:: Cleanup our environment
-:cleanup
+rem This is where the magic happens
+:main
- set build_results=
+ call :parse_params %*
+ if %errorlevel% neq 0 (
+ if !errorlevel! equ 1 (
+ 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
+ )
+ )
- :: Don't unset bt_results if it is being used by autotest_hdf5.bat
- if "x%hdf5_auto_results%"=="x" set bt_results=
+ call :setup
- popd
+ echo.*****************************************************************************
+ echo. Build and Test HDF5 Library and Tools
+ echo.*****************************************************************************
+ echo.
- exit /b 0
+ call :build
+ if %errorlevel% neq 0 (
+ echo.Error building HDF5 libraries!
+ goto error
+ )
+
+ call :test
+ if %errorlevel% neq 0 (
+ 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%