Need help getting header only libraries to work.

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

Need help getting header only libraries to work.

Eoin boost.build
Hello, I am using Boost.Build v2 to manage pretty much most of my build
environment however I cannot figure out how to get header only libraries
to work. An example of what I’m doing will explain better;

I made a jamfile for TinyXML like this (edited to keep size down);

project TinyXMLSTL

: requirements

<include>./
<define>TIXML_USE_STL
…
…

: usage-requirements

<include>./
<define>TIXML_USE_STL
;

lib "TinyXMLSTL"
:
tinystr.cpp
…
tinyxmlparser.cpp
;

The I use a Jamroot file to create an alias;

use-project /TinyXMLSTL : Libraries/tinyxml ;

And then any project that uses TinyXML simple puts something like the
following in its requirements;

<library>/TinyXMLSTL//TinyXMLSTL/<link>static

The problem is I don’t know what I’m supposed to do for header only
libraries as there is no lib target. I’ve tried many different things  but
the usage-requirements for header only libraries never get included.

Interestingly this page
(http://boost.sourceforge.net/boost-build2/doc/html/bbv2/advanced/jamfiles.html)
 towards the middle gives this example;

lib helpers : helpers.hpp ; # a header-only library
alias helpers : helpers.lib : <toolset>msvc ; # except on msvc

However whenever I tried creating a lib target with only header files I
get this error;
G:/Dev/Libraries/Boost/boost_1_33_1/tools/build/v2/build\targets.jam:1245:
 in construct from module object(typed-target)@5
error: unable to construct [library name here]

The CVS boost doesn’t help solve the problem. As a work around I created
an empty dummy.cpp file and used it in the target lib sources. It works,
but its crude.

Sorry for the long email,
Kind regards, Eoin.

_______________________________________________
Boost-build mailing list
[hidden email]
http://lists.boost.org/mailman/listinfo.cgi/boost-build
Reply | Threaded
Open this post in threaded view
|

Re: Need help getting header only libraries to work.

Vladimir Prus
On Saturday 14 January 2006 04:46, [hidden email] wrote:

> <library>/TinyXMLSTL//TinyXMLSTL/<link>static
>
> The problem is I don’t know what I’m supposed to do for header only
> libraries as there is no lib target. I’ve tried many different things  but
> the usage-requirements for header only libraries never get included.

This is a recurring question, so I've added it to docs:
http://boost.org/boost-build2/doc/html/bbv2/faq/header-only-libraries.html

can you take a look and tell if what I wrote is clear enough or needs further
clarification?


> Interestingly this page
> (http://boost.sourceforge.net/boost-build2/doc/html/bbv2/advanced/jamfiles.
>html) towards the middle gives this example;
>
> lib helpers : helpers.hpp ; # a header-only library
> alias helpers : helpers.lib : <toolset>msvc ; # except on msvc

Strangely, I don't see where that file is linked from. I'll take a close look.

- Volodya

_______________________________________________
Boost-build mailing list
[hidden email]
http://lists.boost.org/mailman/listinfo.cgi/boost-build
Reply | Threaded
Open this post in threaded view
|

Re: Need help getting header only libraries to work.

David Abrahams
Vladimir Prus <[hidden email]> writes:

> On Saturday 14 January 2006 04:46, [hidden email] wrote:
>
>> <library>/TinyXMLSTL//TinyXMLSTL/<link>static
>>
>> The problem is I don’t know what I’m supposed to do for header only
>> libraries as there is no lib target. I’ve tried many different things  but
>> the usage-requirements for header only libraries never get included.
>
> This is a recurring question, so I've added it to docs:
> http://boost.org/boost-build2/doc/html/bbv2/faq/header-only-libraries.html
>
> can you take a look and tell if what I wrote is clear enough or needs further
> clarification?

Why don't we just implement my suggestion from
http://article.gmane.org/gmane.comp.lib.boost.build/11166 so we can
stop clarifying this point?

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

_______________________________________________
Boost-build mailing list
[hidden email]
http://lists.boost.org/mailman/listinfo.cgi/boost-build
Reply | Threaded
Open this post in threaded view
|

Re: Need help getting header only libraries to work.

Vladimir Prus
On Tuesday 17 January 2006 03:47, David Abrahams wrote:

> > This is a recurring question, so I've added it to docs:
> > http://boost.org/boost-build2/doc/html/bbv2/faq/header-only-libraries.htm
> >l
> >
> > can you take a look and tell if what I wrote is clear enough or needs
> > further clarification?
>
> Why don't we just implement my suggestion from
> http://article.gmane.org/gmane.comp.lib.boost.build/11166 so we can
> stop clarifying this point?

Currently

    lib a ;

is interpreted as searched library named "a", that is you'll get -liba in
command line on linux, and a.lib on Windows. So your proposal conflicts with
the current semantics (proposed by you, as well). Using presense or absense
of usage-requirements in "lib" to determine if that's header-only library or
not does not seem reliable to me.

- Volodya

_______________________________________________
Boost-build mailing list
[hidden email]
http://lists.boost.org/mailman/listinfo.cgi/boost-build
Reply | Threaded
Open this post in threaded view
|

Re: Need help getting header only libraries to work.

David Abrahams
Vladimir Prus <[hidden email]> writes:

> On Tuesday 17 January 2006 03:47, David Abrahams wrote:
>
>> > This is a recurring question, so I've added it to docs:
>> > http://boost.org/boost-build2/doc/html/bbv2/faq/header-only-libraries.htm
>> >l
>> >
>> > can you take a look and tell if what I wrote is clear enough or needs
>> > further clarification?
>>
>> Why don't we just implement my suggestion from
>> http://article.gmane.org/gmane.comp.lib.boost.build/11166 so we can
>> stop clarifying this point?
>
> Currently
>
>     lib a ;
>
> is interpreted as searched library named "a", that is you'll get -liba in
> command line on linux, and a.lib on Windows. So your proposal conflicts with
> the current semantics (proposed by you, as well). Using presense or absense
> of usage-requirements in "lib" to determine if that's header-only library or
> not does not seem reliable to me.

Why not?  To me it seems reliable and only slightly obtuse.

Some other possibilities:

     lib a : : prebuilt ;
     lib a : : system ;
     lib a : : search ;       # I like this one
     lib b : : header-only ;  # And this one

     prebuilt-lib a ;
     header-only-lib b;


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

_______________________________________________
Boost-build mailing list
[hidden email]
http://lists.boost.org/mailman/listinfo.cgi/boost-build
Reply | Threaded
Open this post in threaded view
|

Re: Need help getting header only libraries to work.

Vladimir Prus
On Saturday 21 January 2006 01:47, David Abrahams wrote:

> > Currently
> >
> >     lib a ;
> >
> > is interpreted as searched library named "a", that is you'll get -liba in
> > command line on linux, and a.lib on Windows. So your proposal conflicts
> > with the current semantics (proposed by you, as well). Using presense or
> > absense of usage-requirements in "lib" to determine if that's header-only
> > library or not does not seem reliable to me.
>
> Why not?  To me it seems reliable and only slightly obtuse.

For example:

   lib a
        : # no sources
        : # no requirements
        : # no default build
        : <include>whatever ;

Is this a header-only library? Or a searched library with extra usage
requirements?

>
> Some other possibilities:
>
>      lib a : : prebuilt ;
>      lib a : : system ;
>      lib a : : search ;       # I like this one
>      lib b : : header-only ;  # And this one

This overloads the third argument of "lib" -- elsewhere, it means requiements.

>      prebuilt-lib a ;
>      header-only-lib b;

I like this one. I'm not sure we need 'prebuilt-lib' as we current have a way
to express that, but 'header-only-lib' can be a more readable alternative to
'alias'.

Would you like to add this rule to builtin.jam?

- Volodya





_______________________________________________
Boost-build mailing list
[hidden email]
http://lists.boost.org/mailman/listinfo.cgi/boost-build
Reply | Threaded
Open this post in threaded view
|

Re: Need help getting header only libraries to work.

David Abrahams
Vladimir Prus <[hidden email]> writes:

> On Saturday 21 January 2006 01:47, David Abrahams wrote:
>
>> > Currently
>> >
>> >     lib a ;
>> >
>> > is interpreted as searched library named "a", that is you'll get -liba in
>> > command line on linux, and a.lib on Windows. So your proposal conflicts
>> > with the current semantics (proposed by you, as well). Using presense or
>> > absense of usage-requirements in "lib" to determine if that's header-only
>> > library or not does not seem reliable to me.
>>
>> Why not?  To me it seems reliable and only slightly obtuse.
>
> For example:
>
>    lib a
>         : # no sources
>         : # no requirements
>         : # no default build
>         : <include>whatever ;
>
> Is this a header-only library? Or a searched library with extra usage
> requirements?

OK.

>> Some other possibilities:
>>
>>      lib a : : prebuilt ;
>>      lib a : : system ;
>>      lib a : : search ;       # I like this one
>>      lib b : : header-only ;  # And this one
>
> This overloads the third argument of "lib" -- elsewhere, it means requiements.

Yes, why couldn't that be a requirement, i.e. a property of the
target?

>>      prebuilt-lib a ;
>>      header-only-lib b;
>
> I like this one. I'm not sure we need 'prebuilt-lib' as we current have a way
> to express that, but 'header-only-lib' can be a more readable alternative to
> 'alias'.
>
> Would you like to add this rule to builtin.jam?

It always comes down to something like that, doesn't it?  ;-)
OK, I'll try to get to it.  Where should the docs and tests be
changed?

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

_______________________________________________
Boost-build mailing list
[hidden email]
http://lists.boost.org/mailman/listinfo.cgi/boost-build
Reply | Threaded
Open this post in threaded view
|

Re: Need help getting header only libraries to work.

Vladimir Prus
On Friday 27 January 2006 19:26, David Abrahams wrote:

> >>      prebuilt-lib a ;
> >>      header-only-lib b;
> >
> > I like this one. I'm not sure we need 'prebuilt-lib' as we current have a
> > way to express that, but 'header-only-lib' can be a more readable
> > alternative to 'alias'.
> >
> > Would you like to add this rule to builtin.jam?
>
> It always comes down to something like that, doesn't it?  ;-)

Yes ;-). But it's a simple rule that just calls "alias", so it should be be
too much work.

> OK, I'll try to get to it.  Where should the docs

In the "Builtin targets" section, where the syntax of "lib" is described, I
believe.

> and tests be
> changed?

You can copy tests/template.py to tests/header_only_lib.py and then add
header_only_lib to the list in test_all.py

Thanks,
Volodya

_______________________________________________
Boost-build mailing list
[hidden email]
http://lists.boost.org/mailman/listinfo.cgi/boost-build
Reply | Threaded
Open this post in threaded view
|

Re: Need help getting header only libraries to work.

Vladimir Prus
In reply to this post by David Abrahams
On Friday 27 January 2006 19:26, David Abrahams wrote:

> >> Some other possibilities:
> >>
> >>      lib a : : prebuilt ;
> >>      lib a : : system ;
> >>      lib a : : search ;       # I like this one
> >>      lib b : : header-only ;  # And this one
> >
> > This overloads the third argument of "lib" -- elsewhere, it means
> > requiements.
>
> Yes, why couldn't that be a requirement, i.e. a property of the
> target?

Forgot to answer this one. It's probably possible, but still a bit of a
stretch. If "prebuilt" a value of some implicit feature? Or not, we're
changing the syntax rules for the sake of one use-case.

- Volodya
_______________________________________________
Boost-build mailing list
[hidden email]
http://lists.boost.org/mailman/listinfo.cgi/boost-build
Reply | Threaded
Open this post in threaded view
|

Re: Need help getting header only libraries to work.

David Abrahams
Vladimir Prus <[hidden email]> writes:

> On Friday 27 January 2006 19:26, David Abrahams wrote:
>
>> >> Some other possibilities:
>> >>
>> >>      lib a : : prebuilt ;
>> >>      lib a : : system ;
>> >>      lib a : : search ;       # I like this one
>> >>      lib b : : header-only ;  # And this one
>> >
>> > This overloads the third argument of "lib" -- elsewhere, it means
>> > requiements.
>>
>> Yes, why couldn't that be a requirement, i.e. a property of the
>> target?
>
> Forgot to answer this one. It's probably possible, but still a bit of a
> stretch. If "prebuilt" a value of some implicit feature?

Sure.  

    feature library-type : prebuilt header-only ;

> Or not, we're changing the syntax rules for the sake of one
> use-case.

Let's not do that.

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

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