Setup CamiTK Development Environment on Windows

How to setup CamiTK Development Environment on Windows

This page will guide you to install the development environment required to build CamiTK on Windows 11. After the procedure described in this page, your CamiTK environment will be ready.

Install dependencies and toolchain

Foreword: a warning on PATH

If there are already too much other software installed on your Windows machine, things can get difficult.

You have to be especially careful about the PATH environment variable. Some software will add path to their own installation directory where incompatible version of dependencies (for instance incompatible version Qt, which is a very popular library) will avoid you to setup the CamiTK development environment properly.

Another problem may arise when the PATH environment variable is already quite full. There is a limit to the length of this variable (or more exactly in the tool that modifies the variable value). If this limit is reached, setup the CamiTK development environment might not be done properly.

On Windows 11, it is therefore recommended:

  • if possible, to start from a fresh Windows 11 install (or a machine that does not already zillions of software installed)
  • check the value of the PATH environment variable to make sure:
    • there is no older/other dependency DLL accessible through the path (e.g. older/other version of Qt)
    • its length is not too close to the limit of 1023 characters (setx limit)

Overview

Setting up a development environment requires that all the tool chain and dependencies from scratch should be installed on your machine. This page will guide you during a step-to-step. Each step just need a copy-paste (and wait). The dependencies will be compiled from the source most of the time, as they are not available as pre-compiled/installable packages. This will take a little bit of time, but it is worth the trouble!

Check the support policy document for the currently supported/working version of the dependencies.

Installation step by step

The following installation process is the one we used to setup the CamiTK continuous integration. It should work out of the box, but it is given with no guarantee as there are a multiple of situations that depends on your machine, your machine history and the software already installed on your machine.

It should however work flawlessly and end up with a ready to use development environment.

Note also that the installation of an IDE is cover by the corresponding section below.

In order to simplify everything for you, we recommend that you use chocolatey (a package manager for Windows).

It will help you have a greater control of what is installed on your machine (and where). Everything you install with chocolatey can be easily updated or uninstalled.

We also strongly suggest that you also use chocolatey to install any other available software on your Windows machine. It’s robust and you will get a simple way to update or uninstall the software.

We generated installation scripts that have to be run from a command shell with the admin privilege.

If you already have some of the toolchain or library installed, and you know what you are doing, just check the installation scripts and cherry pick the part you need.

To avoid multiple version of the same tool or lib, we still strongly recommend you start from scratch. The DLL hell is never far away…

Download the setup scripts

Download the installation scripts archive and unzip it.

Open a command shell with elevated privilege

Launch a cmd shell with admin privilege:

  • Click Start (also shown as the circular Windows logo in the Start menu).
  • Type Command Prompt and right-click Command Prompt when it appears in the Start menu. From the resulting context menu, click Run as administrator.

In the cmd shell go to directory where you unzip the installation scripts.

Run the setup scripts

The util-vars.bat contains the default recommended installation directories. It defines the installation path as C:\camitk and the working setup directory as C:\setup.

Each script might take a long time to run (some scripts are downloading package from the internet and others are building dependencies from source code). It might take a while!

The scripts should do everything for you automatically if you run them in the right order (hint: the script names have an index!):

  • setup0-choco.bat installs chocolatey
  • setup1-toolchain.bat setups the environment variables, use chocolatey to install git, curl, 7zip, pedeps, python, visual studio 2022 buildtools, cmake, ninja and finally use aqtinstall to install Qt
  • setup2-builddep.bat downloads, configures, builds and patches all the required dependencies (xercesc, xsdcxx, vtk, gdcm, and itk).

Results

At the end, you may only keep the C:\camitk directory. C:\setup contains all the intermediary files required for the installation (downloaded sources, extracted sources, build directories) and should not be needed afterward.

setup1-toolchain.bat scripts should have configured your environment so that everything is ready for the next step.

Where should I go next?

You can now proceed to build and install CamiTK