18 Nov 2021

CMake Usage to Create XPand C++ API Modules

Starting with version 2021.2, the use of CMake is required to create solutions that implement the Amira Avizo 3D Pro extension modules with the XPand C ++ API. This video demonstrates what needs to be done to create a solution for MS Visual Studio.

Amira Avizo 3D Pro and PerGeos can be extended with custom modules and IO routines written in C++. XPand is the name of the C++ API. For details, see the  “XPand C++ programmer reference” available from the application Help menu.

The required skills and tools are:

  • C++ language coding
  • A C++ compiler/linker (IDE) (see Amira Avizo 3D System Requirements in the User's Guide)
  • C++ XPand API installed. Available just in Amira Avizo 3D Pro editions and PerGeos.
  • CMake

The client must manually check the "XPand developer files" during the installation procedure. The "XPand binary files for debugging" option must be selected too in order to compile and debug the custom module.

CMake is an open-source, cross-platform family of tools designed to build, test, and package software. CMake is used to control the software compilation process using simple platform and compiler independent configuration files: CMakeLists.txt. It generates native makefiles and workspaces that can be used in the compiler environment of your choice. It must be downloaded from this site: cmake.org where you can find also documentation and a tutorial.

Avizo users create the C++ header and source files for the modules and I/O routines they want to implement. They must also provide the meta-description of the dynamic link library they want to create or modify in terms of composing source files and target link libraries. This can be done by either:

  • Using the Avizo XPand wizard to generate the CMakeLists.txt
  • Editing CMakeLists.txt. (advanced users)

The CMake tool (typically Cmake-gui) is then used to:

  • Configure the build solution (Debug or Release and target compiler)
  • Generate the build solution (actually create the solution files)
  • You can open the build solution directly in your IDE (for example, with MS Visual Studio)

The client finally uses the IDE or compilers/linkers to build the package (dynamic link library) that can be used in the Amira, Avizo and PerGeos applications.

Refer to the AMIRA_LOCAL Setup Tutorial to learn how to configure the application to use XPand custom modules.