Boost logo

Boost-Build :

Subject: Re: [Boost-build] Python port development
From: Steven Watanabe (watanabesj_at_[hidden])
Date: 2010-07-09 15:43:54


AMDG

Artyom wrote:
>>> - Build time checks like check if standard library supports function (build
>>>
>> in like iconv, socket etc)
>>
>>> - Build time search for specific function is several optional libraries.
>>>
>>>
>> These are special cases of checking if a target builds.
>>
>>
>
> I understand clearly that if you have something that test that something
> compiles
> you can do the rest. The question is what the effor?
>
> One line? two lines? 100 lines?
>

It's not very hard, although it could be simpler.
(Warning completely untested)

lib.cpp
=======
#include <header.h>
int main() { f(); }

Jamfile
=======
lib lib1 ;
lib lib2 ;
exe check_lib1f : lib.cpp lib1 ;
exe check_lib2f : lib.cpp lib2 ;

alias libf : : : :
    [ check-target-builds check-lib1
      : <library>lib1 :
    [ check-target-builds check-lib2
      : <library>lib2 : <define>NO_f ] ] ;

All of the stuff in the Jamfile could be collapsed with
a generic helper function:

rule select-library ( source : libraries * : properties-on-failure * )
{
    libraries = [ sequence.reverse $(libraries) ] ;
    local properties = $(properties-on-failure) ;
    for local lib in $(libraries)
    {
        exe check-required-library-$(lib) : $(source) $(lib) ;
        properties = [ check-target-builds
            check-required-library-$(lib) : <source>$(lib) :
$(properties) ] ;
    }
    return $(properties) ;
}

lib lib1 ;
lib lib2 ;
alias libf : : : : [ select-library lib.cpp : lib1 lib2 : <define>NO_f ] ;

Do you have something different in mind?

In Christ,
Steven Watanabe


Boost-Build list run by bdawes at acm.org, david.abrahams at rcn.com, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk