Python distutil: build libraries before modules

B

Bo Peng

Dear list,

My python modules depend on a few boost libraries. For convenience, I
include the source code of these libraries with my distribution and
treat them as standard source files. This results in huge cc.exe command
lines and I get an error saying
error: command 'cc' failed: Invalid argument
under win32/mingw. (I am not quite sure this is the reason though.)

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.

Many thanks in advance.
Bo
 
B

Bo Peng

Bo said:
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
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
474,294
Messages
2,571,511
Members
48,202
Latest member
ClaudioVil

Latest Threads

Top