[build2] Help with build2 project with subdirectories

Matheus D duarm0 at disroot.org
Sat Aug 19 21:43:18 UTC 2023


On 23/08/19 05:51PM, Matheus D wrote:
> Hello, thanks for working in build2!
> 
> I have the following hierarchy, with irrelevant parts pruned
> 
> .
> ├── build/
> │   ├── ...
> ├── buildfile
> ├── manifest
> ├── README.md
> ├── repositories.manifest
> └── sakyra/
>     ├── ds/
>     │   ├── list.c
>     │   ├── list.h
>     ├── external/
>     │   ├── miniaudio/
>     │   │   ├── miniaudio.h
>     │   ├── VulkanMemoryAllocator/
>     │   │   ├── vk_mem_alloc.h
>     │   ├── buildfile
>     │   ├── json.h
>     │   ├── stb_rect_pack.h
>     │   ├── stb_truetype.h
>     │   ├── stb_vorbis.h
>     ├── extras/
>     │   ├── audio.c
>     │   ├── audio.h
>     ├── buildfile
>     ├── engine.c
>     ├── engine.h
>     ├── export.h
>     ├── file.c
>     ├── file.h
>     └── version.h.in
> 
> From my understading, the simple
> 
> `
> lib{sakyra}: {hxx cxx}{**}
> `
> 
> should be able to handle this, quoting the docs
> 
> `
> In more complex projects it is often convenient to organize source code into subdirectories. To handle such projects we can use the recursive wildcard:
> 
> exe{hello}: {hxx cxx}{**}
> `
> 
> But it doesn't work, I'm getting 
> 
> `
> error: header stb_rect_pack.h not found and no rule to generate it
>   info: failure deferred to compiler diagnostics
>   info: re-run with --verbose=4 for more information
>   info: while extracting header dependencies from sakyra/extras/c{text}@../sakyra-clang/sakyra/sakyra/extras/
>   info: while applying rule c.compile to update ../sakyra-clang/sakyra/sakyra/extras/objs{text}
>   info: while applying rule c.link to update ../sakyra-clang/sakyra/sakyra/libs{sakyra}
>   info: while applying rule bin.lib to update ../sakyra-clang/sakyra/sakyra/lib{sakyra}
>   info: while applying rule build.alias to update ../sakyra-clang/sakyra/dir{sakyra/}
>   info: while applying rule build.alias to update ../sakyra-clang/dir{sakyra/}
> `
> 
> one error for each file inside those sub directories. On my Makefile, I simply do
> -I./sakyra/external/, and copy the tree as is (without the c files).
> 
> How to solve this, and why it doesn't work?

Small correction, I have a c project

so I used the {h c} instead of {hxx cxx}, I just missed that when copy
and pasting
`
lib{sakyra}: {h c}{**}
`

There's no `buildfile` on external/ too, I just added that to workaround
the problem and forgot to remove when asking for help, from my
understanding, it's not needed



More information about the users mailing list