Python distutil: build libraries before modules

Bo Peng bpeng at rice.edu
Mon May 1 22:35:59 EDT 2006


Bo Peng wrote:

> How can I let setup.py build these boost libraries separately so that I 
> can link them to my modules? This will also save some link time because 
> all my python modules link to the same boost libraries.

Although this is nowhere documented, I find that I can use

from distutils.ccompiler import *

def buildStaticLibrary(sourceFiles, libName, libDir):
   '''Build libraries to be linked to simuPOP modules'''
   # get a c compiler
   comp = new_compiler()
   objFiles = comp.compile(sourceFiles)
   comp.create_static_lib(objFiles, libName, libDir)

to build the libraries

Cheers,
Bo



More information about the Python-list mailing list