Windows (MSVC)

This section describes how to build and use Hermes in Microsoft Visual C++ 2008 (Express Edition). These instructions should probably work even for older versions of MS Visual C++ down to version 2005.

Known limitations and issues

  • Stand-alone viewers do not compile.

Building Hermes

In order to build the library and examples, you need to:

  • Prepare dependecy libraries, see ‘Dependency Check-list’.

  • Copy a file ‘my_hermes_root\CMakeVars\MSVC\CMake.vars’ to ‘my_hermes_root’. The file contains settings for the project.

  • Modify the file ‘my_hermes_root\CMakeVars\MSVC\CMake.vars’. The first line has to be modified, for info about the rest of the file, please refer to Linus installation instructions. Please, follow comments in the file. For example, you could set the first line as:

    set(DEP_ROOT "../dependencies")
    
  • In the directory ‘my_hermes_root’, to create project files by running CMAKE from a command prompt:

    cmake . -G "Visual Studio 9 2008"  # MSVC2008 user
    cmake . -G "Visual Studio 10"      # MSVC2010 user
    

    If you have Cygwin installed, your might have an error “Coulld not create named generator Visual Studio 10”. This is because your cmake path is contaminated by Cygwin’s cmake. Try to use absolute path for windows cmake.exe.

    You also need to copy the file ‘my_hermes_root\CMakeVars\MSVC\inttypes.h’ to the include folder in your dependency folder.

  • Open the SLN file ‘my_hermes_root\hermes.sln’ and build Hermes. Actually, this step is not necessary if you plan to use Hermes in your projects rather than explore tutorials.

Configuration options

Hermes is configured through preprocessor directives. Directives are generated by CMAKE and your settings might be overriden by CMAKE. The directives are:

  • NOGLUT : excludes GLUT-dependant parts. This replaces viewers with an empty implementation that does nothing if invoked. If used, the library ‘freeglut.lib’ does not need to be linked.
  • ENABLE_VIEWER_GUI : enables GUI for viewers. Currently, only ‘ScalarView’ support GUI because this is an experimental feature. This directive is mutually exclusive with NOGLUT. If used, a library ‘AntTweakBar.lib’ does not need to be linked.

Using Hermes

In order to use Hermes in your project, you need to do the following steps. Steps has 5, 6, and 7 to be repeated for every configuration, i.e., Debug, Release. Except the step 7b, this can be done easily by setting the drop-down Configuration to ‘All configurations’ in the Project Property dialog.

  • Prepare Hermes to be buildable by MSVC, see ‘Building Hermes’.
  • Create your project in MSVC. Set the project to be empty Win32 console project.
  • Add either ‘my_hermes_root\src\hermes-real.vcproj’ or ‘my_hermes_root\src\hermes-cplx.vcproj’ project to your solution (<right click on solution>\Add\Existing Project...).
  • Set that your project depends on hermes-real/cplx project (<right click on your project>\Project Dependences...).
  • Add directories ‘my_hermes_directory\src’ and ‘dependencies\include’ to additional include directories (<right click on your project>\Properties\Configuration Properties\C/C++\Additional Include Directories).
  • Add directories ‘dependencies\lib’ to additional library directories (<right click on your project>\Properties\Configuration Properties\Linker\Additional Library Directories).
  • Deny warnings that are not indicating anything dangerous:
    • Avoid warnings about STL in DLL by denying a warning 4251 (<right click on your project>\Properties\Configuration Properties\C/C++\Advanced\Disable Specific Warnings, enter 4251).
    • Avoid warnings about standard functions that are not safe (<right click on your project>\Properties\Configuration Properties\C/C++\Preprocessor\Preprocessor Definitions, add _CRT_SECURE_NO_WARNINGS).

Dependency check-list

This list works for 32-bit version of Hermes.

  • In order to create the structure, execute the following command:

    'prepare_dep_dir.bat'.
    

    Be sure to include a directory ‘dependecies\bin’ into ‘PATH’ environment variable.

  • All Hermes project files assumes that dependency libraries are available in a fixed directory structure. The root of this structure has to have the same parent as does Hermes director, i.e., if ‘C:\my_work\hermes\’ is a root of the Hermes directory, then ‘C:\my_work\dependecies\’ is a root of the dependency directory. Subdirectories are:

    • dependencies\include: Header files (*.h) of dependency libraries.
    • dependencies\lib: Library files (*.lib) of dependency libraries.
    • dependencies\bin: Binary modules (*.dll) of dependency libraries. Be sure to include a directory ‘dependecies\bin’ into ‘PATH’ environment variable.
  • Python(2.6.5)

    • Download Python source code from http://www.python.org/ftp/python/2.6.5/Python-2.6.5.tar.bz2 and unpack it.

    • Navigate to Python-2.6.5\PCVS8.0\, you will find a MSVC 8.0 sln file pcbuild.sln.

    • Open it using your version of MSVC (newer versions will automatically convert the solution file).

    • Now build the python project (default one) and from the same directory copy python26_d.lib to dependencies\lib and python26_d.dll to dependencies\bin.

    • Copy Python.h from Python-2.6.5\Include\ to dependencies\include. This is for the Python library.

    • Download Python MSI installer http://www.python.org/ftp/python/2.6.5/python-2.6.5.msi ( http://www.python.org/ftp/python/2.6.5/python-2.6.5.amd64.msi for AMD64.

    • Install Python. You can install it into the same directory where you copied the downloaded source.
      • Add the path to python.exe to your PATH environment variable.
    • Open a command prompt, execute python, and you will see something like:

      python.exe
      Python 2.6.5 (r27:82500, Jan 20 2011, 18:55:31) [MSC v.1600 32 bit (Intel)] on win32
              >>>
      
      
            If you have Cygwin installed again, make sure you are running the Windows Python.
      
    • Numpy(ver-1.4.1)

    • Cython(ver-0.12.1)

      • Download Cython (http://www.cython.org/#download), and unpack it.

      • Open a command prompt, got to ‘my_Cython_root’, and excute following:

        python.exe setup.py install
        
      • Add the path to ‘my_Cython_root\bin’ to your system PATH.

  • PTHREAD(2.8.0)

  • UMFPACK

    • UFConfig(ver-3.4.0):
    • AMD(ver-2.2.0):
      • Download AMD source file package (http://www.cise.ufl.edu/research/sparse/amd/).
      • Unpack source files into a directory that has the same parent as a directory where you unpacked UFconfig.
      • Copy the file ‘my_hermes_root\CMakeVars\MSVC\AMD.nmake’ to a directory ‘my_amd_directory\Lib’.
      • Run MSVC command prompt and switch to ‘my_amd_directory\Lib’.
      • Compile AMD using ‘nmake -f AMD.nmake’.
      • Copy ‘Include\amd.h’, ‘Include\amd_internal.h’, and ‘Lib\libamd.lib’ to ‘include’, and ‘lib’ dependecy directories respectively.
    • UMFPACK(ver-5.4.0)
      • Download UMFPACK source file package (http://www.cise.ufl.edu/research/sparse/umfpack/).
      • Unpack source file into a directory that has the same parent as a directory where you unpacked UFconfig.
      • Copy the file ‘my_hermes_root\CMakeVars\MSVC\UMFPACK.nmake’ to the ‘my_umfpack_root\Lib’ directory.
      • Run MSVC command prompt and switch to ‘my_umfpack_root\Lib’.
      • Compile UMFPACK using ‘nmake -f UMFPACK.nmake’. Linking might take some time, please, be patient.
      • Copy ‘libumfpack.dll’, all include files, and ‘libumfpack.lib’ to ‘bin’, ‘include’, and ‘lib’ dependecy directories, respectively.
  • CMAKE

  • CLAPACK - First, you need to install CLAPACK/CBLAS: - Download the file clapack-3.2.1-CMAKE.tgz from http://www.netlib.org/clapack/. - Use cmake to configure and build the debug version of clapack. - Copy ‘\clapack-3.2.1-CMAKE\BLAS\SRC\Debug\blas.lib’, ‘\clapack-3.2.1-CMAKE\F2CLIBS\libf2c\Debug\libf2c.lib’, and ‘\clapack-3.2.1-CMAKE\SRC\Debug\lapack.lib’ to ‘lib’ dependency directory. - Copy the contains of ‘\clapack-3.2.1-CMAKE\INCLUDE\’ to ‘include’ dependency directory.

  • OpenGL support (optional)

    • If a directive NOGLUT is used, this step and all its substeps can be skipped.
    • FREEGLUT
      • Download freeglut 2.4.0 (http://freeglut.sourceforge.net/) and unpack it.
      • Open the your_freeglut_2.4.0_root\freeglut.DSP file in Visual Studio and convert it to a newer format.
      • Compile Debug or Release version. Debug version is recommended in a case of debugging.
      • Copy ‘freeglut.dll’, ‘freeglut.h’, and ‘freeglut.lib’ to ‘bin’, ‘include\GL’, and ‘lib’ dependency directories, respectively/.
    • GLEW
      • Download glew Win32 precompiled binaries ver.1.5.4 (http://glew.sourceforge.net/) and unpack it.
      • Copy ‘my_glew_root\bin\glew32.dll’, ‘my_glew_root\include\GL\*.h’, and ‘my_glew_root\lib\glew32.lib’ to ‘bin’, ‘include\GL’, and ‘lib’ dependency directories respectively.
  • AntTweakBar (optional)

    • If a directive ENABLE_VIEWER_GUI is not used, this step can be skipped.
    • Download a modified version 1.1.3 of AntTweakView (http://hpfem.org/downloads/AntTweakBar.1.1.3.modified.tar.gz) and unpack it.
    • Open SLN file in MSVC and compile it.
    • Copy ‘AntTweakBar.dll’, ‘AntTweakBar.h’, and ‘AntTweakBar.lib’ to ‘bin’, ‘include’, and ‘lib’ dependency directories respectively.
  • ExodusII (optional)

    • If a directive WITH_EXODUSII is not used, this step including all sub-steps can be skipped.

    • Zlib

      • Download sources of version 1.2.3 (http://sourceforge.net/projects/libpng/files/) and unpack them.

      • Open ‘my_zlib_root/projects/visualc6/zlib.dsw’ (Visual C++ 6 Solution File) in MSVC08 and let MSVC to convert it and save the .sln file

        (MSVC10 user can open the .sln file).

      • Switch a configuration to ‘Release DLL’ in Configuration Manager.

      • Build project ‘zlib’: this will create DLL/LIB files in ‘my_zlib_root/projects/visual6/Win32_DLL_Release’.

      • Copy ‘zlib1.dll’, ‘zlib.h/zconf.h’, and ‘zlib1.lib’ to ‘bin’, ‘include’, and ‘lib’ dependency directories respectively.

    • HDF5

      • Download sources of version 1.8.x (ftp://ftp.hdfgroup.org/HDF5/hdf5-1.8.0/src/) and unpack them.

      • Since SLIB is not used, comment out a line ‘#define H5_HAVE_FILTER_SZIP 1’ in the header file ‘my_hdf5_root\windows\src\H5pubconf.h’

      • Copy the file ‘my_hdf5_root\windows\src\H5pubconf.h’ to the directory ‘my_hdf5_root\src\’

      • Run MSVC Command Prompt and switch to a directory ‘my_hdf5_root\windows\proj’

      • Set variable HDF5_EXT_ZLIB to ‘my_dependencies\lib\zlib1.lib’, by issusing the following:

        set HDF5_EXT_ZLIB="C:\my_hermes_root\dependencies\lib\zlib1.lib
        
      • If SLIB is used, set variable HDF5_EXT_SLIB similarly as:

        set HDF5_EXT_SLIB="C:\my_hermes_root\dependencies\lib\slib.lib
        
      • To open SLN file in MSVC by issusing the following in the command prompot, and let MSVC to convert files:

        VCExpress.exe all\all.sln
        
      • Switch a configuration to ‘Release’

      • Build project ‘hdf5_hldll’: this will create DLL/LIB files in ‘my_hdf5_root\proj\hdf5_hldll\Release\’ and ‘my_hdf5_root\proj\hdf5dll\Release\’

      • Copy ‘hdf5dll.dll’ and ‘hdf5dll.lib’ to ‘bin’ and ‘lib’ dependency directories respectively

      • Copy ‘hdf5_hldll.dll’ and ‘hdf5_hldll.lib’ to ‘bin’ and ‘lib’ dependency directories respectively

      • Currently, only MSVC08 is supported under Vista. But MSVC08/10 should be supported under Windows XP.

    • NetCDF

      • Download sources of version 4.0.1 (http://www.unidata.ucar.edu/downloads/netcdf/netcdf-4_0_1/index.jsp) and unpack them.
      • Open a SLN file ‘my_netcfd_root\win32\NET\netcdf.sln’.
      • Switch to ‘Release’ version.
      • In properties of the project ‘netcdf’.
        • Add paths ‘my_hdf5_root\src\’ and ‘my_hdf5_root\hl\src’ to ‘C/C++ -> Additional Include Directories’
        • Add a path ‘dependencies\lib\’ to ‘Linker -> Additional Library Directories’
      • Build project ‘netcdf’: this will create DLL/LIB files in ‘my_netcdf_root/win32/NET/Release’
      • Copy ‘netcdf.dll’ and ‘netcdf.lib’ to ‘bin’ and ‘lib’ dependency directories respectively
      • Copy ‘my_netcdf_root\libsrc4\netcdf.h’ to ‘include’ dependency directory
    • ExodusII

      • Download sources of version 4.9.3 (http://sourceforge.net/projects/exodusii/) and unpack ‘exodusii’

      • Add the following line to the file ‘my_exodusii_root\CMakeLists.txt’ as:

        PROJECT(Exodusii)
        SET(NETCDF_INCLUDE_DIR "my_netcdf_root/libsrc4")    # add this line;
        

        be sure to use a slash ‘/’ instead of a backslash ‘\’.

      • Generate MSVC project files using CMAKE in command prompt as:

        cmake . -G "Visual Studio 9 2008"    # MSVC2008 user
        cmake . -G "Visual Studio 10"        # MSVC2010 user
        

        If you have Cygwin installed, make sure that you are using the windows version of cmake.

      • Open a SLN file ‘my_exodusii_root/ExodusII.sln’ in MSVC08/10

      • Switch to ‘Release’ version

      • Build a project ‘exoIIv2c’: this will create a LIB file in ‘my_exodusii_root\cbind\Release’

      • Copy ‘exoIIv2c.lib’ to ‘lib’ dependency directory structure

      • Copy ‘my_exodusii_root\cbind\include\exodusII.h and exodusII_ext.h’ to ‘include’ dependency directory

Table Of Contents

Previous topic

Windows (Cygwin)

Next topic

Installation of Matrix Solvers