Skip to content

Commit b7f2f5c

Browse files
Support linux-wire source-ingestion for Linux HAL builds
1 parent 8647c6d commit b7f2f5c

3 files changed

Lines changed: 43 additions & 2 deletions

File tree

CMakeLists.txt

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,17 @@ target_include_directories(crumbs
5757
# -----------------------------------------------------------------------------
5858

5959
if(CRUMBS_ENABLE_LINUX_HAL)
60-
find_package(linux_wire CONFIG REQUIRED)
60+
if(NOT TARGET linux_wire::linux_wire)
61+
if(TARGET linux_wire)
62+
add_library(linux_wire::linux_wire INTERFACE IMPORTED)
63+
set_target_properties(linux_wire::linux_wire PROPERTIES
64+
INTERFACE_LINK_LIBRARIES linux_wire
65+
)
66+
else()
67+
find_package(linux_wire CONFIG REQUIRED)
68+
endif()
69+
endif()
70+
6171
target_link_libraries(crumbs PUBLIC linux_wire::linux_wire)
6272
endif()
6373

@@ -211,3 +221,4 @@ install(FILES
211221
"${CMAKE_CURRENT_BINARY_DIR}/crumbsConfigVersion.cmake"
212222
DESTINATION ${config_install_dir}
213223
)
224+

README.md

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -61,7 +61,7 @@ lib_deps = cameronbrooks11/CRUMBS@^0.11.0
6161

6262
**Linux/Native:** CMake build (see [CONTRIBUTING.md](CONTRIBUTING.md))
6363

64-
No external dependencies.
64+
Arduino and PlatformIO builds use the CRUMBS core with no extra dependencies. Linux HAL builds require `linux-wire` for I2C bus access.
6565

6666
## Hardware Requirements
6767

@@ -118,3 +118,4 @@ Details: [platform-setup.md](docs/platform-setup.md)
118118
## License
119119

120120
GPL-3.0 - see [LICENSE](LICENSE) file for details.
121+

docs/platform-setup.md

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -292,6 +292,34 @@ cmake -S . -B build -DCRUMBS_ENABLE_LINUX_HAL=ON \
292292
cmake --build build --parallel
293293
```
294294

295+
#### Long-term CMake Integration Pattern
296+
297+
The canonical CMake dependency contract for Linux HAL consumers is the namespaced target `linux_wire::linux_wire`.
298+
299+
Supported integration modes:
300+
301+
- **Installed package**: `find_package(linux_wire CONFIG REQUIRED)` provides `linux_wire::linux_wire` directly.
302+
- **Sibling source ingestion**: add `linux-wire` before `CRUMBS` in the parent build. If a raw build-tree target named `linux_wire` already exists, `CRUMBS` creates a local bridge target named `linux_wire::linux_wire` and links against that.
303+
304+
This preserves one canonical target name for `CRUMBS` while still supporting active multi-repo development.
305+
306+
Parent-build example:
307+
308+
```cmake
309+
cmake_minimum_required(VERSION 3.13)
310+
project(my_linux_stack C CXX)
311+
312+
set(LINUX_WIRE_BUILD_EXAMPLES OFF CACHE BOOL "" FORCE)
313+
set(CRUMBS_ENABLE_LINUX_HAL ON CACHE BOOL "" FORCE)
314+
set(CRUMBS_BUILD_EXAMPLES OFF CACHE BOOL "" FORCE)
315+
set(CRUMBS_ENABLE_TESTS OFF CACHE BOOL "" FORCE)
316+
317+
add_subdirectory(../linux-wire linux_wire_subbuild)
318+
add_subdirectory(../CRUMBS crumbs_subbuild)
319+
```
320+
321+
Avoid linking exported or installable CRUMBS targets directly to a raw `linux_wire` target. That breaks CMake export generation. The bridge or installed-package path is the stable pattern.
322+
295323
### Install CRUMBS
296324

297325
```bash
@@ -603,3 +631,4 @@ Once your platform is set up and basic communication is working:
603631
- [Protocol Specification](protocol.md) — Wire format and versioning
604632
- [Examples](examples.md) — Working code for all platforms
605633
- [Architecture](architecture.md) — Design decisions and internals
634+

0 commit comments

Comments
 (0)