From 1d80caa6921ba35107970ac45ea0bd5429b5d7fd Mon Sep 17 00:00:00 2001 From: Scott Wegner Date: Mon, 1 Oct 2007 11:08:11 -0500 Subject: [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 --- release_docs/INSTALL_Windows_From_Command_Line.txt | 117 ++++---- windows/hdf5bt.BAT | 243 ++++++++++------- windows/hdf5build.BAT | 297 +++++++++++---------- 3 files changed, 362 insertions(+), 295 deletions(-) diff --git a/release_docs/INSTALL_Windows_From_Command_Line.txt b/release_docs/INSTALL_Windows_From_Command_Line.txt index c58229b..4d550e3 100755 --- a/release_docs/INSTALL_Windows_From_Command_Line.txt +++ b/release_docs/INSTALL_Windows_From_Command_Line.txt @@ -8,14 +8,13 @@ Note: This instruction is written for users who would like to build HDF5 Currently, we support - 1. Building and testing HDF5 on command line with Microsoft Visual - Studio .NET - + 1. Building and testing HDF5 C/C++/Fortran libraries on command line with + Microsoft Visual Studio 2005 For all other Windows development tools, HDF5 should be built in the development environment. Please refer to INSTALL_Windows.txt for detailed HDF5 building and installation information, or - INSTALL_Windows_short.txt for quick HDF5 building and installation + INSTALL_Windows_Short.txt for quick HDF5 building and installation instructions. WARNINGS: @@ -26,26 +25,46 @@ notes in INSTALL_Windows.txt before starting below procedures. ======================================================================== Section I: Building and testing HDF5 on command line with Microsoft - Visual Studio .NET + Visual Studio 2005 ======================================================================== 1. Preconditions: - 1.1 Verify environment for Visual Studio .NET + 1.1 Verify environment for Visual Studio 2005 Building from the command line requires environment variables for Visual Studio. These are generally setup when Visual Studio is installed, but you can verify by running the command: - echo %vs71comntools% + echo %vs80comntools% This should output a path similar to: - C:\Program Files\Microsoft Visual Studio .NET 2003\Common7\Tools\ + C:\Program Files\Microsoft Visual Studio 8\Common7\Tools\ 1.2 Run batch file copy_hdf.bat. - Go to c:\MyHDFstuff\hdf5\windows and run copy_hdf.bat. + Go to c:\MyHDFstuff\hdf5\windows and run copy_hdf.bat. + + 1.3 Setup evironment for external libraries + + Similarly to building from within Visual Studio, HDF5 requires environment + variables for szip and zlib library names. To define these environment + variables: + + From the command prompt that you will be building HDF5 from, issue the + following command: + + set HDF5_EXT_ZLIB=zdll.lib + + replacing "zdll.lib" with the name of the zlib library on your system. + Similarly, set HDF5_EXT_SZIP to the name of the szip library on your system. + + (Optional) If you will be building using the /useenv switch, you must also + define variables INCLUDE and LIBPATH with a semi-colon deliminated list of + paths for szip and zlib include files, and libraries, respectively. Set + these variables in the same way you set HDF5_EXT_ZLIB and HDF5_EXT_SZIP. + 2. Building and testing HDF5 libraries and tools @@ -58,20 +77,19 @@ notes in INSTALL_Windows.txt before starting below procedures. provided for users to build and test HDF5 library and tools together from command line. - hdf5bt.bat currently takes no parameters: - - hdf5bt build and test C/C++ library and tools - - Invoke a command prompt window and run hdf5bt. Test results are saved - in two files: + hdf5bt file takes the following options: + /fort Build and test HDF5 with Fortran libraries + /useenv Build HDF5 using compiler settings defined + in the environment, rather than the IDE. + /? Help information - c:\MyHDFstuff\hdf5\check_results.txt - - c:\MyHDFstuff\hdf5\tests_results.txt. - - In general, you only need to check tests_results.txt. If all the tests - passed, then you do not have to check check_results.txt. If some tests - failed, check check_results.txt can help you figure out what was wrong. + If you specify the "/useenv" option, then include and library + directories for szip and zlib must have been set in the + Preconditions above. + + Invoke a command prompt window and run hdf5bt. Users are + encouraged to pipe the test output into a file. You should find no + compilation errors or "*FAILED*" marks. 2.2 Options B: Build and test in two steps @@ -84,45 +102,42 @@ notes in INSTALL_Windows.txt before starting below procedures. directory is provided for users to build HDF5 library and tools from command line. - hdf5build.bat currently takes no parameters: - - hdf5build build HDF5 C/C++ library and tools - - Invoke a command prompt window and run hdf5build. Compiling outputs - are saved in c:\MyHDFstuff\hdf5\build_results.txt. You can check + hdf55build takes the following options: + /fort Build HDF5 with Fortran libraries + /useenv Build HDF5 using compiler settings defined + in the environment, rather than the IDE. + /? Help information + + If you specify the "/useenv" option, then include and library + directories for szip and zlib must have been set in the + Preconditions above. + + Invoke a command prompt window and run hdf5build. Users are + encouraged to pipe the test output into a file. You can check the file to find out whether there are any compilation errors. Step 2) Test HDF5 Libraries and Tools - A batch file named hdf5check.bat in c:\MyHDFstuff\hdf5 - directory is provided for users to test HDF5 library - and tools from command line. - - hdf5check.bat has four options: - - hdf5check Test HDF5 C Libraries and Tools - - hdf5check enablecpp Test HDF5 C/C++ Libraries and Tools + HDF5 comes with various test suites, all of which can be tested with + hdf5check.bat batch file in c:\MyHDFstuff\hdf5 directory. - hdf5check enablefortran Test HDF5 C/Fortran Libraries - and Tools + hdf5check batch file can be run with one of the following four options: - hdf5check enableall Test HDF5 C/C++/Fortran Libraries - and Tools + hdf5check Test HDF5 C library and tools only. - Invoke a command prompt window and run hdf5check with apropriate - options. + hdf5check enablecpp Test HDF5 C/C++ libraries and tools. - Test results are saved in two files: + hdf5check enablefortran Test HDF5 C/Fortran libraries and + tools. To use this option, HDF5 + Fortran libraries must have been built. - c:\MyHDFstuff\hdf5\tests_results.txt + hdf5check enableall Test HDF5 C/Fortran libraries and + tools. To use this option, HDF5 + Fortran libraries must have been built. - c:\MyHDFstuff\hdf5\check_results.txt. - - In general, you only need to check tests_results.txt. If all the - tests passed, then you do not have to check check_results.txt. If - some tests failed, check check_results.txt can help you figure out - what was wrong. + Invoke a command prompt window and run hdf5check with appropriate + option. Users are encouraged to pipe the test output into a file. + You should find no "*FAILED*" marks. 3. Installing HDF5 Libraries 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% diff --git a/windows/hdf5build.BAT b/windows/hdf5build.BAT index 53a2ff3..8369fcf 100755 --- a/windows/hdf5build.BAT +++ b/windows/hdf5build.BAT @@ -1,74 +1,82 @@ -@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: hdf5build.bat -:: This batch file is used to build HDF5 Libraries and Tools. -:: There are currently only 2 options for this batch file: -:: 1. hdf5build -- Print a usage message and quit -:: 1. hdf5build -- Build HDF5 tools and c library -:: By Xuan Bai -:: Created: Aug. 16, 2004 -:: Last Updated: July 13, 2007 - -:: This batch file makes the following assumptions: -:: - 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 -:: - 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. - -:: By default, only C and C++ libraries are built. - +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.bat +rem This batch file is used to build HDF5 Libraries and Tools. +rem This batch file takes the following options: +rem . /fort Build 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: July 13, 2007 + +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. + +setlocal enabledelayedexpansion +pushd %~dp0 + +set nerrors=0 goto main -:: Print a help message +rem Print a help message :help echo.Builds 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 HDF5 C Library and Tools - echo. %~nx0 /? Help information + echo. /fort Build HDF5 with Fortran libraries + echo. /useenv Build HDF5 using compiler settings defined + echo. in the environment, rather than the IDE. + echo. /? Help information exit /b 0 -:: Parse through the parameters sent to file, and set appropriate variables +rem 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 + if "%%a"=="/fort" ( + rem Enable Fortran set hdf5_enablefortran=true - ) else if "%1"=="/?" ( - :: Set errorlevel 1 and send to help + ) 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 ( - :: Set errorlevel 2 to send to help if we receive a bad parameter (or /?) + rem Set errorlevel 2 to send to help if we receive a bad parameter + echo.Unknown option: %%a call :help exit /b 2 ) @@ -77,157 +85,164 @@ goto main exit /b 0 -:: Setup our environment +rem Setup our environment :setup - 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 + rem Constants - :: By default, use all.sln, unless hdf5_enablefortran is set + echo.Setting up environment + + rem By default, use all.sln and typegen.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 hdf5_tinit_sln="%CD%\windows\misc\typegen\typegen_fortran.sln" + ) else ( + set hdf5_sln="%CD%\windows\proj\all\all.sln" + set hdf5_tinit_sln="%CD%\windows\misc\typegen\typegen.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% + 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.Using Visual Studio .NET 2003 - echo.Using Visual Studio .NET 2003 >> %build_results% - call "%vs71comntools%\vsvars32.bat" >> %build_results% + echo.with Intel Visual Fortran 9.1 - :: 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% + 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 ) ) + + 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 -:: Build H5tinit.exe and generate h4tinit.c +rem Build H5tinit.exe and generate h4tinit.c :h5tinit - echo. Generating H5tint.c + echo.Generating H5tint.c - 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 - - :: Use output to generate h5tinit.c - .\src\h5tinit.exe > .\src\h5tinit.c + echo.***************************************************************************** + echo. Build H5Tinit.exe + echo.***************************************************************************** + echo. + devenv %hdf5_tinit_sln% %ccflags% /rebuild Debug + if %errorlevel% neq 0 exit /b 1 exit /b -:: Build the HDF5 libraries. By default, C and C++ libraries are built. +rem Build the HDF5 libraries. By default, C and C++ libraries are built. :all - echo. Building HDF5 + echo.Building HDF5 - echo.***************************************************************************** >> %build_results% - echo. Build HDF5 C Library and Tools >> %build_results% - echo.***************************************************************************** >> %build_results% - echo. >> %build_results% + echo.***************************************************************************** + echo. Build HDF5 Library and Tools + echo.***************************************************************************** + echo. - :: Build both debug and release versions + rem 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 + echo.Building %%a libraries... + devenv .\windows\proj\all\all.sln %ccflags% /rebuild %%a + if !errorlevel! neq 0 exit /b ) exit /b -:: Handle errors +rem Handle errors :error - :: For now, our error handling just consists of calling cleanup, and setting errorlevel + rem For now, our error handling consists of setting nerrors and quitting echo.HDF5 build failed. - echo.HDF5 build failed. >> %build_results% - call :cleanup - - exit /b 1 - - -:: Cleanup our environment -:cleanup - - set zlib_name= - set szip_name= - set hdf5_enablefortran= - set hdf5_use_vs2005= - - :: Don't unset build_results if it is being used by hdf5bt.BAT - if "x%bt_results%"=="x" set build_results= - popd - - exit /b 0 + set /a nerrors=%nerrors%+1 + goto end + + rem We'll never really get here, but we keep this line for consistency. + exit /b -:: This is where the magic happens +rem This is where the magic happens :main call :parse_params %* if %errorlevel% neq 0 ( - if %errorlevel% equ 2 echo.Error parsing parameters! - exit /b + 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 + ) ) call :setup + if %errorlevel% neq 0 ( + echo.Error setting up build environment. + goto error + ) 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.***************************************************************************** + echo. Build HDF5 Libraries and Tools + echo.***************************************************************************** + echo. call :h5tinit if %errorlevel% neq 0 ( - echo. Error building h5tinit! - echo. Error building h5tinit! >> %build_results% + echo.Error building h5tinit! goto error ) call :all if %errorlevel% neq 0 ( - echo. Error building HDF5 libraries! - echo. Error building HDF5 libraries! >> %build_results% + echo.Error building HDF5 libraries! goto error ) - echo. All HDF5 libraries and tools build successfully! - echo. All HDF5 libraries and tools build successfully! >> %build_results% - - call :cleanup + if "%nerrors%"=="0" ( + echo. All HDF5 libraries and tools build successfully! + ) + rem Fall through to end - exit /b 0 +:end + popd + endlocal & exit /b %nerrors% -- cgit v0.12