Hello, I am currently packaging an extension module that uses the glib library. The correct way to compile such a program is: gcc `glib-config --cflags` ... -c ... -o ... That is, the output of "glib-config --cflags" must be near the beginning of the compilation command (it usually contains -I options). I tried to use the extra_compile_args argument to Extension's __init__() method but it only adds arguments to the end of the compilation command. I looked into Distutils' sources and found that the extra_preargs argument to UnixCCompiler.compile() would do the trick, but it can't be set from Extension's __init__() method. When the compile() method is called in build_ext.py, no extra_preargs is passed, so it always gets its default value: None. Currently, I adopted the following "solution": strip the leading -I from each argument output by "glib-config --cflags" and give it as include_dirs to Extension.__init__(). This is somewhat ugly since the output of "glib-config --cflags" could contain arguments that are not include directory specifications. My hack would fail in such cases. Is there a better solution I couldn't see? I searched the mailing-list archive and didn't find anything really satisfactory. If not, could we consider adding the possibility of specifying some-arguments-of-any-kind (not only include dirs of macros or whatever) to be put near the beginning of the compilation command from the setup() call? [ BTW, there is a similar issue with linking, but as `glib-config --libs` is OK at the end of the link command line, extra_link_args does the trick. However, it would be nice to be able to customize the beginning if the link command. ] Thank you for your comments. Here is my current setup.py. -- Florent
participants (1)
-
Florent Rougon