[Cython] Fwd: Question about how best require compiler options for C sources

Ian Henriksen insertinterestingnamehere at gmail.com
Tue Apr 12 18:12:28 EDT 2016


On Mon, Apr 11, 2016 at 12:36 PM Ian Henriksen <
insertinterestingnamehere at gmail.com> wrote:

> On Mon, Apr 11, 2016 at 11:50 AM Ian Henriksen <
> insertinterestingnamehere at gmail.com> wrote:
>
>> To answer the original question about define macros, it appears that the
>> canonical
>> way to pass preprocessor defines through distutils is to use the
>> define_macros
>> keyword when constructing your Extension class. You should also be able
>> to do
>> this within a Cython source file by including a directive like:
>>
>> # distutils: define_macros = MY_DEFINE, MY_DEFINE_2=2
>>
>> Unfortunately, it looks like there's a bug in that that's making it so
>> that these
>> macros are undef'ed rather than being defined, so, for now, just pass the
>> appropriate flags to your Extension object.
>>
>>
> Small update on this, it looks like the issue with undef/define only
> applies when a
> define is specified this way without a value, so I either haven't gotten
> the syntax quite
> right, or that's not supported yet. Specifying an actual value for the
> macro works fine.
>
> Best,
> Ian Henriksen
>

Should be fixed in https://github.com/cython/cython/pull/509.
Best,
Ian Henriksen
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/cython-devel/attachments/20160412/4e970ba3/attachment-0001.html>


More information about the cython-devel mailing list