Installation#

Installing UNIT#

UNIT can be installed via Git and CMake:

bash#
1git clone https://github.com/ZeroIntensity/unit && cd unit
2cmake -B build -DCMAKE_BUILD_TYPE=Release
3cmake --build build
4sudo cmake --install build

This installs the library and headers to your system’s default prefix (on Linux, this is /usr/local). To install elsewhere, pass the CMAKE_INSTALL_PREFIX setting:

bash#
1cmake -B build -DCMAKE_BUILD_TYPE=Release -DCMAKE_INSTALL_PREFIX=$HOME/.local
2cmake --build build
3cmake --install build

Python bindings#

If you plan on using the Python bindings, you can install the unit-compiler package from PyPI. UNIT is under heavy development, so it is recommended that you install the development package:

bash#
pip install --pre -i https://test.pypi.org/simple/ unit-compiler

Alternatively, if you cloned UNIT and built from source, you can simply install from the root directory:

bash#
cd unit
pip install .

Using UNIT in your project#

CMakeLists.txt#
find_package(unit REQUIRED)
target_link_libraries(my_program PRIVATE unit::unit)