Using CMake with VisIt on Windows

 Prerequisites

Sources:

• VisIt's src subdirectory.
• VisIt's windowsbuild/<MSVC-VERSION> subdirectory.
• Substitute for <MSVC_VERSION> the Visual Studio version you will be using
• MSVC2012 (for version 11, 32-bit)
• MSVC2012-x64 (for version 11, 64 bit)
• VisIt's windowsbuild/distribution subdirectory (if you plan to make a distribution).
• 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 2012 (this version is still actively maintained for VisIt)
• 32-bit
• 64-bit
• Visual Studio 2010 (support for this version no longer being maintained)
• 32-bit
• 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.

By default, most of the supported database reader plugins are built, which can slow down loading of the solution in the Visual Studio IDE, and slow down the build. If you want to reduce the number of plugins built, add a CMake var using the Add Entry Button.

The Name should be VISIT_SELECTED_DATABASE_PLUGINS. The Type should be STRING. The value is a ';' separated list of database plugins names (case should match the name of the folder in /src/databases. Similar can be done for plots and operators, using the VisIt CMake variables VISIT_SELECTED_PLOT_PLUGINS or VISIT_SELECTED_OPERATOR_PLUGINS.

Click 'OK' when finished.

In the main CMake Window, 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 2012 (version 11) and 2010 (version 10) 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 or entries that are new since the last configure.

You can modify how many entries are seen, and how they are viewed by selecting the: Grouped, and/or Advanced buttons. Grouped groups similarly named items, Advanced shows all the entries. Using both is probably the easiest to navigate for use with VisIt. Mouse-hover over individual entries (not groups) will generate a brief description.

Most of the default settings should be fine, though you may want to change CMAKE_INSTALL_PREFIX from its default location within the Build directory.

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 2012 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 11 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(\${VISIT_SOURCE_DIR}/config-site/windows.cmake)
# Now, override any options (such as where to find hdf5)
# You can even suppress particular warnings:
# You can specify that the parallel engine be built (this option can also be toggled in the cmake gui)
VISIT_OPTION_DEFAULT(VISIT_PARALLEL ON TYPE BOOL)


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)