Installation¶
Installing UNIT¶
UNIT can be installed via Git and CMake:
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:
1cmake -B build -DCMAKE_BUILD_TYPE=Release -DCMAKE_INSTALL_PREFIX=$HOME/.local
2cmake --build build
3cmake --install build
Python bindings¶
Alternatively, if you plan on using the Python bindings without the C API or C++ API, you can solely install that using your preferred package manager:
Using UNIT in your project¶
find_package(unit REQUIRED)
target_link_libraries(my_program PRIVATE unit::unit)
unit_dep = dependency('unit')
executable('my_program', 'main.c', dependencies: unit_dep)
gcc -o my_program main.c $(pkg-config --cflags --libs unit)
CFLAGS := $(shell pkg-config --cflags unit)
LDFLAGS := $(shell pkg-config --libs unit)
gcc -o my_program main.c -lunit
cl /I path\to\unit\include main.c /link path\to\unit\lib\unit.lib