Adding 3rd party lib

When to add a library

Adding a new third party library to VisIt takes a bit of work. If it is possible to avoid adding a new library (for example by making the library's source code part of the VisIt source code), then that option should be considered.

How to add a library

Here's an overview of how to add a new third party library. There are several aspects:

  • Setting up CMake
  • Setting up build_visit
  • Conditional dependency for database plugins

CMake

The library should be added to CMake via /path/to/visit/src/CMakeLists.txt.

If you build a find file for cmake, it should go in: /path/to/visit/src/CMake/Find<your lib>.cmake

and is called from /path/to/visit/src/CMakeLists.txt.

A few more hints

In /path/to/visit/src/CMakeLists.txt, define:

VISIT_3RDPARTY_VAR(NAME_DIR "Description (ex: Path to NAME library)")

This will support use of "VISIT_NAME_DIR" from the command line and config-site files.

Also add, the following to include your CMake commands for the new lib:

INCLUDE(${VISIT_SOURCE_DIR}/CMake/FindName.cmake)


For CMake/FindName.cmake, if you just need to detect header locations and a few libs:

INCLUDE(${VISIT_SOURCE_DIR}/CMake/SetUpThirdParty.cmake)
IF (WIN32)
  SET_UP_THIRD_PARTY(NAME [library directory name]/${VISIT_MSVC_VERSION} [include directory name] [library name a] [library name b] ...)
ELSE (WIN32)
  SET_UP_THIRD_PARTY(NAME [library directory name] [include directory name] [library name a] [library name b] ...)
ENDIF (WIN32)

This will take care of setting:

NAME_INCLUDE_DIR
NAME_LIBRARY_DIR
NAME_LIB
NAME_FOUND

And set the install targets for the libraries.

build_visit

If build_visit is not able to build your third party library, then it is very unlikely that anyone else will build the library to compile it into VisIt. This includes the binaries that are distributed on the web.

Each new library in build_visit touches multiple parts of the script:

  1. The user interface (curses, command line flags, and help)
  2. A new function to build the library
  3. Control to call that function.

Database plugins

If your new library is for a database, you probably want the compilation of the database plugins to be dependent on whether or not the third party library is built. To do this add a section to /path/to/src/databases/CMakeLists.txt. THIRDPARTY_DEPENDENT_PLUGINS(YOUR-LIB-ENV-NAME-IN-CMAKE PLUGINS-THAT-DEPEND-ON-THIS-LIB) Example: THIRDPARTY_DEPENDENT_PLUGINS(EXODUSII Exodus TimeVaryingExodus) Will add the plugins Exodus and TimeVaryingExodus if EXODUSII is defined.

Add this line with the other THIRDPARTY_DEPENDENT_PLUGINS definitions.