|
List Info
Thread: a few bjam questions (local/global , alias, and 'stage')
|
|
| a few bjam questions (local/global
<define>, alias, <os> and
'stage') |
  Netherlands |
2007-09-02 07:30:44 |
|
Hi All,
I have a few bjam questions - if anyone could give me some pointers,
that would be very much appriciated ...
1) local/global define
lib my_odbc
: [ obj a : a.cpp ]
[ obj b : b.cpp ]
:<define>ODBC
;
the define is not local so it is not used when compiling, I dont like
having to set the define on both objs - is it possible to set it once?
2) alias
I have 2 targets that are 90% alike, the only difference is they link
to 1 different library. Now I specify 2 targets which are basically
copies. Is it possible to define a general target once and specialize
it for the actual case:
exe base : main.cpp lib-general ;
alias exe-a : base lib-a ;
alias exe-b : base lib-b ;
At the moment base is compiled/linked, this fails because some of the
symbols is in either lib_a or lib_b
3) os detection
The property <os>NT is defined, this is the only value allowed.
However, I'd like
exe my_exe : main.cpp : <os>NT <define>GREAT ;
exe my_exe : main.cpp : <os>LINUX <define>BETTER ;
Can I do this?
4) stage rename
I could'nt find this one:
stage deliver : exe_a : <location>a <rename>base ;
In other words, I'd like to give a name to an install target on
installation.
Regards, Dirk Griffioen
--
CodeShop BV
Wenckebachweg 150-B
1096 AB Amsterdam
www.code-shop.com
+31 6 411 92 024
|
| Re: a few bjam questions (local/global
<define>, alias, <os> and
'stage') |

|
2007-09-04 12:53:55 |
Dirk Griffioen wrote, on 9/2/2007 8:30 AM:
> Hi All,
>
> I have a few bjam questions - if anyone could give me
some pointers,
> that would be very much appriciated ...
You should mention which version you're using. That may
change the
answer to some questions.
> *1) local/global define*
>
> lib my_odbc
> : [ obj a : a.cpp ]
> [ obj b : b.cpp ]
> :<define>ODBC
> ;
>
> the define is not local so it is not used when
compiling, I dont like
> having to set the define on both objs - is it possible
to set it once?
Well, first off, it's not clear from your example why you're
doing that
instead of this:
lib my_odbc : a.cpp b.cpp : <define>ODBC ;
It would behave the way you want that example to. That
aside, there are
a couple of options for this (that I know of). You can use
a "project"
target in that file like this:
project my_odbc : requirements <define>ODBC ;
That would affect all targets in that jamfile and any
jamfiles mentioned
via "use-project" (and maybe
"build-project"?). Possibly also any
jamfiles in sub-directories of that one.
Another way to do it would be with local variables:
local defs = <define>ODBC ;
lib my_odbc : [ obj a : a.cpp : $(defs) ] [ obj b :
b.cpp : $(defs)
] : $(defs) ;
The idea for the inline "obj" target is that you
want to compile one
object differently than the other source files. I think
they
intentionally do not take build requirements from the
"lib" target,
since they don't know what it is that you want to be
different.
> *2) alias*
>
> I have 2 targets that are 90% alike, the only
difference is they link
> to 1 different library. Now I specify 2 targets which
are basically
> copies. Is it possible to define a general target once
and specialize
> it for the actual case:
>
> exe base : main.cpp lib-general ;
>
> alias exe-a : base lib-a ;
> alias exe-b : base lib-b ;
>
> At the moment base is compiled/linked, this fails
because some of the
> symbols is in either lib_a or lib_b
I don't believe you can do that. You should be able to do a
library
that contains all the common sources and use it, though. I
assume that
the reason you want to do it like that is that there are
more sources
(or libs) and/or requirements that you don't want to
repeat.
lib exe-base : main.cpp lib-general ;
exe exe-a : exe-base lib-a ;
exe exe-b : exe-base lib-b ;
Another way you could do it:
for local name in a b
{
exe exe-$(name) : main.cpp lib-general lib-$(name)
;
}
> *3) os detection*
>
> The property <os>NT is defined, this is the only
value allowed.
> However, I'd like
>
> exe my_exe : main.cpp : <os>NT
<define>GREAT ;
> exe my_exe : main.cpp : <os>LINUX
<define>BETTER ;
>
> Can I do this?
With the version I have, you can, which is why I said you
should tell us
the version you're using. The way you would do it, though,
would be:
exe my_exe : main.cpp : <os>NT:<define>GREAT
<os>LINUX:<define>BETTER ;
Note the colon (":") before the <define> and
that there can't be spaces
around that colon. See
http://boost.org/doc/
html/bbv2/advanced.html#bbv2.advanced.targets.requirements.c
onditional
> *4) stage rename*
>
> I could'nt find this one:
>
> stage deliver : exe_a : <location>a
<rename>base ;
>
> In other words, I'd like to give a name to an install
target on
> installation.
I can't help you with "stage" -- I always use
"install". From my copy
of stage.jam, it looks like you can use
"<name>" to rename it when you
use the "install" target.
Phillip
_______________________________________________
Unsubscribe & other changes: http://lists.boost.org/mailman/listinfo.cgi/boost-build
a>
|
|
| Re: a few bjam questions (local/global
<define>, alias, <os> and
'stage') |
  Netherlands |
2007-09-05 01:22:16 |
|
Hi Phillip,
Thanks for the answers! I made some remarks below. If you have the
time, I'd like to hear your opinion.
Regards, Dirk
apago.com" type="cite">
You should mention which version you're using. That may change the
answer to some questions.
I use bjam 1.14 from boost_1_34
apago.com" type="cite">
Well, first off, it's not clear from your example why you're doing that
instead of this:
That's my fault. The reasoin I would like to do this is that I want 2
libraries from the same source, but with a different define (please
dont ask why). So the first thing I tried was
lib a : a.cpp : <define>X ;
lib b : a.cpp : <define>Y ;
This I cannot do, because bjam complains about have the same source
(this is in the manual as well). So I went for
lib a : [ obj a :a.cpp ] : <define>X ;
lib b : [ obj b : a.cpp ] : <define>Y ;
But now the defines are not passed to the compiler (bjam -n show you
this) - dont know why. If I use the form I posted, it works - but it is
ugly since I have to repeat myself alot
So my question would be: how can I have something of the form, with
more than one object:
lib a : [ obj a :a.cpp ] [ obj b :b.cpp ] : <define>X ;
lib b : [ obj a :a.cpp ] [ obj b :b.cpp ] : <define>Y ;
instead of having to do
lib a : [ obj a :a.cpp : <define>X ] [ obj b :b.cpp :
<define>X ] ;
lib b : [ obj a :a.cpp : <define>Y ] [ obj b :b.cpp :
<define>Y ] ;
apago.com" type="cite">
It would behave the way you want that example to. That aside, there are
a couple of options for this (that I know of). You can use a "project"
target in that file like this:
Thanks for the suggestions! I like the local variable variant
apago.com" type="cite">
*2) alias*
I have 2 targets that are 90% alike, the only difference is they link
to 1 different library. Now I specify 2 targets which are basically
copies. Is it possible to define a general target once and specialize
it for the actual case:
exe base : main.cpp lib-general ;
alias exe-a : base lib-a ;
alias exe-b : base lib-b ;
At the moment base is compiled/linked, this fails because some of the
symbols is in either lib_a or lib_b
I don't believe you can do that. You should be able to do a library
that contains all the common sources and use it, though. I assume that
the reason you want to do it like that is that there are more sources
(or libs) and/or requirements that you don't want to repeat.
lib exe-base : main.cpp lib-general ;
exe exe-a : exe-base lib-a ;
exe exe-b : exe-base lib-b ;
Another way you could do it:
for local name in a b
{
exe exe-$(name) : main.cpp lib-general lib-$(name) ;
}
Thanks! I will look into these suggestions.
apago.com" type="cite">
With the version I have, you can, which is why I said you should tell us
the version you're using. The way you would do it, though, would be:
Sorry - I guess I just forgot. I believe I have the last version:
Boost.Jam Version 3.1.14. OS=NT.
But when I try <os>LINUX, I get a
error: "LINUX" is not a known value of feature <os>
error: legal values: "NT"
Should I get something from svn?
apago.com" type="cite">
*4) stage rename*
I could'nt find this one:
stage deliver : exe_a : <location>a <rename>base ;
In other words, I'd like to give a name to an install target on
installation.
I can't help you with "stage" -- I always use "install". From my copy
of stage.jam, it looks like you can use "<name>" to rename it when you
use the "install" target.
Yep -- I saw that too, but when I tried it, something like
stage sqlserver
: the-exe-for-sqlserver
: <location>$(ROOT)/var/tst/build-w-i386-sqlserver
<install-dependencies>on
<install-type>EXE
<name>my-cool-exe
;
If have the same target 'my-cool-exe' (executable name - which is in
the manual) for several different databases. I would like to have the
buildprocess copying and renaming them properly, instead of a little
script some developer has to run after compiling - we will forget &
get confused.
apago.com" type="cite">
Phillip
_______________________________________________
Unsubscribe & other changes: http://lists.boost.org/mailman/listinfo.cgi/boost-build
--
CodeShop BV
Wenckebachweg 150-B
1096 AB Amsterdam
www.code-shop.com
+31 6 411 92 024
|
[1-3]
|
|