Getting Started 🔗
Unicorn is a lightweight, embeddable implementation of common Unicode® algorithms written in C99. The easiest way to integrate Unicorn into your project is to consume it as an amalgamation. The amalgamation is a pair of header and source files that you can compile with your project. Alternatively, you can consume Unicorn the “traditional” way by compiling it as a library and linking it with your application.
To consume Unicorn as an amalgamation, you can either (1) use a prebuilt amalgamation or (2) build the amalgamation yourself. To use the prebuilt amalgamation, download the archive with amalgamation in its name from the downloads page, extract unicorn.c
and unicorn.h
from it, and compile them with your project. While the amalgamation is easy to consume, the downside of using it is it's built with all features of the library including features you might not need. To customize which features the amalgamation has, you must build it yourself.
Building from Source 🔗
To build Unicorn either as a traditional library or an amalgamation requires a C99 compiler and Python 3.6 or newer.
To customize which features Unicorn is built with, edit the features.json
file. The schema for this file is defined in the Feature Customization guide.
Building an Amalgamation 🔗
To generate your own amalgamation, download the archive release without the word “amalgamation” in its name, extract it, and from your shell run:
$ ./amalgamate.pyz
This will generate the files unicorn.c
and unicorn.h
in the same directory. You can then compile these files with your project.
Building a Library 🔗
To consume Unicorn as a traditional static or dynamic library, build it with
$ ./configure
$ make
$ make install
or build with CMake
$ cmake -B build
$ cmake --build build
$ cmake --install build