How to reference Boost header include path from outside the Boost tree?

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
10 messages Options
Reply | Threaded
Open this post in threaded view
|

How to reference Boost header include path from outside the Boost tree?

John Maddock
I'm trying to build some simple demos with bbv2, but the Boost headers
aren't automatically placed in the include path, even when using:

run myfile ; # Doesn't find Boost headers!

So then I tried adding <include>$(BOOST_ROOT) but that doesn't work either -
apparently BOOST_ROOT isn't set by bbv2 if it's not set by the user.

So.... how do I find the Boost header path?

Or how about something like:

using boost ;

which would just do the right thing?

Many thanks,

John.

_______________________________________________
Unsubscribe & other changes: http://lists.boost.org/mailman/listinfo.cgi/boost-build
Reply | Threaded
Open this post in threaded view
|

Re: How to reference Boost header include path from outside the Boost tree?

Vladimir Prus
On Thursday 30 March 2006 18:36, John Maddock wrote:

> I'm trying to build some simple demos with bbv2, but the Boost headers
> aren't automatically placed in the include path, even when using:
>
> run myfile ; # Doesn't find Boost headers!
>
> So then I tried adding <include>$(BOOST_ROOT) but that doesn't work either
> - apparently BOOST_ROOT isn't set by bbv2 if it's not set by the user.
>
> So.... how do I find the Boost header path?
>
> Or how about something like:
>
> using boost ;
>
> which would just do the right thing?

You should using something like this:

  projec yours :
     requirements <use>path_to_boost//headers ;

  run myfile ;

Or you can have:

  run myfile path_to_boost//headers ;


This is not fully covered in docs, I'll try to update

http://www.boost.org/boost-build2/doc/html/bbv2/faq/header-only-libraries.html

with information about *using* header-only libraries, as opposed to declaring
them.

Thanks,
Volodya

--
Vladimir Prus
http://vladimir_prus.blogspot.com
Boost.Build V2: http://boost.org/boost-build2

_______________________________________________
Unsubscribe & other changes: http://lists.boost.org/mailman/listinfo.cgi/boost-build
Reply | Threaded
Open this post in threaded view
|

Re: How to reference Boost header include path from outside the Boost tree?

David Abrahams
In reply to this post by John Maddock
"John Maddock" <[hidden email]> writes:

> I'm trying to build some simple demos with bbv2, but the Boost headers
> aren't automatically placed in the include path, even when using:
>
> run myfile ; # Doesn't find Boost headers!
>
> So then I tried adding <include>$(BOOST_ROOT) but that doesn't work either -
> apparently BOOST_ROOT isn't set by bbv2 if it's not set by the user.
>
> So.... how do I find the Boost header path?
>
> Or how about something like:
>
> using boost ;
>
> which would just do the right thing?

You need to put

    /boost//headers

in your list of sources.

--
Dave Abrahams
Boost Consulting
www.boost-consulting.com

_______________________________________________
Unsubscribe & other changes: http://lists.boost.org/mailman/listinfo.cgi/boost-build
Reply | Threaded
Open this post in threaded view
|

Re: How to reference Boost header include path fromoutside the Boost tree?

John Maddock
In reply to this post by Vladimir Prus
> You should using something like this:
>
>  projec yours :
>     requirements <use>path_to_boost//headers ;
>
>  run myfile ;
>
> Or you can have:
>
>  run myfile path_to_boost//headers ;
>
>
> This is not fully covered in docs, I'll try to update
>
> http://www.boost.org/boost-build2/doc/html/bbv2/faq/header-only-libraries.html
>
> with information about *using* header-only libraries, as opposed to
> declaring them.

What advantage does that have over just <include>path-to-boost ?

In any case it completely misses the point: I know where Boost is on my
machine, I don't know where it is on someone elses machine (who may be
running my examples).  bjam on the other hand *does* know where boost is,
because it's located the build system.  It's that information I want to pull
out.

John.

_______________________________________________
Unsubscribe & other changes: http://lists.boost.org/mailman/listinfo.cgi/boost-build
Reply | Threaded
Open this post in threaded view
|

Re: How to reference Boost header include path fromoutside the Boost tree?

Phillip Seaver
John Maddock wrote:

>> You should using something like this:
>>
>>  projec yours :
>>     requirements <use>path_to_boost//headers ;
>>
>>  run myfile ;
>>
>> Or you can have:
>>
>>  run myfile path_to_boost//headers ;
>>
>>
>> This is not fully covered in docs, I'll try to update
>>
>> http://www.boost.org/boost-build2/doc/html/bbv2/faq/header-only-libraries.html
>>
>> with information about *using* header-only libraries, as opposed to
>> declaring them.
>>    
>
> What advantage does that have over just <include>path-to-boost ?
>
> In any case it completely misses the point: I know where Boost is on my
> machine, I don't know where it is on someone elses machine (who may be
> running my examples).  bjam on the other hand *does* know where boost is,
> because it's located the build system.  It's that information I want to pull
> out.
>
> John.
>  
The advantage is that you get the other usage requirements.  In the
version I have, boost//headers has "<include>.
<define>BOOST_ALL_NO_LIB=1" in its usage requirements.  So, that will
add BOOST_ALL_NO_LIB=1 to the list of defines for your compiles in
addition to giving you the include directory.  That's one of the major
advantages of boost-build for me:  the project sets usage requirements
so that all the project users don't have to.

As David said, you should use "/boost//headers".  The other user may
have to do "use-project /boost : path_to_boost ;", depending on their setup.

On my system, I use the 1.33.1 distribution of boost, but I use the
latest boost-build out of CVS in a separate directory.  So, knowing
where boost-build is wouldn't help you find boost at all.

Phillip

_______________________________________________
Unsubscribe & other changes: http://lists.boost.org/mailman/listinfo.cgi/boost-build
Reply | Threaded
Open this post in threaded view
|

Re: How to reference Boost header include path fromoutside the Boost tree?

John Maddock
> The advantage is that you get the other usage requirements.  In the
> version I have, boost//headers has "<include>.
> <define>BOOST_ALL_NO_LIB=1" in its usage requirements.  So, that will
> add BOOST_ALL_NO_LIB=1 to the list of defines for your compiles in
> addition to giving you the include directory.  That's one of the major
> advantages of boost-build for me:  the project sets usage requirements
> so that all the project users don't have to.
>
> As David said, you should use "/boost//headers".  The other user may
> have to do "use-project /boost : path_to_boost ;", depending on their
> setup.

That would include me as well, without the use-project I get an error from
bjam.  It still means hardcoding the path-to-boost though which is what I am
trying to avoid.

A couple of asides:

1) I don't see this mentioned in the docs - or at least a quick grep didn't
find it.  How about a "Refering to Boost and other bjam.v2 based projects"
section ?
2) I'm still not convinced that defining BOOST_ALL_NO_LIB globally is a good
idea, it just masks any bugs/incompatibilities between bbv2's name mangling
and what auto-linking expects, but <shrug> whatever.

Thanks, John.

_______________________________________________
Unsubscribe & other changes: http://lists.boost.org/mailman/listinfo.cgi/boost-build
Reply | Threaded
Open this post in threaded view
|

Re: How to reference Boost header include path fromoutside the Boost tree?

João Abecasis-2
In reply to this post by John Maddock
John Maddock wrote:
> In any case it completely misses the point: I know where Boost is on my
> machine, I don't know where it is on someone elses machine (who may be
> running my examples).  bjam on the other hand *does* know where boost is,
> because it's located the build system.  It's that information I want to pull
> out.

Well, theoretically at least, the build-system could be located outside
the boost hierarchy and know nothing about it. So I usually have my
jamfiles check for the BOOST_ROOT variable first and then, if that
fails, I try find boost from BOOST_BUILD_PATH assuming a default boost
installation.

I believe, the attached file, which I am currently using in my local
Phoenix-V2 copy, has all the logic you need. Once you have the
boost-root variable determined, you may use it as (incorporating other's
suggestions)

     project yours :
         requirements <include>$(boost-root) ;

or

     project yours :
         requirements <use>$(boost-root)//headers ;

or still

     run myfile $(boost)//headers ;

HTH,


João


_______________________________________________
Unsubscribe & other changes: http://lists.boost.org/mailman/listinfo.cgi/boost-build

project-root.jam (1K) Download Attachment
Reply | Threaded
Open this post in threaded view
|

Re: How to reference Boost header include path fromoutside the Boost tree?

Phillip Seaver
In reply to this post by John Maddock
John Maddock wrote:

>> The advantage is that you get the other usage requirements.  In the
>> version I have, boost//headers has "<include>.
>> <define>BOOST_ALL_NO_LIB=1" in its usage requirements.  So, that will
>> add BOOST_ALL_NO_LIB=1 to the list of defines for your compiles in
>> addition to giving you the include directory.  That's one of the major
>> advantages of boost-build for me:  the project sets usage requirements
>> so that all the project users don't have to.
>>
>> As David said, you should use "/boost//headers".  The other user may
>> have to do "use-project /boost : path_to_boost ;", depending on their
>> setup.
>>    
>
> That would include me as well, without the use-project I get an error from
> bjam.  It still means hardcoding the path-to-boost though which is what I am
> trying to avoid.
>  
You don't have to do use-project in your jamfile, though.  Mine is in
Jamroot.

So, the user could put use-project in their root with the hard-coded
path to boost (which is what I do -- it's relative to the Jamroot
location).  Or they could use an environment variable and do something
like "use-project /boost : [ modules.peek : BOOST_PATH ] ;" (after
setting the BOOST_PATH environment variable to point to their boost).  I
suspect there's a way to do it with site-config.jam or user-config.jam,
but I haven't played with those much.
> A couple of asides:
>
> 1) I don't see this mentioned in the docs - or at least a quick grep didn't
> find it.  How about a "Refering to Boost and other bjam.v2 based projects"
> section ?
> 2) I'm still not convinced that defining BOOST_ALL_NO_LIB globally is a good
> idea, it just masks any bugs/incompatibilities between bbv2's name mangling
> and what auto-linking expects, but <shrug> whatever.
>  

And if they change it later, you'll get that change without having to do
anything.  :->

Phillip

_______________________________________________
Unsubscribe & other changes: http://lists.boost.org/mailman/listinfo.cgi/boost-build
Reply | Threaded
Open this post in threaded view
|

Re: How to reference Boost header include path fromoutside the Boost tree?

Vladimir Prus
In reply to this post by John Maddock
On Thursday 30 March 2006 20:34, John Maddock wrote:

> > with information about *using* header-only libraries, as opposed to
> > declaring them.
>
> What advantage does that have over just <include>path-to-boost ?
>
> In any case it completely misses the point: I know where Boost is on my
> machine, I don't know where it is on someone elses machine (who may be
> running my examples).  bjam on the other hand *does* know where boost is,
> because it's located the build system.  It's that information I want to
> pull out.

So, you want Boost.Build to get Boost root directory based on the path where
Boost.Build itself is found.

That can be made to work, but:

1. It will break if your users happen to use system-wide Boost.Build. FWIW,
there's already Boost.Build package for Debian, and users might install it
from source themselfs too.

2. This will work only for Boost, but not for any third-party libraries.

The general solution seems to either set some environment variable what will
be read by Jamroot, or hardcode paths in Jamroot and modify Jamroot when you
move the source to a different machine.

- Volodya

--
Vladimir Prus
http://vladimir_prus.blogspot.com
Boost.Build V2: http://boost.org/boost-build2
_______________________________________________
Unsubscribe & other changes: http://lists.boost.org/mailman/listinfo.cgi/boost-build
Reply | Threaded
Open this post in threaded view
|

Re: How to reference Boost header include path fromoutside the Boost tree?

John Maddock
In reply to this post by João Abecasis-2
>> I believe, the attached file, which I am currently using in my local
>> Phoenix-V2 copy, has all the logic you need. Once you have the
>> boost-root variable determined, you may use it as (incorporating
>> other's suggestions)

Thankyou!!!  That was exactly what I was looking for, much appreciated,  

John.
_______________________________________________
Unsubscribe & other changes: http://lists.boost.org/mailman/listinfo.cgi/boost-build