Boost logo

Boost-Build :

Subject: Re: [Boost-build] prototyping alternative Boost.Build syntax
From: Stefan Seefeld (stefan_at_[hidden])
Date: 2016-10-28 13:15:21


On 28.10.2016 13:11, Vladimir Prus wrote:
> Stefan,
>
> On 28-Oct-16 7:55 PM, Stefan Seefeld wrote:
>> On 28.10.2016 12:48, Vladimir Prus wrote:
>>> Stefan,
>>>
>>> On 28-Oct-16 7:44 PM, Stefan Seefeld wrote:
>>>>> A target is just represented as a string in Jam and
>>>>> Python. The internal structures used by the back end
>>>>> are created on demand.
>>>>
>>>> That doesn't help me much. If I want to define a new target I surely
>>>> need to invoke some `bjam` function (from the bjam module Vladimir
>>>> just
>>>> mentioned) to declare that.
>>>
>>> Are you sure you want to define a new target? That would bypass all of
>>> logic for creating a target that Boost.Build has?
>>>
>>> I though that what you're after is to prototype how do use Python do
>>> define a metatarget, affectively how to replaceS
>>>
>>> exe a : a.cpp ;
>>>
>>> with equivalent Python code. In order to do that, you only need to know
>>> Python interface for declaring metatargets, not b2 interface for
>>> declaring targets. Am I missing something?
>>
>> I'm not sure. I have yet to figure out what the right boundary is to
>> interface with the build engine.
>> So let's assume I want to try both:
>>
>> * I want to prototype how to write metatargets in Python
>
> Then, you would need to:
>
> - Build b2 with Python support
> - Look at
> https://github.com/boostorg/build/blob/develop/src/build/project.py,
> like 150, where it loads Jamfiles.
> - Modify that place and/or load_jamfile method to support loading Python
> modules
>
>> * I want to prototype how to write targets (to eventually replace all of
>> the above Boost.Build logic by suitable Python code).
>
> Modify
> https://github.com/boostorg/build/blob/develop/src/kernel/bootstrap.py
>
> so that the bootstrap function has:
>
> bjam_interface = __import__('bjam')
>
> bjam_interface.define_action("gcc.compile", "g++ -c -o $(<) $(>)")
> bjam_interface.set_update_action("gcc.compile", "a.o", "a.cpp")
>
> Then, you'd go from there.
OK, thanks, I think that gives me a good starting point !

        Stefan

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

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