Skip to content
Go to file
Cannot retrieve contributors at this time
106 lines (77 sloc) 4.18 KB

Using OpenTissue in your Application

OpenTissue is a header-only library consisting of a collection of many smaller sub-libraries. In your application, you might want to use one of these libraries or several in combination with each other. Very much in the same way as you would use libraries like STL or Boost in an application.

Many of these sub-libraries are self-contained, that is, they do not have explicit third-party dependencies. Thus, in order to use OpenTissue in your application, you need to tell your compiler the location of the OpenTissue include headers which is usually accomplished by passing the flag (Linux, macOS) -I <path-to-opentissue>/ at the command line. On the other hand, if you are using any sub-libraries that have some dependency then your application will have the same dependency. For instance, a substantial subset of the libraries uses Boost, so in these cases, your application will depend on Boost as well.

Minimum requirements

  1. Modern C++ compiler supporting C++11, MSVC 19 and AppleClang 11.
  2. Conan: pip install conan prefers python3.
  3. CMake 3.12

OpenTissue dependency handling with

If you use OpenTissue CMake/Conan based build system generation and dependency resolution. Conan will download all needed dependencies while CMake will use those dependencies to build your applications.

Here is a breakdown of third-party dependencies that OpenTissue currently has:

  • OpenTissue
  • Boost
  • TetGen
  • Triangle
  • Qhull
  • TinyXML
  • DevIL
  • unit_test
  • Same as OpenTissue
  • demos
  • Same as OpenTissue
  • GLUT, GLEW and OpenGL


OpenTissue uses CMake for generating build systems for Linux, macOS, and Windows. This can come handy for OpenTissue used whose projects use CMake already. Being a header-only library, the build system generated by CMake does not build anything (unless you turn on demos or unit tests). Instead, it creates a special target OpenTissue::headers that you can use in your applications.

Set up your workflow by following these simple steps:

  • Download OpenTissue:

    git clone
  • Create a build directory and navigate to it:

    mkdir build && cd build
  • Fetch all dependencies by running Conan:

    conan install <path-to-opentissue-source> -s build_type=Debug -o *:shared=False

    (Note: *:shared=False indicates to conan that we only want static libraries)

  • Run CMake on the same build directory:

    cmake <path-to-opentissue-source>

Using OpenTissue as Third-Party Software

After running CMake on the build directory a new configuration, target, and version files will be created:


These files define OpenTissue's most important variables, settings and exported targets.

The following lines demonstrate how an application can link and use OpenTissue as an external library.

+-- CMakeLists.txt
+-- src
    +-- main.cpp



set(OpenTissue_ROOT "path-to-opentissue-build-dir")

add_executable(MyProject src/main.cpp)

Notice that we set the OpenTissue_ROOT variable to the build directory containing OpenTissueConfig.cmake. This will instruct find_package() to look there in order to search for OpenTissue. Once it finds OpenTissueConfig.cmake it will load it along with OpenTissueTargets.cmake and OpenTissueVersion.cmake. This will automatically bring the OpenTissue::<target> targets which you can then use in your project to resolve OpenTissue dependencies in your application.

The special targets OpenTissue::<target> are interface external targets and they contain references to the OpenTissue headers, flags and possibly other flags that may be needed by your application.

OpenTissue::headers External interface target. Contains references to OpenTissue header directory path, compiler flags and other definitions.
You can’t perform that action at this time.