Benn Bollay wrote:
>
> Hi all –
>
>
>
> I have a single project that spans multiple
directories. I’d like either:
>
> a) all the source files in all the
specified directories
> are compiled into a single executable OR
>
For this case, you can do:
exe single : [ glob dir1/*.c* ] [ glob dir2/*.c* ] [ glob
dir3/*.c* ] ;
> b) as each lib is created for each
directory, it uses
> compilation options specified at a single location.
>
For this, you can put a "use-project /name :
path/to/lib/dir ;" in your
Jamroot where "/name" is the unique name you want
to refer to the
library using and "path/to/lib/dir" is the path
(relative to Jamroot's
directory) to the directory containing the Jamfile.v2 for
compiling that
library. You can then use "/name" in your exe and
lib sources to get
the usage requirements and cause it to be linked in.
Jamroot (in /project/src, e.g.):
use-project /a : libs/a ;
use-project /b : libs/b ;
Jamfile.v2 in /project/src/libs/a:
lib a : [ glob *.c* ] # sources
: <define>A_DEFINE_INT # build requirements
(always used)
: # default build settings (used if not overridden
by some other
build requirement)
: <include>. <define>A_DEFINE_EXT #
usage requirements
;
Jamfile.v2 in /project/src/libs/b:
lib b : [ glob *.c* ] /a
:
:
: <include>.
;
Jamfile.v2 in /project/src/progs/foo:
exe foo : [ glob *.c* ] /b ;
So, in the above example, A_DEFINE_INT will be defined while
compiling
"a" ("-DA_DEFINE_INT" would be passed to
the compiler, e.g.). The
"<include>. <define>A_DEFINE_EXT" will
be used in the build for anything
that refers to "a" in its sources as in
"b".
When the <include> feature is converted to the
command-line parameters
for "b", it figures out the relative path and
passes "-I../a" to the
compiler for "b". It will also pass
"-DA_DEFINE_EXT" for compiling "b".
The "foo" exe will get something like
"-DA_DEFINE_EXT -I../../lib/a
-I../../lib/b" on its command-line as well as link
against the compiled
"a" and "b" libs.
As for the compilation options, I'd need more information to
answer that
question, but you can do something like this in your
Jamroot:
project proj
: requirements <define>SOMETHING # this will
get added to all builds
: build-dir ../build # will cause everything to be
built into a
sub-directory of /project/build
;
> I’ve been trying various things using alias’s and
projects, but it
> just hasn’t panned out. The examples available are
pretty weak in the
> “multi-directory” department, sadly, so once I
identify the correct
> path, I will definitely contribute an example.
>
>
>
> Suggestions?
>
>
>
> Cheers,
>
> --Benn
>
Hope this helps.
Phillip
_______________________________________________
Unsubscribe & other changes: http://lists.boost.org/mailman/listinfo.cgi/boost-build
a>
|