New instructions (incomplete)

Microsoft have recently developed a C++ package manager (vcpkg), and begun integrating CMake with Visual Studio.

Prerequisites

Before following this guide, make sure you have the following installed:

Setting up Vcpkg

Start a Visual Studio developer command prompt as administrator, and navigate to the directory in which you want to install dependencies:

git clone -b fortran-ports https://github.com/albertziegenhagel/vcpkg.git
cd vcpkg
.\bootstrap-vcpkg.bat
.\vcpkg integrate install

Open the file path\to\vcpkg\triplets\x64-windows.cmake and add the following line:

set(VCPKG_FORTRAN_COMPILER <compiler>)

where <compiler> is either Intel or PGI (case sensitive), depending on whether you installed the Intel or PGI Fortran compiler.

Install Chaste dependencies

From the vcpkg home directory, type

.\vcpkg install petsc:x64-windows hdf5:x64-windows sundials:x64-windows vtk:x64-windows boost:x64-windows

This will take several hours.

Using the installed packages

Provided you did the integrate install step with administrator privileges above, everything should work as if by magic:

All C++ projects can now #include any installed libraries.
Linking will be handled automatically.
Installing new libraries will make them instantly available.

Work in progress

Old instructions

Installing Chaste on Windows

Note: the Windows installation is new, and has not yet been tested end-to-end on a clean machine. We would welcome feedback on whether it works for you!

The latest development version of Chaste has support for building on Windows using Microsoft Visual Studio and CMake. Currently we run automated tests on a Windows 7 machine using Visual Studio 2010.

Ozzy is testing this on Windows 8.1 With Visual Studio 2012

There is a document giving background to the Windows port at source:trunk/docs/Windows. The instructions below are a newer (and somewhat experimental) version, and are more streamlined.

Chaste's third party dependencies need to be built with compatible compiler & linker flags or Chaste will fail to link. However, this is largely taken care of for you by a set of CMake scripts that build everything.

NB. Building Chaste and all its third party dependencies requires a lot of disk space - roughly 100GB on our machine!

Install build tools

You will need:

  1. CMake (from http://www.cmake.org, at least version 2.8)
    • I used the cmake-2.8.12.1-win32-x86.exe installer and added CMake to the system PATH for current user
  2. A command-line SVN client (e.g. free SlikSVN from http://www.sliksvn.com/en/download/)
    • I used Slik-Subversion-1.8.5-x64.exe
  3. Visual Studio C++ compiler (2010 or 2012 version)
    • I'm using Visual Studio 2013
  4. Python 2.7.x (from http://python.org/download/)
    • I'm using python-2.7.6.amd64.exe with default settings
  5. (Optional) Cygwin (from http://cygwin.com, for PETSc configuration)
    • I haven't installed this

The Chaste CMake scripts can install Cygwin for you if desired, using the -DAUTO_INSTALL_CYGWIN:BOOL=ON flag. If installing it yourself, make sure that you include the following packages: mingw64-i686-gcc-core, gendef, python, cmake, make.

Note that the native Windows Python must appear before Cygwin's Python on your (Windows) PATH, or the PETSc configuration will fail.

Install MPI

Download the relevant stand-alone, and redistributable, installer for the Microsoft MPI implementation from http://www.microsoft.com/en-gb/download/details.aspx?id=36045

For a 64-bit build (the only supported option for Chaste) install mpi_x64.msi.

A typical install path is "C:\Program Files\Microsoft HPC Pack 2012\". Note however that PETSc will not be able to find MPI if the path supplied contains spaces! We recommend circumventing this problem by creating a soft link to the MPI installation, for example by running the following command from a Windows command prompt (Opening the command prompt as administrator):

C:\> mklink /D MS_HPC_PACK_2012 "C:\Program Files\Microsoft HPC Pack 2012"

This creates a soft link named MS_HPC_PACK_2012 at the root of the C: drive, that points at the Microsoft MPI installation directory.

  • I installed the mpi_x64.msi file

Download Source code and choose paths

Decide where you're going to build Chaste, and where you'll put the source. These should be near the root folder of a drive, since MSVC (especially version 10) has a relatively short limit on compiler command line lengths!

Add instructions to get chaste source code using SilkSVN

The instructions below assume you've created an empty folder D:\Chaste\build in which to build everything, and have unpacked the Chaste source tree in D:\Chaste\source. Change the relevant paths to suit your setup.

Build remaining dependencies and Chaste

You'll want to launch the Visual Studio Command Prompt (called 'Developer Command Prompt' in VS2013) in order to run the following commands, and may need administrator privileges:

D:
cd \Chaste\build
cmake -G "Visual Studio 10 Win64" D:/Chaste/source/cmake
# or cmake -G "Visual Studio 10 Win64" -DAUTO_INSTALL_CYGWIN:BOOL=ON D:/Chaste/source/cmake
cmake --build .

Note that the above will not work if run from Cygwin. Note also that you do need forward slashes in the cmake command arguments.

Ozzy Modified cmake\third_party_libs\CMakeLists.txt to comment out the conditional on AUTO_INSTALL_CYGWIN and used

cmake -G "Visual Studio 11 Win64" C:/Chaste/source/trunk/cmake

due to the different VS version and path. VS2013 needs '12' instead of '11'.

You may need to specify the version of MSVC used to the Boost build, by editing cmake/third_party_libs/CMakeLists.txt about line 243 and appending a version to the 'toolset=msvc' argument, e.g. 'toolset=msvc-12.0' for VS2013.

At present there appears to be an issue where the VTK install partially fails. However, it does install sufficiently that the Chaste build works, i.e. you can continue with the next section.

Build Chaste itself

Once the initial install of dependencies is complete, you can just build (and test) Chaste by itself, for example using:

D:
cd \Chaste\build\chaste
# If the VTK install gave errors, you'll also need the following line. It shouldn't hurt to include it in case...
cmake -G "Visual Studio 10 Win64" D:/Chaste/source   # Adjust the '10' as above
cmake --build .

Other flags may be supplied to the cmake invocations as follows (note the trailing full stops are part of the command):

  • cmake -DRUN_TESTS:BOOL=OFF -DTEST_MPIEXEC_ENABLED:BOOL=ON . : configure Chaste to build the tests and set them to run on 2 processes rather than 1. You then need to use "cmake --build ." to do the actual building.
  • cmake -DRUN_TESTS:BOOL=ON -DTEST_FAMILY:STRING="Continuous" . : this will run tests within the given test family that have previously been built.

Once you've used CMake to configure Chaste (i.e. running one of the commands that doesn't include --build) you can use the Visual Studio GUI to build Chaste, and also run/debug individual tests. Load D:\Chaste\build\chaste\Chaste.sln as the solution file.

Running debug just by hitting F5 never does the right thing - generally it tries to run 'ALL_BUILD' and hence will ask to build everything that's not up-to-date, then give an error because there's no such executable. Instead, right-click on the test you want then select Debug->Start new instance.