Layers 2.0 is archived. The latest version is 3.0. Read the 3.0 docs

Follow these steps to build this version of Layers and use it in your own project.

Build Guide - Layers

Requires CMake 3.22+ and a C++17 compiler.

Step 1 - Clone Layers

Clone Layers from the Codeberg repository:

git clone https://codeberg.org/HuntrSoftware/Layers.git

If you prefer, you can add it as a submodule:

git submodule add https://codeberg.org/HuntrSoftware/Layers.git

Step 2 - Build Layers

From the project root, run the following to build Layers:

cmake -B build -DCMAKE_BUILD_TYPE=Release
cmake --build build

This produces the shared library in lib/ and the LayersResourceCompiler executable in bin/ (debug builds append a d suffix). Tests build by default (-DLAYERS_BUILD_TESTS=OFF to skip; run them with ctest from build/), and the runnable examples are opt-in with -DLAYERS_BUILD_EXAMPLES=ON.

Using Layers in your project

Layers is a standard CMake package: link the Layers::Layers target and include headers as #include <Layers/lcontroller.h>. It requires C++17 and has no external dependencies to install (nlohmann/json is vendored). Pick whichever route fits your project:

As a subdirectory (vendored copy or submodule):

add_subdirectory(ext/Layers)

target_link_libraries(my-app PRIVATE Layers::Layers)

As a subproject, Layers keeps to itself: tests and examples are skipped by default and no output directories are overridden, so your project's layout is untouched.

With FetchContent:

include(FetchContent)
FetchContent_Declare(Layers
    GIT_REPOSITORY https://codeberg.org/HuntrSoftware/Layers.git
    GIT_TAG        2.0.0)   # or the tag/commit you want
FetchContent_MakeAvailable(Layers)

target_link_libraries(my-app PRIVATE Layers::Layers)

As an installed package:

cmake --install build   # from a built Layers checkout
find_package(Layers CONFIG REQUIRED)
target_link_libraries(my-app PRIVATE Layers::Layers)

If your styles should be compiled into your binary, the Layers::LayersResourceCompiler executable target is available from all three routes; see Pattern A of the integration guide for the .lrc build step.

Appearance
Theme
—