File: build_test_itk.md

package info (click to toggle)
insighttoolkit5 5.4.4-1
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 704,404 kB
  • sloc: cpp: 783,697; ansic: 628,724; xml: 44,704; fortran: 34,250; python: 22,874; sh: 4,078; pascal: 2,636; lisp: 2,158; makefile: 461; yacc: 328; asm: 205; perl: 203; lex: 146; tcl: 132; javascript: 98; csh: 81
file content (101 lines) | stat: -rw-r--r-- 2,396 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
# Build and test ITK

The [CMake] build system was initially created to support development of ITK; ITK is built following standard CMake practices.

ITK's tests are defined with CTest, and the tests can be executed via `ctest`.

## Pixi

An easy and reproducible way to build and test ITK for development is via [Pixi]. Pixi will provide locally-scoped build tools such as toolchains, `cmake`, `ninja`,  and `python`.

First, install `pixi`,

::::{tab-set}

:::{tab-item} Linux & macOS
```shell
curl -fsSL https://pixi.sh/install.sh | bash
```
:::

:::{tab-item} Windows
`PowerShell`:
```powershell
iwr -useb https://pixi.sh/install.ps1 | iex
```
`winget`:
```
winget install prefix-dev.pixi
```
:::

::::

or use [another pixi installation option].

You might need to restart your terminal or source your shell for the changes to take effect.

ITK's Pixi configuration uses the [conda-forge compiler] and the [Ninja] CMake generator.

### Test C++

To configure, build, and run ITK's C++ tests,

```shell
# Change to the ITK source directory
cd src/ITK

pixi run test
```

### Test Python

To configure, build, and run ITK's Python bindings and run the Python and C++ tests,

```shell
# Change to the ITK source directory
cd src/ITK

pixi run test-python
```

To run a python interpreter with the locally built `itk` Python package:

```shell
pixi run python-exe
```

A Python script can also be passed in, e.g.

```shell
pixi run python-exe ./test.py
```

To run a python interpreter with a locally built `itk` Python package with debug symbols,

```shell
pixi run python-exe-debug
```

### Further testing and development

Additional pixi tasks to run specific steps of the `configure`, `build`, `test` development process or create builds with other [CMake build types] are listed with

```shell
pixi task list
```

To start up a shell environment with all build dependencies:

```shell
pixi shell
```

Once in the pixi shell, `cmake`, `ninja`, `ctest`, etc can be executed in the local `build/` directory containing the build to perform targeted development.

[another pixi installation option]: https://pixi.sh/latest/#installer-script-options
[CMake]: https://cmake.org/
[CMake build types]: https://cmake.org/cmake/help/latest/variable/CMAKE_BUILD_TYPE.html
[conda-forge compiler]: https://anaconda.org/conda-forge/cxx-compiler
[Ninja]: https://ninja-build.org/
[Pixi]: https://pixi.sh/