Boost logo

Boost-Build :

Subject: Re: [Boost-build] [python] Python build description
From: Spencer E. Olson (olsonse_at_[hidden])
Date: 2010-07-14 14:50:01


On Wednesday 14 July 2010 11:33, Stefan Seefeld wrote:

> One thing I very much dislike about the SConstruct syntax is the very
> unpythonic syntax to define variables. Instead of doing the natural
> thing and just use Python variables, SCons uses strings and the "$"
> operator, very much like "make". I would have preferred a plain Python
> variable assignment.

I really agree. Hence, the stuff I sent earlier is written directly in
python. So, where you have in Jam:
--------------------------------- BJam Example -------------------------
<<<<<<<< Jamroot >>>>>>>>
project /myApp
    : requirements
      <define>PROJECT_NAME=myApp
    ;
use-project /myLibby : ./myLib/ ;
build-project main ;
<<<<<<<< main/Jamfile >>>>>>>>
project : requirements <define>FOO=BAR ;
exe test : main.cpp stuff.o /myLibby//library/<link>static ;
obj stuff.o : stuff.cpp ;
install convenient-copy : test : <location>. ;

<<<<<<<< myLib/Jamroot >>>>>>>>
project /mylib
    : requirements
      <define>POUND_DEFINE=blah
      <include>src/
    : usage-requirements
      <include>src/
      <define>CLIENT_POUND_DEFINE=blar
    ;
  
lib library
    : src/myLib/func.cpp src/myLib/other.cpp
    : <define>OTHER_POUND_DEFINE=hahaha
    ;

--------------------------------- pyJam Example -------------------------
in python (as per the example stuff in my earlier email), you have:
<<<<<<<< Jamroot.py >>>>>>>>
from build import *
project('/myApp',
  define('PROJECT_NAME=myApp'),
);
use_project('./myLib/');
build_project ('main');

<<<<<<<< main/Jamfile.py >>>>>>>>
from build import *

project('app',
  define('FOO=BAR'),
);
# Different ways to specify some linkage and install things...
if True:
    o = obj('stuff.o', 'stuff.cpp');
    e = executable('test', 'main.cpp', o,
      linklib('/myLib//library', static=True),
      define('FOO=BAR')
    );
    install( e, location='.' );
    install( e, location='/usr/bin', name='sysinstall' );
else:
    executable('test', 'main.cpp', link('stuff.o'),
      linklib('/myLib//library', static=True),
      define('FOO=BAR')
    );
    install( 'test', location='.' );
    install( 'test', location='/usr/bin', name='sysinstall' );
    obj('stuff.o', 'stuff.cpp');

<<<<<<<< myLib/Jamroot.py >>>>>>>>
from build import *

project('/myLib',
  define('POUND_DEFINE=blah'),
  include('src/'),
  client_requirements=[
    include('src/'),
    define('CLIENT_POUND_DEFINE=blar'),
  ]
);

library('library',
  'src/myLib/func.cpp',
  define('OTHER_POUND_DEFINE=hahaha'),
  'src/myLib/other.cpp',
);

>
> However, prior to focus on syntax, it's important to clarify at least
> some semantic points:
>
> * do variable dependencies necessarily form a directed acyclic graph, or
> could they be cyclic ?
> * how much flexibility is needed in allowing different evaluation
> policies (immediate vs. lazy) ?
> (And, what does "immediate" actually mean: at initialization, or at
> some well-defined point later during execution ?)
>
> The answers to these questions affect not only what syntax is possible,
> but also what syntax may be best to convey the semantics, for this to be
> intuitive.
>
> Stefan


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