[Numpy-discussion] Suggestions on the best way to customize compilation flags

David Cournapeau david@ar.media.kyoto-u.ac...
Fri Nov 9 01:59:55 CST 2007


Hi,

    I would like know the opinion from other people on the best way to 
customize compilation flags for building numpy. I am talking about the 
end-user point of view (e.g. I want to use the 
--optimize--so-aggressively-that-my-cpu-burns-into-flames flags, but 
without breaking build of python extensions because I forgot -fPIC).

    One of the goal of using scons within distutils was to separate the 
logic between compilation options which are necessary to make the binary 
work at all (basically, what are the options to build a python extension 
on supported platforms, how to build a dll for ctypes, etc...) and the 
ones which are 'secondary' (optimization, debug, warnings). I have 
started working in this direction, using compiler configuration objects, 
which are just dictionaries:

http://projects.scipy.org/scipy/numpy/browser/branches/numpy.scons/numpy/distutils/scons/core/default.py

The idea is that:
    - those configurations can be easily changed during the configure 
step of a package (for example, use sse unit instead of x87, etc...)
    - those configuration are not used directly when building projects: 
they are first copied to the actually used flags. The idea is that if 
necessary, you could request build environments without some warning 
flags (think pyrex/swig compilation), and only add them on user request.
    - those configurations are totally independent from the options 
necessary to build python extensions (those are not user accessible; I 
have not yet cleaned everything, but the goal is to have those flags set 
outside the extension builder logic, to avoid the distutils mess, which 
put and modifying flags everywhere deep down in the code).

thanks,

David




More information about the Numpy-discussion mailing list