# Using CMake with VisIt on Windows

##  Prerequisites

Sources:

• VisIt's src subdirectory.
• VisIt's windowsbuild subdirectory.
• VisIt's data subdirectory (if you plan to make a distribution).

Software:

• CMake version 2.8.12.2 or newer. Do not use the cmake included with cygwin!
• Visual Studio 2008 (no guarantee how much longer VisIt will continue to support this version.)
• 32-bit
• 64-bit
• Visual Studio 2010
• 32-bit
• 64-bit
• Visual Studio 2012
• 64-bit

##  Configuring using cmake-gui.exe

Run cmake-gui.exe, which will display this window:

Fill in the location of VisIt's src directory in the 'Where is the source code:' section.

Then tell CMake where you want the build to go by filling in 'Where to build the binaries'. It is best to create a new build directory peer to the src and windowsbuild directories. Tell CMake to build VisIt inside of the build directory so it does not pollute your src directory with object files and so on.

The Browse buttons come in handy here.

Click the 'Configure' button.

If the build directory does not exist, you will be prompted to allow its creation.

You will also be prompted to choose a 'generator'.

Currently, only Visual Studio versions 2008 and 2010 are supported by pre-built Third-party libs in VisIt's windowsbuild directory. 32-bit and 64-bit are supported for both versions.

CMakeCache entries will be displayed after initial configure. All entries at this point will be highlighted -- a signal that you may want to modify some of them. Subsequent 'Configure' highlights only entries that contain errors.

There are three ways to view the changes: Simple View, Advanced View, and Grouped View. Both Advanced and Grouped allow you to see all the entries, but Grouped is a bit easier to navigate.

Most of the default settings should be fine, though you may want to change CMAKE_INSTALL_PREFIX from its default of 'C:\Program Files\VisIt <visitversion>'.

Mouse-hover over entries will generate a brief description, as shown below.

Make any changes, and click the 'Configure' button again. Once you are satisfied with the choices and no entries are highlighted (in error), click 'Generate'. (You must always 'Configure' after making changes to entries). Solution and project files will then be generated.

##  Configuring from the command line

You can configure from the command line, similar to *nix systems. Run cmake.exe without any arguments to get a list of options, and to see how generators are specified.

For VS 2010 64-bit, assuming you are in your Build directory, which is peer to VisIt's src directory, you would run:

"C:\Program Files\CMake-2.8\bin\cmake.exe" -G "Visual Studio 10 Win64" ..\src


You can then hand-edit the CMakeCache.txt file, rerun cmake.

Solution and project files are regenerated with each call to cmake.exe.

##  Building

The main solution file is named VISIT, and will be in the root Build directory. Open the solution, choose your configuration, and build the ALL_BUILD project. If you build from the Visual Studio IDE, sometimes various projects will fail due to an apparent glitch in the parallel build. If that happens, simply run the build again and any out of date projects will be built.

You may also build from the command line:

32-bit Debug:

devenv VISIT.sln /Build "Debug|Win32"


32-bit Release:

devenv VISIT.sln /Build "Release|Win32"


64-bit Debug:

devenv VISIT.sln /Build "Debug|x64"


64-bit Release:

devenv VISIT.sln /Build "Release|x64"


After the build completes, the generated binaries will be placed under the exe directory for the most part.

(<config_type> will correspond to configuration you chose during build, e.g. debug or release)

• .lib -> <root_build_dir>\lib\<config_type>
• .dll -> <root_build_dir>\exe\<config_type>
• .exe -> <root_build_dir>\exe\<config_type>
• .dll's for plugins (plots, operators, databases) -> <root_build_dir>\exe\<plugin_type>

## Installing

If you set CMAKE_INSTALL_PREFIX when you ran cmake then you can install VisIt once you have built it. You can install VisIt by building the INSTALL target in Visual Studio.

##  Running VisIt from the build directory

Once the build completes, you can run VisIt by

• double-clicking visit.exe (in exe\<config_type>), or
• from a command prompt, eg
• > c:\path\to\visit_build_dir\exe\Release\visit.exe

NOTE: If you have previously built a development version of VisIt and had set VISITDEVDIR in your environement, delete this before attempting to run visit.exe.

##  Creating a package for installing VisIt on other windows systems

Build the _PACKAGE target from within Visual Studio. You may also generate the installer from the command line using the following command:

devenv VISIT.sln /Build "Release|x64" /Project _PACKAGE


An installer executable named visit<version>.exe will be created in the INSTALL directory chosen with CMake.

##  CAVEATs

• VisIt is set up by default to build on Windows with the pre-built third-party libs in VisIt's windowsbuild subdirectory. It is possible to create your own config-site/host.cmake that specifies the paths to pre-built packages but if you do not have such a config-site file then the default Windows.cmake file will be used. If you do create your own config-site file then we recommend that you include the Windows.cmake file in it and then override any options that may have been set.
INCLUDE(config-site/windows.cmake)
# Now, override any options (such as where to find hdf5)


### Suppressing Regeneration

The solution file that cmake creates has a project called ZERO_CHECK that is occasionally invoked to regenerate the projects. This is highly undesirable since it tends to happen during a build and can cause many projects to be reloaded into the IDE, wasting time unnecessarily. To avoid this behavior, you can put this line into your host.cmake file:

SET(CMAKE_SUPPRESS_REGENERATION TRUE)