Skip to content

Adding CPP Terminal to your ptoject

Damon Leven edited this page Nov 26, 2021 · 3 revisions

CPP-Terminal is using CMake as it's build system and can therefore be integrated out of the box into projects that are using CMake as their build system as well. On this page, you will find detailed steps on how to add CPP-Terminal into your project and keep it up to date.

CPP-Terminal switched in late 2021 from only header files to a full CMake powered library. The library now consists of header files for specific purposes with separate source files. Using source files keeps the included code to a minimum and fixes clashes between included libraries in your project and cpp-terminal (which happened a lot due to the windows header used for native windows functionality).

Using CMake with git sub modules (recommended)

This section explains how you can use git to automatically download CPP-Terminal, pin it's version to avoid breakage due to updated versions of the library and use CMake to easily build and setup CPP-Terminal to use it.

The basic overview is:

  1. Check if CPP-Terminal is locally installed and dynamic link that version (optional)
  2. If it's not locally installed, make the git sub module ready
  3. use the sub module

add the cpp-terminal repository to your project

NOTE: This requires your project to be inside of an existing git repository. Refer to the next option for a git independent approach.

In this step, you are adding CPP-Terminal as sub module to your git repository.

git submodule add https://github.com/jupyter-xeus/cpp-terminal

This will clone CPP-Terminal into your repository and creates the submodule configuration files needed by git.

NOTE: Use git submodule --help to show all available options. NOTE: We recommend to setup dependabot or renovate in order to keep CPP-Terminal up to date.

configure CMake to use the locally installed version of CPP-Terminal first (recommended)

In this step, we will configure CMake to use the locally installed version of CPP-Terminal if it exists.

To make this guide as easy as possible, we have created a function for CMake to set it up:

// TODO

configure CMake to just use the git sub module

Nor using the locally installed version can be preferred, if you don't want users or packagers to be able to dynamically link cpp-terminal. This is not recommended, but might be preferable in some use cases.

// TODO

Using CMake alone

This method uses CMake to download the GitHub repository of CPP-Terminal and set it up. Only using CMake makes the Project more portable between different development environments and version controls, but requires you to manually maintain the used version of the library, instead of letting it being handled by automation.

NOTE: Not updating CPP-Terminal over a long period of time is highly dangerous and not recommended. Please keep your dependencies up to date.

// TODO

Manually Copying the files over

This Method is the by far most complicated option and requires you to copy the files over and add them to your build system. This should only be done, if your project is not using CMake, or if you know what you are doing.

NOTE: Not updating CPP-Terminal over a long period of time is highly dangerous and not recommended. Please keep your dependencies up to date.

Other build systems

You are using another build system in your project? Feel free to add a small how-to to this list. Your contribution is really appreciated and welcome!

Clone this wiki locally