Building from source

uLib can be built and run on Windows, macOS and Linux. We have successfully deployed it to a wider range of platforms, including tiny microcontrollers, with relatively minor build system setup. It can be compiled either as a static or dynamic library.

Requirements

In order to compile the library, you will need at a minimum:

If you want to generate the documentation, you will also need:

Sphinx is optional as Doxygen will already generate some form of HTML docs, though not as fancy as the ones you are viewing.

Downloading the sources

You can find uLib’s code on its git repository. Begin by cloning it:

git clone https://github.com/IvanoBilenchi/ulib.git

Compiling

The following commands allow you to build uLib:

# Generate the build system
cmake -B cmake-build -DCMAKE_BUILD_TYPE=Release

# [Optional] Edit build settings (library type, optimization options, etc.)
ccmake cmake-build

# Build the library
cmake --build cmake-build --config Release

# [Optional] Install the library and its headers in <install path>
cmake --install cmake-build --prefix <install path>

# [Optional] Build the documentation
cmake --build cmake-build --target ulib-docs

Linking

If you’re using CMake as your build system, you can link against uLib by configuring your CMakeLists.txt file as follows:

# Assuming uLib's source is under "lib/ulib"
add_subdirectory("lib/ulib" EXCLUDE_FROM_ALL)
target_link_libraries(your-target PRIVATE ulib)

For other build systems or if you are building directly through a compiler, please refer to their respective documentations. A relatively headache-free way to integrate uLib involves compiling it and then linking against the built library, making sure the build system or compiler is aware of uLib’s headers.

Examples

For usage examples, refer to the unit tests.