third-party library dependencies

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

third-party library dependencies

Boost - Build mailing list

Hello,

I'm trying to add a few library dependencies to a (boost) project. https://boostorg.github.io/build/tutorial.html#best_practices explains how to add

lib xml : : <name>libxml <search>C:/lib : : <include>C:/include ; 

  to a user-config.jam file, then use it from a Jamfile via `<library>/user-config//xml`. This approach seems to require the user-config.jam file to contain a call to `lib xml`. Is there a way to make that optional (so a default `xml` target gets instantiated with default paths, only to be overridden if any custom paths or requirements are needed ? Or would that require an `xml` module to be created, as is done for a few other third-party packages b2 has builtin support for (zlib, libpng, etc.) ?

Thanks,

Stefan
-- 

      ...ich hab' noch einen Koffer in Berlin...
    

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

Re: third-party library dependencies

Boost - Build mailing list
AMDG

On 05/20/2018 02:03 PM, Stefan Seefeld via Boost-build wrote:

>
> I'm trying to add a few library dependencies to a (boost) project.
> https://boostorg.github.io/build/tutorial.html#best_practices explains
> how to add
>
> lib xml : : <name>libxml <search>C:/lib : : <include>C:/include ;
>
>   to a user-config.jam file, then use it from a Jamfile via
> `<library>/user-config//xml`. This approach seems to require the
> user-config.jam file to contain a call to `lib xml`. Is there a way to
> make that optional (so a default `xml` target gets instantiated with
> default paths, only to be overridden if any custom paths or requirements
> are needed ? Or would that require an `xml` module to be created, as is
> done for a few other third-party packages b2 has builtin support for
> (zlib, libpng, etc.) ?
>

  You really should use a module.  All the module needs to
do is wrap up the logic for tracking whether the target
has been created yet.  The lib rule is not really designed
to handle this.  Hypothetically, I suppose you could make
a module that searches config files for targets.

In Christ,
Steven Watanabe
_______________________________________________
Unsubscribe & other changes: https://lists.boost.org/mailman/listinfo.cgi/boost-build
Reply | Threaded
Open this post in threaded view
|

Re: third-party library dependencies

Boost - Build mailing list

ping ?


On 2018-05-23 09:26 AM, stefan wrote:

On 2018-05-23 09:06 AM, Steven Watanabe via Boost-build wrote:

AMDG

On 05/20/2018 02:03 PM, Stefan Seefeld via Boost-build wrote:
I'm trying to add a few library dependencies to a (boost) project.
https://boostorg.github.io/build/tutorial.html#best_practices explains
how to add

lib xml : : <name>libxml <search>C:/lib : : <include>C:/include ; 

  to a user-config.jam file, then use it from a Jamfile via
`<library>/user-config//xml`. This approach seems to require the
user-config.jam file to contain a call to `lib xml`. Is there a way to
make that optional (so a default `xml` target gets instantiated with
default paths, only to be overridden if any custom paths or requirements
are needed ? Or would that require an `xml` module to be created, as is
done for a few other third-party packages b2 has builtin support for
(zlib, libpng, etc.) ?

  You really should use a module.  All the module needs to
do is wrap up the logic for tracking whether the target
has been created yet.  The lib rule is not really designed
to handle this.  Hypothetically, I suppose you could make
a module that searches config files for targets.

OK, I have done that. Actually I need to look for two libs (opencl and clblas), so I created two modules. Now I want to add opencl as a (usage) requirement to clblas, i.e. make it such that whenever a user links to clblas//clblas, opencl gets linked also.

Here are my two modules:
https://github.com/stefanseefeld/boost.ublas/blob/opencl/opencl.jam
https://github.com/stefanseefeld/boost.ublas/blob/opencl/clblas.jam

how should I modify clblas.jam to add opencl to its usage requirements ?

And finally, what would be the right place to put these modules, such that users can see / use them ?
While I'm of course happy to contribute them to Boost.Build itself, I'm not sure this is the right solution in general. There needs to be a mechanism for users to write and publish their own modules, but I couldn't quite figure out how.

(Also, as a side-note: the two modules above contain a lot of boilerplate code. Is there a way to compact that, or even create something like a module template that I could use and parametrize for the specifics of a given library ?


Many thanks,

Stefan
--

      ...ich hab' noch einen Koffer in Berlin...
    

Stefan
--

      ...ich hab' noch einen Koffer in Berlin...
    

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

Re: third-party library dependencies

Boost - Build mailing list
AMDG

  Apologies.  It seems that I never received your previous
reply (it's definitely not in my archives).  Anyway, answering
this is a bit involved, so I'll try to make time for it some
time tomorrow.

In Christ,
Steven Watanabe

On 06/08/2018 01:14 PM, Stefan Seefeld via Boost-build wrote:
> ping ?
> <snip>
>

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

Re: third-party library dependencies

Boost - Build mailing list
In reply to this post by Boost - Build mailing list
AMDG

On 06/08/2018 01:14 PM, Stefan Seefeld via Boost-build wrote:

>
> On 2018-05-23 09:26 AM, stefan wrote:
>>
>> On 2018-05-23 09:06 AM, Steven Watanabe via Boost-build wrote:
>>
>>> On 05/20/2018 02:03 PM, Stefan Seefeld via Boost-build wrote:
>>>> I'm trying to add a few library dependencies to a (boost) project.
>>>> https://boostorg.github.io/build/tutorial.html#best_practices  explains
>>>> how to add
>>>>
>>>> lib xml : : <name>libxml <search>C:/lib : : <include>C:/include ;
>>>>
>>>>    to a user-config.jam file, then use it from a Jamfile via
>>>> `<library>/user-config//xml`. This approach seems to require the
>>>> user-config.jam file to contain a call to `lib xml`. Is there a way to
>>>> make that optional (so a default `xml` target gets instantiated with
>>>> default paths, only to be overridden if any custom paths or
>>>> requirements
>>>> are needed ? Or would that require an `xml` module to be created, as is
>>>> done for a few other third-party packages b2 has builtin support for
>>>> (zlib, libpng, etc.) ?
>>>>
>>>    You really should use a module.  All the module needs to
>>> do is wrap up the logic for tracking whether the target
>>> has been created yet.  The lib rule is not really designed
>>> to handle this.  Hypothetically, I suppose you could make
>>> a module that searches config files for targets.
>>
>> OK, I have done that. Actually I need to look for two libs (opencl and
>> clblas), so I created two modules. Now I want to add opencl as a
>> (usage) requirement to clblas, i.e. make it such that whenever a user
>> links to clblas//clblas, opencl gets linked also.
>>
>> Here are my two modules:
>> https://github.com/stefanseefeld/boost.ublas/blob/opencl/opencl.jam
>> https://github.com/stefanseefeld/boost.ublas/blob/opencl/clblas.jam
>>
>> how should I modify clblas.jam to add opencl to its usage requirements ?
>>

  The normal method is to list opencl as a source to clblas.
This is a bit tricky as you want users to be able to configure
clblas only (and rely on autoconfiguration of opencl), or
configure both libraries explicitly (in any order).  I think
I'm going to have to revisit the library configuration mechanism
to handle this better.

>> And finally, what would be the right place to put these modules, such
>> that users can see / use them ?
>> While I'm of course happy to contribute them to Boost.Build itself,
>> I'm not sure this is the right solution in general. There needs to be
>> a mechanism for users to write and publish their own modules, but I
>> couldn't quite figure out how.
>>

  At the moment, adding such modules to Boost.Build is
the most reliable solution.  You could technically
put them anywhere as long as you set BOOST_BUILD_PATH
appropriately, but that requires an extra pre-build
configuration step.  I've considered ways to allow
user-config.jam to find project specific modules, but
I don't have any solution that isn't pretty hacky.

>> (Also, as a side-note: the two modules above contain a lot of
>> boilerplate code. Is there a way to compact that, or even create
>> something like a module template that I could use and parametrize for
>> the specifics of a given library ?
>>

  I've been meaning to create such a module template.
I think there are enough concrete uses to work out
a reasonable abstraction now.

In Christ,
Steven Watanabe
_______________________________________________
Unsubscribe & other changes: https://lists.boost.org/mailman/listinfo.cgi/boost-build
Reply | Threaded
Open this post in threaded view
|

Re: third-party library dependencies

Boost - Build mailing list
On 06/10/18 19:03, Steven Watanabe via Boost-build wrote:
AMDG

On 06/08/2018 01:14 PM, Stefan Seefeld via Boost-build wrote:

Here are my two modules:
https://github.com/stefanseefeld/boost.ublas/blob/opencl/opencl.jam
https://github.com/stefanseefeld/boost.ublas/blob/opencl/clblas.jam

how should I modify clblas.jam to add opencl to its usage requirements ?

  The normal method is to list opencl as a source to clblas.

In the clblas.jam file I pointed to, where would I need to add it ? (There are no "sources" involved at all...)

This is a bit tricky as you want users to be able to configure
clblas only (and rely on autoconfiguration of opencl), or
configure both libraries explicitly (in any order).  I think
I'm going to have to revisit the library configuration mechanism
to handle this better.

That would be great indeed !
And finally, what would be the right place to put these modules, such
that users can see / use them ?
While I'm of course happy to contribute them to Boost.Build itself,
I'm not sure this is the right solution in general. There needs to be
a mechanism for users to write and publish their own modules, but I
couldn't quite figure out how.

  At the moment, adding such modules to Boost.Build is
the most reliable solution.  You could technically
put them anywhere as long as you set BOOST_BUILD_PATH
appropriately, but that requires an extra pre-build
configuration step.  I've considered ways to allow
user-config.jam to find project specific modules, but
I don't have any solution that isn't pretty hacky.

With my faber frontend that's easy and natural, as modules are handled by Python, so all I need to do is set the PYTHONPATH variable. I would expect something equivalent with bjam, i.e. a simple search path where bjam will look for extension modules.
(Also, as a side-note: the two modules above contain a lot of
boilerplate code. Is there a way to compact that, or even create
something like a module template that I could use and parametrize for
the specifics of a given library ?

  I've been meaning to create such a module template.
I think there are enough concrete uses to work out
a reasonable abstraction now.

Many thanks,

Stefan
-- 

      ...ich hab' noch einen Koffer in Berlin...
    

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

Re: third-party library dependencies

Boost - Build mailing list
AMDG

On 06/10/2018 06:38 PM, Stefan Seefeld via Boost-build wrote:
>
> With my faber frontend that's easy and natural, as modules are handled
> by Python, so all I need to do is set the PYTHONPATH variable. I would
> expect something equivalent with bjam, i.e. a simple search path where
> bjam will look for extension modules.

It's called BOOST_BUILD_PATH.

In Christ,
Steven Watanabe
_______________________________________________
Unsubscribe & other changes: https://lists.boost.org/mailman/listinfo.cgi/boost-build
Reply | Threaded
Open this post in threaded view
|

Re: third-party library dependencies

Boost - Build mailing list
On 06/10/18 20:41, Steven Watanabe via Boost-build wrote:
AMDG

On 06/10/2018 06:38 PM, Stefan Seefeld via Boost-build wrote:
With my faber frontend that's easy and natural, as modules are handled
by Python, so all I need to do is set the PYTHONPATH variable. I would
expect something equivalent with bjam, i.e. a simple search path where
bjam will look for extension modules.
It's called BOOST_BUILD_PATH.

OK, but what is the required "pre-build configuration step" you were mentioning in your last reply, then ?


Stefan
-- 

      ...ich hab' noch einen Koffer in Berlin...
    

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

Re: third-party library dependencies

Boost - Build mailing list
AMDG

On 06/10/2018 07:29 PM, Stefan Seefeld via Boost-build wrote:

> On 06/10/18 20:41, Steven Watanabe via Boost-build wrote:
>> On 06/10/2018 06:38 PM, Stefan Seefeld via Boost-build wrote:
>>> With my faber frontend that's easy and natural, as modules are handled
>>> by Python, so all I need to do is set the PYTHONPATH variable. I would
>>> expect something equivalent with bjam, i.e. a simple search path where
>>> bjam will look for extension modules.
>> It's called BOOST_BUILD_PATH.
>
> OK, but what is the required "pre-build configuration step" you were
> mentioning in your last reply, then ?
>

  You have to set BOOST_BUILD_PATH manually.
There's no way for a project to add itself
to BOOST_BUILD_PATH automatically, since
anything that the project does will happen
after user-config.jam is loaded.

In Christ,
Steven Watanabe
_______________________________________________
Unsubscribe & other changes: https://lists.boost.org/mailman/listinfo.cgi/boost-build