|
Lite³
A JSON-Compatible Zero-Copy Serialization Format
|
| Command | Description |
|---|---|
make all | Build the static library with -O2 optimizations (default) |
make tests | Build and run all tests (use VERBOSE=1 for stdout output) |
make examples | Build all examples |
make install | Install library in /usr/local (for pkg-config) |
make uninstall | Uninstall library |
make clean | Remove all build artifacts |
make help | Show this help message |
A gcc or clang compiler is required due to the use of various builtins.
First clone the repository:
Then choose between installation via pkg-config or manual linking.
Inside the project root, run:
This will build the static library, then install it to /usr/local and refresh the pkg-config cache. If installation was successful, you should be able to check the library version like so:
You can now compile using these flags:
For example, to compile a single file main.c:
First build the library inside project root:
Then in your main program:
build/liblite3.ainclude/lite3.h + include/lite3_context_api.hFor example, to compile a single file main.c:
The Buffer API provides the most control, utilizing caller-supplied buffers to support environments with custom allocation patterns, avoiding the use of malloc().
The Context API is a wrapper aound the Buffer API where memory allocations are hidden from the user, presenting a more accessible interface. If you are using Lite³ for the first time, it is recommmended to start with the Context API.
There is no need to include both headers, only the API you intend to use.
By default, library error messages are disabled. However it is recommended to enable them to receive feedback during development. To do this, either:
// #define LITE3_ERROR_MESSAGES inside the header file: include/lite3.h-DLITE3_ERROR_MESSAGESIf you installed using pkg-config, you may need to reinstall the library to apply the changes. To do this, run:
Examples can be found in separate directories for each API:
examples/buffer_api/*examples/context_api/*To build the examples, inside the project root run:
To run an example: