Using CMake with VisIt on Windows

From VisItusers.org

Jump to: navigation, search

Contents

[edit] 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 3.0 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


[edit] Configuring using cmake-gui.exe

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


Image:CMakeWindows_01.JPG

[edit] Locating source and build directories

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.


Image:CMakeWindows_02.JPG

[edit] Limiting Plugins

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. If you are producing a version of VisIt that you plan to distribute, you should skip this step so all database reader plugins are built.

Image:CMakeWindows_AddEntry.JPG

To limit the database plugins to a specific set of plugins, set the Name of the variable to 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.

The same procedure applies to plots and operators. The VisIt CMake variables to limit plots and operator plugins are VISIT_SELECTED_PLOT_PLUGINS and VISIT_SELECTED_OPERATOR_PLUGINS, respectively.

Image:CMakeWindows_AddDBEntry.JPG

Click 'OK' when finished.

[edit] Configuring

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'. On Windows, this corresponds to the version of Visual Studio for which you plan to generate a solution and projects.

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.

Image:CMakeWindows_03.JPG


CMakeCache entries will be displayed after the initial configure. All entries at this point will be highlighted reddish orange -- a signal that you may want to modify some of them. Subsequent clicks of the 'Configure' button highlight 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.

Image:CMakeWindows_04.JPG

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.

Image:CMakeWindows_05.JPG

[edit] Parallel

Assuming that you have installed the prerequisites for building parallel VisIt on Windows, you should choose to create a parallel build.

  1. Add a new CMake variable called VISIT_PARALLEL, set its type to BOOL and make sure that it is checked to turn on the parallel build.
  2. Click the Configure button again to make CMake check the prerequisites for building parallel VisIt. If the prerequisites are met then some new cache entries related to MPI will be created.

[edit] 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 create a new CMake cache entry:

  1. Add a new CMake variable called CMAKE_SUPRESS_REGENERATION', set its type to BOOL and make sure that it is checked.
  2. Click the Configure button again

You can automate this step in your host.cmake file by adding this line to your host.cmake file:

SET(CMAKE_SUPPRESS_REGENERATION TRUE)

[edit] Generate

Make any changes, and click the 'Configure' button again (You must always 'Configure' after making changes to entries). Once you are satisfied with the choices and no entries are highlighted (in error), click the 'Generate' button to tell CMake to generate the solution and project files.

[edit] Configuring from the command line

The CMake configuring process can be run from the command line, similar to *nix systems. This can be used to create automatic builds of VisIt. 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.

[edit] 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.

[edit] Visual Studio GUI

  1. Open the Visual Studio GUI
  2. Locate and open the VISIT solution file. Importing this file can take a while due to its large number of projects.
  3. Open the Configuration Manager window and select Release - x64 to select a release build of the 64-bit version. You will always want to make a Release build of some type in case there are not prebuilt debug libraries available in windowsbuild for a particular version of Visual Studio.
  4. Click on the ALL project name in the project explorer and start a build.

[edit] Command line

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"

[edit] Program Location

After the build completes, the generated VisIt binaries will be placed under the <build_dir>/exe directory for the most part.

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

*.lib -> <build_dir>\lib\<config_type> *.dll -> <build_dir>\exe\<config_type> *.exe -> <build_dir>\exe\<config_type> *.dll files for plugins (plots, operators, databases) -> <build_dir>\exe\<plugin_type>

[edit] 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.

[edit] 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.

[edit] 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.

[edit] 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:
ADD_DEFINITIONS(/wd4244 /wd4305 /wd4800)
# 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)
Personal tools