Question

building libraries with waf is nice and I like the lib<targetname> naming scheme. But when I use is with boost::python, I'd like to get rid of it: I'd like the librarie's name to be like the target name. This is just a simple rename, I know, but: Can I tell waf to leave out putting lib before the target name (alternatively: specify an own name which stays untouched)?

Was it helpful?

Solution

Ok, got it. This feature can be enabled by using the python tool, found here: http://docs.waf.googlecode.com/git/apidocs_16/tools/python.html#module-waflib.Tools.python

The main point is calling conf.init_pyext() and in the build directive for the shared library specifying features='pyext':

def options(opt):
        opt.load('python')

def configure(conf):
    conf.load('python')
    conf.check_python_version((2,4,2))
    conf.check_python_headers()

def build(bld):

    bld.shlib(
        features = 'pyext',
        source = "mymodule.cpp",
        target = "myfoo",
        use = "PYTHON BOOST_PYTHON")

Now, in the build directory there is a shared library called myfoo.so which can directly be imported.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top