summaryrefslogtreecommitdiffstats
path: root/windows/hdf5build.BAT
diff options
context:
space:
mode:
authorScott Wegner <swegner@hdfgroup.org>2007-07-06 22:09:33 (GMT)
committerScott Wegner <swegner@hdfgroup.org>2007-07-06 22:09:33 (GMT)
commit9db2bf983544a9b3113cae4caf2b0459fa1cddde (patch)
treeffee8861520259473677387cfd753520f4a71296 /windows/hdf5build.BAT
parent625e2f5047b5310df485e1e8a620814459ec54c9 (diff)
downloadhdf5-9db2bf983544a9b3113cae4caf2b0459fa1cddde.zip
hdf5-9db2bf983544a9b3113cae4caf2b0459fa1cddde.tar.gz
hdf5-9db2bf983544a9b3113cae4caf2b0459fa1cddde.tar.bz2
[svn-r13952] Purpose: Update Windows build scripts
Description: I'm in the process of re-writing the Windows build scripts for Visual Studio .NET (and eventually VS2005). These will be used with an autotest script, which is in the works. Tested: VS.NET on WinXP, although probably still needs some work.
Diffstat (limited to 'windows/hdf5build.BAT')
-rwxr-xr-xwindows/hdf5build.BAT393
1 files changed, 177 insertions, 216 deletions
diff --git a/windows/hdf5build.BAT b/windows/hdf5build.BAT
index 39c4931..bd4b8be 100755
--- a/windows/hdf5build.BAT
+++ b/windows/hdf5build.BAT
@@ -1,221 +1,182 @@
-@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: hdf5build.bat
-@REM This batch file is used to build HDF5 Libraries and Tools.
-@REM There are 4 options for this batch file:
-@REM 1. hdf5build -- Build HDF5 tools and c library
-@REM 2. hdf5build enablecpp -- Build HDF5 tools and c/c++ library
-@REM 3. hdf5build enablefortran -- Build HDF5 tools and c/fortran library
-@REM 4. hdf5build enableall -- Build HDF5 tools and c/c++/fortran library
-@REM By Xuan Bai
-@REM Created: Aug. 16, 2004
-@REM Last Updated: Oct. 6, 2004
-
-@ECHO OFF
-if %1.==. GOTO BUILDC
-if "%1"=="/?" GOTO HELP
-if %1==enablecpp GOTO BUILDCPP
-if %1==enablefortran GOTO BUILDF90
-if %1==enableall GOTO BUILDALL
-GOTO WRONG
-
-:BUILDC
-type nul > build_results.txt
-echo ***************************************************************************** >> build_results.txt
-echo Build H5Tinit.exe >> build_results.txt
-echo ***************************************************************************** >> build_results.txt
-
-cd windows\misc\typegen\h5tinit
-msdev h5tinit.dsp /make "h5tinit - Win32 Debug" /Rebuild /out ..\..\..\..\h5tinit.log
-cd ..\..\..\..\
-more h5tinit.log >> build_results.txt
-del h5tinit.log
-
-echo ***************************************************************************** >> build_results.txt
-echo Build HDF5 C Library and Tools >> build_results.txt
-echo ***************************************************************************** >> build_results.txt
-
-cd src
-h5tinit.exe > h5tinit.c
-
-cd ..\windows\proj\all
-msdev all.dsw /make "all - ALL" /Rebuild /out ..\..\..\all.log
-cd ..\..\..\
-more all.log >> build_results.txt
-del all.log
-GOTO END
-
-:BUILDCPP
-type nul > build_results.txt
-echo ***************************************************************************** >> build_results.txt
-echo Build H5Tinit.exe >> build_results.txt
-echo ***************************************************************************** >> build_results.txt
-
-cd windows\misc\typegen\h5tinit
-msdev h5tinit.dsp /make "h5tinit - Win32 Debug" /Rebuild /out ..\..\..\..\h5tinit.log
-cd ..\..\..\..\
-more h5tinit.log >> build_results.txt
-del h5tinit.log
-
-echo ***************************************************************************** >> build_results.txt
-echo Build HDF5 C/C++ Libraries and Tools >> build_results.txt
-echo ***************************************************************************** >> build_results.txt
-
-cd src
-h5tinit.exe > h5tinit.c
-
-cd ..\windows\proj\all
-msdev all.dsw /make "hl_test_table_cpp - ALL" "hl_test_table_cppdll - ALL" "testhdf5_cppdll - ALL" "testhdf5_cpp - ALL" "dsets_cppdll - ALL" "dsets_cpp - ALL" "all - ALL" /Rebuild /out ..\..\..\all.log
-cd ..\..\..\
-more all.log >> build_results.txt
-del all.log
-GOTO END
-
-:BUILDF90
-type nul > build_results.txt
-echo ***************************************************************************** >> build_results.txt
-echo Build H5Tinit.exe >> build_results.txt
-echo ***************************************************************************** >> build_results.txt
-
-cd windows\misc\typegen\h5tinit
-msdev h5tinit.dsp /make "h5tinit - Win32 Debug" /Rebuild /out ..\..\..\..\h5tinit.log
-cd ..\..\..\..\
-more h5tinit.log >> build_results.txt
-del h5tinit.log
-
-echo ***************************************************************************** >> build_results.txt
-echo Generate H5f90i_gen.h and H5fortran_types.f90
-echo ***************************************************************************** >> build_results.txt
-
-REM Generate H5fortran_detect.f90
-cd windows\misc\H5fortran_detect_gen
-dfdev H5fortran_detect_gen.dsp /make "H5fortran_detect_gen - Win32 Debug" /Rebuild /out ..\..\..\H5fortran_detect_gen.log
-cd ..\..\..\fortran\src
-H5fortran_detect_gen.exe > H5fortran_detect.f90
-del H5fortran_detect_gen.exe
-cd ..\..\
-more H5fortran_detect_gen.log >> build_results.txt
-del H5fortran_detect_gen.log
-
-REM Generate H5fort_type_defines.h
-cd windows\misc\fortrantypegen
-dfdev H5fortran_detect.dsp /make "H5fortran_detect - Win32 Debug" /Rebuild /out ..\..\..\H5fortran_detect.log
-cd ..\..\..\fortran\src
-H5fortran_detect.exe > H5fort_type_defines.h
-del H5fortran_detect.exe
-cd ..\..\
-more H5fortran_detect.log >> build_results.txt
-del H5fortran_detect.log
-
-REM Generate H5f90i_gen.h and H5fortran_types.f90
-cd windows\misc\matchtypegen
-dfdev H5match_types.dsp /make "H5match_types - Win32 Debug" /Rebuild /out ..\..\..\H5match_types.log
-cd ..\..\..\fortran\src
-H5match_types.exe
-del H5match_types.exe
-cd ..\..\
-more H5match_types.log >> build_results.txt
-del H5match_types.log
-
-echo ***************************************************************************** >> build_results.txt
-echo Build HDF5 C/Fortran Libraries and Tools >> build_results.txt
-echo ***************************************************************************** >> build_results.txt
-
-cd src
-h5tinit.exe > h5tinit.c
-
-cd ..\windows\proj\all
-msdev all.dsw /make "hl_test_image_fortrandll - ALL" "hl_test_lite_fortrandll - ALL" "hl_test_table_fortrandll - ALL" "hl_test_image_fortran - ALL" "hl_test_lite_fortran - ALL" "hl_test_table_fortran - ALL" "testhdf5_fortrandll - ALL" "testhdf5_fortran - ALL" "flush2_fortrandll - ALL" "flush2_fortran - ALL" "flush1_fortrandll - ALL" "flush1_fortran - ALL" "all - ALL" /Rebuild /out ..\..\..\all.log
-cd ..\..\..\
-more all.log >> build_results.txt
-del all.log
-GOTO END
-
-:BUILDALL
-type nul > build_results.txt
-echo ***************************************************************************** >> build_results.txt
-echo Build H5Tinit.exe >> build_results.txt
-echo ***************************************************************************** >> build_results.txt
-
-cd windows\misc\typegen\h5tinit
-msdev h5tinit.dsp /make "h5tinit - Win32 Debug" /Rebuild /out ..\..\..\..\h5tinit.log
-cd ..\..\..\..\
-more h5tinit.log >> build_results.txt
-del h5tinit.log
-echo ***************************************************************************** >> build_results.txt
-echo Generate H5f90i_gen.h and H5fortran_types.f90
-echo ***************************************************************************** >> build_results.txt
-
-REM Generate H5fortran_detect.f90
-cd windows\misc\H5fortran_detect_gen
-dfdev H5fortran_detect_gen.dsp /make "H5fortran_detect_gen - Win32 Debug" /Rebuild /out ..\..\..\H5fortran_detect_gen.log
-cd ..\..\..\fortran\src
-H5fortran_detect_gen.exe > H5fortran_detect.f90
-del H5fortran_detect_gen.exe
-cd ..\..\
-more H5fortran_detect_gen.log >> build_results.txt
-del H5fortran_detect_gen.log
-
-REM Generate H5fort_type_defines.h
-cd windows\misc\fortrantypegen
-dfdev H5fortran_detect.dsp /make "H5fortran_detect - Win32 Debug" /Rebuild /out ..\..\..\H5fortran_detect.log
-cd ..\..\..\fortran\src
-H5fortran_detect.exe > H5fort_type_defines.h
-del H5fortran_detect.exe
-cd ..\..\
-more H5fortran_detect.log >> build_results.txt
-del H5fortran_detect.log
-
-REM Generate H5f90i_gen.h and H5fortran_types.f90
-cd windows\misc\matchtypegen
-dfdev H5match_types.dsp /make "H5match_types - Win32 Debug" /Rebuild /out ..\..\..\H5match_types.log
-cd ..\..\..\fortran\src
-H5match_types.exe
-del H5match_types.exe
-cd ..\..\
-more H5match_types.log >> build_results.txt
-del H5match_types.log
-
-echo ***************************************************************************** >> build_results.txt
-echo Build HDF5 C/C++/Fortran Libraries and Tools >> build_results.txt
-echo ***************************************************************************** >> build_results.txt
-
-cd src
-h5tinit.exe > h5tinit.c
-
-cd ..\windows\proj\all
-msdev all.dsw /make "hl_test_image_fortrandll - ALL" "hl_test_lite_fortrandll - ALL" "hl_test_table_fortrandll - ALL" "hl_test_image_fortran - ALL" "hl_test_lite_fortran - ALL" "hl_test_table_fortran - ALL" "testhdf5_fortrandll - ALL" "testhdf5_fortran - ALL" "flush2_fortrandll - ALL" "flush2_fortran - ALL" "flush1_fortrandll - ALL" "flush1_fortran - ALL" "testhdf5_cppdll - ALL" "testhdf5_cpp - ALL" "dsets_cppdll - ALL" "dsets_cpp - ALL" "hl_test_table_cpp - ALL" "hl_test_table_cppdll - ALL" "all - ALL" /Rebuild /out ..\..\..\all.log
-cd ..\..\..\
-more all.log >> build_results.txt
-del all.log
-GOTO END
-
-:WRONG
-echo The syntax of the command is incorrect.
+@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 7, 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.
+
+:: By default, only C and C++ libraries are built.
+
+if defined hdf5_debug echo ON
+
+if "x%1"=="x" goto main
+goto help
+
+:: Print a help message
+:help
+echo.Builds HDF5 Libraries and Tools.
echo.
-
-:HELP
-echo Builds HDF5 Libraries and Tools.
+echo %0 [OPTION]
echo.
-echo hdf5build [OPTION]
+echo.Please use one of the following options!
echo.
-echo Please use one of the following options!
+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 hdf5build Build HDF5 C Library and Tools
-echo hdf5build enablecpp Build HDF5 C/C++ Libraries and Tools
-echo hdf5build enablefortran Build HDF5 C/Fortran Libraries and Tools
-echo hdf5build enableall Build HDF5 C/C++/Fortran Libraries and Tools
-echo hdf5build /? Help information
-:END \ No newline at end of file
+echo.***************************************************************************** >> %build_results%
+echo. Build HDF5 Libraries and Tools >> %build_results%
+echo.***************************************************************************** >> %build_results%
+echo. >> %build_results%
+
+
+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%
+
+ goto error
+)
+
+echo. All HDF5 libraries and tools build successfully!
+echo. All HDF5 libraries and tools build successfully! >> %build_results%
+
+call :cleanup
+
+if defined hdf5_debug pause
+goto :eof
+
+:: Setup our environment
+:setup
+
+echo. Setting up environment >> %build_results%
+
+:: Put us in the directory of the batch file.
+pushd %~dp0
+
+:: 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%
+
+:: 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%
+
+:: By default, use the Visual Studio .NET environment
+call "%vs71comntools%\vsvars32.bat" >> %build_results%
+
+if defined hdf5_debug pause
+goto :eof
+
+
+:: Build H5tinit.exe and generate h4tinit.c
+:h5tinit
+
+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 1 goto :eof
+
+:: Use output to generate h5tinit.c
+.\src\h5tinit.exe > .\src\h5tinit.c
+
+if defined hdf5_debug pause
+goto :eof
+
+
+:: Build the HDF5 libraries. By default, C and C++ libraries are built.
+:all
+
+echo. Building HDF5
+
+echo.***************************************************************************** >> %build_results%
+echo. Build HDF5 C Library and Tools >> %build_results%
+echo.***************************************************************************** >> %build_results%
+echo. >> %build_results%
+
+:: 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
+
+
+:: Handle errors
+:error
+
+:: 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
+
+if defined hdf5_debug pause
+goto :eof
+
+
+:: Cleanup our environment
+:cleanup
+
+set zlib_name=
+set szip_name=
+set build_results=
+popd
+
+if defined hdf5_debug pause
+goto :eof