wiki:CMTInWaf

Implementing CMT2 on top of Waf

Principle:

  • Package stands below the project at arbitrary directory depth
  • Every package is packaged using the CMT style:
    • a cmt directory with its requirements file
      • the requirements files hold:
        • mention of used packages
        • declarations of the constituents (libraries, programs, user build modules...)
        • specific macro/set/path declarations
    • a src directory containing the sources
    • other optional directories
      • <package> include files
      • job options
      • ...
  • The Project contains a cmt directory with its own requirements file
    • this requirements holds:
      • the list of packages belonging to the project
      • global definitions available to all packages
  • One install area per Project
    • default name is <project>/installarea

Architecture

Only one standard & generic wscript is needed for managing the whole project. It stands at the top level directory, i.e. above all other stuff of the project.

import cmt

top, out = cmt.init ()

def options (ctx):
  cmt.options (ctx)

def configure (ctx):
  cmt.configure (ctx)

def build (ctx):
  cmt.build (ctx)

The build is launched using:

> waf.py configure build

and will output the binaries into one single build directory (currently the build directory has the name of the platform: win32 or linux2). None of the package contents are modified during the build.

Test configuration

The setting on my windows machine is:

set PATH=c:\Install\Python27;%PATH%
set PATH=c:\Install\Waf;%PATH%
set PYTHONPATH=c:\Arnault\CMT2\Waf;%PYTHONPATH%

and on lx2

source /lal/Python/2.5/sl4_amd64_gcc34/setup.csh
setenv PYTHONPATH ~/CMT2/waf:$PYTHONPATH

The module cmt.py provides in addition a test generator mechanism able to generate a test configuration of N packages forming a tree of used packages.

Each package is named Pack<n> (n = 0 .. N-1) and implements:

  • one C++ (shared) library (name = Lib<n>)
    • with one class (name C<n>) defined in Lib<n>.hxx and coded in Lib<n>.cxx
    • the class instantiates one object of each used package as private members
    • the class provides one test function which recursively the test funtion of each used object.
  • one test program (name = test<n>)
    • it instantiates one object of the C<n> class
    • it calls the test function
> cd test
> python ../waf/cmt.py gencmt=50
or
> python ../waf/cmt.py genwaf=50

The generator generates the hierarchy of packages and may runs in two modes

  • the waf mode construct a native waf script at the top directory
  • the cmt mode installs a generic waf script which in turns calls the cmt.py module which interprets the hierarchy of requirements of generated packages.

In both cases the build is launched using

linux2> ( cd A ; ~/test/waf.py configure build 
linux2>
win32> cd A & ..\test\waf.py configure build & cd ..

The current development is maintained using SVN:

Next to do:

  • declare user build modules
    • eg: copy a file
    • gaudi component, etc...
  • multi-project using CMTPROJECTPATH
  • tag management for macro/set/path declaration
  • policy packages offering user build modules
  • automate initialisation of the work model
    • single work area:
      • a single package
      • a set of checked out packages part of a release
      • a complete project
    • using a set of pre-built projects
Last modified 12 years ago Last modified on Mar 8, 2012, 9:35:14 PM

Attachments (1)

  • cmt.py (18.5 KB) - added by /C=FR/O=CNRS/OU=UMR8607/CN=Christian Arnault/emailAddress=arnault@… 12 years ago.

Download all attachments as: .zip