[build2] Working with multiple projects locally

Boris Kolpackov boris at codesynthesis.com
Fri Apr 26 14:58:41 UTC 2019


Per Edin <per.edin at sequence-point.se> writes:

> I'm currently working on 4 related, but separate projects and tried
> the following approach:
> 
> $ b create: build-default/,cc config.cxx=clang++
> 
> $ b configure: libone/@build-default/libone/
> $ b configure: libtwo/@build-default/libtwo/
> $ b configure: libthree/@build-default/libthree/
> $ b configure: my-app/@build-default/my-app/
> 
> $ b build-default/
> 
> (my-app depends on libthree, which in turn depends on libone and
> libtwo.) This all worked fine, no need to mess with config.import.*,
> "depends: " in manifest files, etc. I imported libthree%lib{three} in
> my-app and it just worked.

Yep, that's the "all I want is a build system" workflow and we still
use it ourselves quite often. ;-)


> Then one day I needed to add dependencies to libthree and my-app (from
> cppget) and I got stuck. I tried to use bdep instead:
> 
> $ rm -rf build-default/libthree/
> $ cd libthree/
> $ vi manifest # add depends: libssl
> $ vi repositories.manifest # enable cppget
> $ bdep config create ../build-default/libthree/
> $ cd ..
> $ b build-default/
> error: build-default/libthree/ cannot be amalgamated

For this to work you will first need to convert your "build system 
only" build configuration to a bpkg build configuration. There should
be an option to do it from an existing configuration but it's not
there yet. So you will need to re-create build-default/:

$ rm -r build-default/
$ bpkg create -d build-default/ cc config.cxx=clang++

$ b configure: libone/@build-default/libone/
$ ...
$ b build-default/

Now you should be able to switch to bdep:

$ rm -rf build-default/libthree/
$ cd libthree/
$ vi manifest # add depends: libssl
$ vi repositories.manifest # enable cppget
$ bdep init -A ../build-default/ @clang



More information about the users mailing list