[build2] Help with build2 project with subdirectories

Matheus D duarm0 at disroot.org
Mon Aug 21 20:55:45 UTC 2023


On 23/08/21 10:03AM, Boris Kolpackov wrote:
> Matheus D via users <users at build2.org> writes:
> 
> > A more accurate tree
> > 
> > `
> > .
> > ├── build/
> > │   ├── ...
> > ├── buildfile
> > ├── manifest
> > ├── README.md
> > ├── repositories.manifest
> > └── sakyra/
> >     ├── ds/
> >     │   ├── list.c
> >     │   ├── list.h
> >     ├── external/
> >     │   ├── miniaudio/
> >     │   │   ├── miniaudio.h
> >     │   ├── VulkanMemoryAllocator/
> >     │   │   ├── vk_mem_alloc.h
> >     │   ├── json.h
> >     │   ├── stb_rect_pack.h
> >     │   ├── stb_truetype.h
> >     │   ├── stb_vorbis.h
> >     ├── extras/
> >     │   ├── audio.c
> >     │   ├── audio.h
> >     │   ├── text.c
> >     │   ├── text.h
> >     ├── buildfile
> >     ├── engine.c
> >     ├── engine.h
> >     ├── export.h
> >     ├── file.c
> >     ├── file.h
> >     └── version.h.in
> > `
> >
> > error: header stb_rect_pack.h not found and no rule to generate it
> >
> > [...]
> >
> > On my Makefile, I simply do -I./sakyra/external/, and copy the tree
> > as is (without the c files).
> 
> I suspect that's the part that is missing in your buildfile: if the
> way you include headers assumes presence of certain header search
> directories (-I...) then you will need to arrange for that in your
> buildfile, something along these lines:
> 
> c.poptions += "-I$src_base/ds" "-I$src_base/external" ...

$src_base/external worked, thanks, I didn't know about the $src_base, there's $src_root, which
is set to "src_root = /home/USER/work/sakyra-build2/sakyra/", so
shouldn't
"-I$src_root" work? I include each header as "#include
<sakyra/external/stb_rect_pack.h>", looking at --dump, both $src_base and $src_root are the same, and the full path made me thing it would work regardless of the configuration.



More information about the users mailing list