summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorScott Wegner <swegner@hdfgroup.org>2008-04-14 21:35:55 (GMT)
committerScott Wegner <swegner@hdfgroup.org>2008-04-14 21:35:55 (GMT)
commitc6ec340c76361f9db055497905a1541299bcab61 (patch)
treef4303f56a8f4c316a0b155da0ff75e9a94dea953
parentf16de156461c8f9326dd29fe2ef177a842da7dcc (diff)
downloadhdf5-c6ec340c76361f9db055497905a1541299bcab61.zip
hdf5-c6ec340c76361f9db055497905a1541299bcab61.tar.gz
hdf5-c6ec340c76361f9db055497905a1541299bcab61.tar.bz2
[svn-r14845] Purpose: Add new Windows batch script for building example projects
Description: Just as we have scripts for building and testing the HDF5 library on Windows, hdf5build_examples.BAT is a new script for building HDF5 example projects on Windows. This is especially useful for our new Windows Daily Tests, to test our examples automatically as well. Eventually, we will have hdf5check_examples.BAT and hdf5bt_examples.BAT to test our examples as well. Tested: VS2005 on WinXP
-rw-r--r--windows/hdf5build_examples.BAT221
1 files changed, 221 insertions, 0 deletions
diff --git a/windows/hdf5build_examples.BAT b/windows/hdf5build_examples.BAT
new file mode 100644
index 0000000..52b106a
--- /dev/null
+++ b/windows/hdf5build_examples.BAT
@@ -0,0 +1,221 @@
+@echo OFF
+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 helphdfgroup.org.
+
+
+rem File Name: hdf5build_examples.bat
+rem This batch file is used to build HDF5 C/C++/Fortran examples.
+rem This batch file takes the following options:
+rem . /fort Build HDF5 examples, including Fortran
+rem . /useenv Build HDF5 examples using compiler settings defined
+rem . in the environment, rather than the IDE.
+rem . /? Help information
+rem By Scott Wegner
+rem Created: April 1st, 2008
+rem Last Updated: April 14, 2008
+
+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 - HDF5 has already been built using standard settings
+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++ examples are built.
+
+setlocal enabledelayedexpansion
+pushd %~dp0
+
+set nerrors=0
+if "%1"=="/?" goto help
+goto main
+
+rem Print a help message
+:help
+
+ echo.Builds HDF5 example projects.
+ echo.
+ echo.Usage: %~nx0 [OPTION]
+ echo.
+ echo. /fort Build HDF5 examples, including Fortran
+ echo. /useenv Build HDF5 examples using compiler settings defined
+ echo. in the environment, rather than the IDE.
+ echo. /? Help information
+
+ exit /b 0
+
+
+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 (
+ rem Set errorlevel 2 to send to help if we receive a bad parameter
+ echo.Unknown option: %%a
+ call :help
+ exit /b 1
+ )
+ )
+
+ exit /b 0
+
+
+rem Setup our environment
+:setup
+
+ rem Constants
+
+ echo.Setting up environment
+
+ rem Setup Visual Studio environment. By default, use the Visual Studio
+ rem 2005 environment.
+
+ set ccflags=
+
+ rem Currently VS2005 is the only compiler supported. --SJW 9/26/07
+ echo.Using Visual Studio 2005
+
+ if not defined hdf5_enablefortran (
+ if defined vs80comntools (
+ rem This sets the Visual Studio path and environment variables
+ call "%vs80comntools%\vsvars32.bat"
+ ) else (
+ echo.Error: Cannot setup Visual Studio 2005 environment. Please
+ echo.make sure VS80COMNTOOLS is defined in the environment.
+ exit /b 1
+ )
+
+ ) else (
+ echo.with Intel Visual Fortran 9.1
+
+ if defined ifort_compiler91 (
+ rem This sets the Intel Fortran 9.1 environment, as well as
+ rem setting the appropriate Visual Studio environment
+
+ rem Assume 32-bit environment
+ call "%ifort_compiler91%\IA32\Bin\ifortvars.bat"
+ ) else (
+ echo.Error: Cannot setup Intel Fortran 9.1 environment. Please
+ echo.make sure IFORT_COMPILER91 is defined in the environment.
+ exit /b 1
+ )
+ )
+
+ rem Setup variables for our SLN files
+ set C_SLN=%CD%\windows\examples\allexamples\allexamples.sln
+ set CPP_SLN=%CD%\windows\c++\examples\allcppexamples\allcppexamples.sln
+ set HL_SLN=%CD%\windows\hl\examples\allhlcexamples\allhlcexamples.sln
+ rem We currently don't have HL C++ project files
+ if defined hdf5_enablefortran (
+ set FORT_SLN=%CD%\windows\fortran\examples\allf90examples\allf90examples.sln
+ set HLFORT_SLN=%CD%\windows\hl\fortran\examples\allhlf90examples\allhlf90examples.sln
+ ) else (
+ set FORT_SLN=
+ set HLFORT_SLN=
+ )
+
+ if defined hdf5_useenv (
+ rem This will tell Visual Studio to use include, library, etc. paths
+ rem defined by %INCLUDE% %LIBPATH%, etc. Assume the user has already
+ rem added external library paths to these variables.
+ set ccflags=%ccflags% /useenv
+ )
+
+ exit /b 0
+
+
+rem Build the HDF5 libraries. By default, C and C++ libraries are built.
+:build
+
+ echo.Building HDF5
+
+ echo.*****************************************************************************
+ echo. Build HDF5 Examples
+ echo.*****************************************************************************
+ echo.
+
+ rem TODO: Write code for each of these example sets
+ rem Build both debug and release versions
+ for %%a in (C CPP HL FORT HLFORT) do (
+ if defined %%a_SLN (
+ echo.**************************
+ echo. Building %%a Examples
+ echo.**************************
+ for %%b in (Debug Release) do (
+ echo.Building %%a %%b examples...
+ devenv !%%a_SLN! %ccflags% /rebuild %%b
+ if !errorlevel! neq 0 (
+ echo.HDF5 %%b %%a examples build failed
+ exit /b
+ )
+ )
+ )
+ )
+
+ exit /b
+
+
+rem Handle errors
+:error
+
+ rem For now, our error handling consists of setting nerrors and quitting
+ echo.HDF5 examples build failed.
+ set /a nerrors=%nerrors%+1
+ goto end
+
+ rem We'll never really get here, but we keep this line for consistency.
+ exit /b
+
+
+rem This is where the magic happens
+:main
+
+ call :parse_params %*
+ if %errorlevel% neq 0 (
+ rem Error case.
+ echo.Error parsing parameters!
+ goto error
+ )
+
+ call :setup
+ if %errorlevel% neq 0 (
+ echo.Error setting up examples build environment.
+ goto error
+ )
+
+ call :build
+ if %errorlevel% neq 0 (
+ echo.Error building HDF5 examples!
+ goto error
+ )
+
+ if "%nerrors%"=="0" (
+ echo. All HDF5 example projects built successfully!
+ )
+ rem Fall through to end
+
+:end
+ popd
+ endlocal & exit /b %nerrors%