Windows

These installation instructions have been tested with Microsoft Visual Studio 2005, 2008, 2010, 2012, and with MinGW

  • Probably with small modifications, they should also work for NMake
  • If you would like to use NMake and you run in troubles, drop us a line to Hermes2D mailing list.
  • On windows, a crucial file to edit is CMake.vars.example (see further).

Dependency check-list

This list works for 32-bit version of Hermes.

  • You need to install dependent libraries into either common directory, or separate directories. This directory, further called ‘dependencies’ (stands for the particular directory in the case of particular dependency), has to have three subdirectories as follows. The choice of having a single common directory, or separate ones is up to you.

    • ‘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 the ‘PATH’ environment variable (you need to include all of them if you chose to have separate ones for various dependencies).
  • PTHREAD(2.8.0)

  • UMFPACK

    • MinGW used for compiling AMD and UMFPACK: Download MinGW.
    • after installing MinGW, add ‘your-minGW-installation-directory’/bin to system PATH.
    • download latest SuiteSparse_config, AMD, and UMFPACK to A SINGLE PARENT DIRECTORY (this requirement is one of UMFPACK).
    • Add the following lines at the end of file SuiteSparse_config\SuiteSparse_config.mk:
      • CC = gcc
      • CXX = gcc
      • UMFPACK_CONFIG = -DNBLAS
      • RANLIB = echo
      • LIB = -lm
    • Open all files called ‘Makefile’ from all three directories and replace all ‘;’ symbols in them with the Windows equivalent ‘&’
    • Copy SuiteSparse_config\SuiteSparse_config.h to ‘include’ directory
    • Copy SuiteSparse_config\libsuitesparseconfig.a to ‘lib’ directory and change its extension to Windows equivalent ‘.lib’.
    • Copy AMD\Include\amd.h, AMD\Include\amd_internal.h, and AMD\Lib\libamd.a to ‘include’, and ‘lib’ dependecy directories respectively. Change the libamd.a’s extension to ‘.lib’
    • Copy UMFPACK\Include\* to ‘include’
    • Copy UMFPACK\Lib\libumfpack.a to ‘lib’ directory and change its extension to Windows equivalent ‘.lib’.
  • 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)

    • 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.
  • XERCES

  • The rest is optional. If a directive WITH_EXODUSII is not used, this step including all sub-steps can be skipped and you can proceed to build Hermes.

    • 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 andlet 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="my_dependencies\lib\zlib1.lib
        
      • If SLIB is used, set variable HDF5_EXT_SLIB similarly as:

        set HDF5_EXT_SLIB="my_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

Building Hermes

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

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

  • Copy a file ‘CMake.vars.example’ to ‘CMake.vars’. The file contains settings for the project.

  • Modify the file ‘CMake.vars’. For example, you could set the first line as:

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

    cmake . -G "Visual Studio 8 2005"  # MSVC2005 user
    cmake . -G "Visual Studio 9 2008"  # MSVC2008 user
    cmake . -G "Visual Studio 10"      # MSVC2010 user
    cmake . -G "Visual Studio 11"      # MSVC2012 user
    cmake . -G "MinGW Makefiles"       # MinGW 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.

  • Open the SLN file ‘hermes.sln’ and build Hermes.

Configuration options

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

  • H2D_WITH_GLUT : If the line in your CMake.vars “set(H2D_WITH_GLUT NO)” is uncommented, it 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.
  • H2D_WITH_TEST_EXAMPLES : Produce project files for the test examples, which are a quick hands-on introduction to how Hermes works.

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 an empty Win32 console project.
  • Add directories ‘dependencies\lib’ to additional library directories (<right click on your project>\Properties\Configuration Properties\Linker\Additional Library Directories).
  • Add also the directory where you copied Hermes libraries to as an additional library directory. This would probably be the variable TARGET_ROOT in your CMake.vars file.
  • Add ‘include “hermes2d.h”’, make sure that your TARGET_ROOT is among Include Directories settings in your compiler.
  • Add the dependencies\include directory (and possibly other directories where you copied dependency headers) using
  • Project -> Properties -> Configuration Properties -> VC++ Directories -> Include Directories:
  • Deny (Ignore) warnings that are not indicating anything dangerous:
    • Ignore 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).
    • Ignore 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).
    • Also ignore any template instantiation warnings
  • Resolve LIBCMTD.lib LNK2005 errors when building hermes2D (This only happened once) - http://support.microsoft.com/kb/148652 (Solution # 1)
  • Resolve unresolved linker error in Xerces - http://stackoverflow.com/questions/10506582/xerces-c-unresolved-linker-error

Table Of Contents

Previous topic

Linux

Next topic

Mac OS