The project I'm working on will have multiple subsystems which will be reused by multiple applications. Similar to zephyr/samples and zephyr/subsys, and nrf/samples and nrf/subsys.
I have a west.yml in my repository:
manifest:
remotes:
- name: nordic
url-base: https://github.com/nrfconnect
projects:
- name: sdk-nrf
path: nrf
remote: nordic
revision: v1.5.0
import: true
self:
path: mystuff/foundation
This gives me a nice tree with mystuff and zephyr, ncs, etc, all in one place.
Inside mystuff/foundation I have subsys and samples directories:
mystuff
foundation
CMakeLists.txt
subsys
CMakeLists.txt
base
CMakeLists.txt
src
foo.c
include
foo.h
samples
CMakeLists.txt
hello
CMakeLists.txt
prj.conf
src
main.c
zephyr
...
nrf
...
...
I can build the mystuff/foundation/samples/hello app with an empty main.c. Now I'm trying to figure out how to include and link the subsystem mystuff/foundation/subsys/base (adding #include "foo.h" to main.c). How do zephyr and ncs do this? I see add_subdirectory in all of the levels (and have that in mine as well), but west build doesn't seem to be picking mine up (the include can't be found). How do I tell the build system to find my base subsystem from my hello sample?