Skip to content

LocalRaftLibraries

Rob Dobson edited this page May 3, 2026 · 2 revisions

Local Raft Development Libraries (raftdevlibs)

During the build process, Raft components are normally fetched from GitHub using CMake's FetchContent mechanism. Each component is declared in the RAFT_COMPONENTS list inside the SysType's features.cmake file.

To support local development and debugging of Raft libraries — without pushing changes to GitHub first — the build system checks for a local override folder before attempting any remote fetch.

How It Works

Before fetching a Raft component from its remote GitHub repository, the build system checks whether a directory exists at:

<project-root>/raftdevlibs/<ComponentName>

If that directory is present, the build system uses it in place of the remote source. A clear message is printed during CMake configuration to indicate that the local copy is being used:

============================================================
  LOCAL (DEBUG) LIBRARY: RaftCore
  Using: /path/to/project/raftdevlibs/RaftCore
  (Skipping fetch from https://github.com/robdobsn/RaftCore.git)
============================================================

If the directory does not exist, the component is fetched from GitHub as normal.

Setting Up a Local Override

The fastest way is to let RaftCLI populate the folder for you:

cd <project-root>
raft libs                              # fetch RaftCore + RaftSysMods + RaftI2C + RaftWebServer at main
raft libs --branch v1.44.1             # or pin a specific tag
raft libs --libs RaftI2C               # or fetch just the one you need

Existing checkouts are updated with git fetch --all --tags and the requested branch/tag/commit. Repos with uncommitted changes are skipped unless --force is given. The destination defaults to <project-root>/raftdevlibs/ and can be overridden with --dest.

To set things up manually instead:

  1. Create the raftdevlibs folder at the root of your project (alongside systypes/, main/, etc.):

    <project-root>/
    ├── raftdevlibs/
    │   └── RaftCore/          ← local checkout of the RaftCore repo
    ├── main/
    ├── systypes/
    └── CMakeLists.txt
    
  2. Place your local clone of the component repository inside raftdevlibs/ using the exact component name as the folder name. For example, to override RaftCore:

    cd <project-root>/raftdevlibs
    git clone https://github.com/robdobsn/RaftCore.git
    
  3. Rebuild. CMake will detect the local folder and use it instead of fetching from GitHub.

Notes

  • The folder name inside raftdevlibs/ must exactly match the component name as it appears in RAFT_COMPONENTS (case-sensitive).
  • This works for any component listed in RAFT_COMPONENTS, not just RaftCore.
  • The raftdevlibs folder is a local-only development aid and should normally be added to .gitignore to avoid accidentally committing it.
  • Components resolved from raftdevlibs are treated identically to remotely fetched ones — they are added to EXTRA_COMPONENT_DIRS and included as project dependencies in the same way.

Clone this wiki locally