Waf: provide library name for python extensions

building libraries with waf are good, and I like the naming scheme lib<targetname> . But when I use this with boost :: python, I would like to get rid of it: I would like the library name to be as the target name. This is just a simple rename, I know, but: can I tell waf to leave lib to the target name (alternatively: specify a proper name that remains untouched)?

+4
source share
1 answer

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

The main conf.init_pyext() is to call conf.init_pyext() in the build directive for the shared library that defines 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 assembly directory there is a shared library called myfoo.so , which can be directly import ed.

+3
source

Source: https://habr.com/ru/post/1392539/


All Articles