extra_compile_args in Cython

前端 未结 2 1480
逝去的感伤
逝去的感伤 2020-12-31 01:15

I want to pass some extra options to the Cython compiler by using extra_compile_args.

My setup.py:

from distut         


        
2条回答
  •  礼貌的吻别
    2020-12-31 01:41

    Use the more traditional way without cythonize to supply extra compiler options:

    from distutils.core import setup
    from distutils.extension import Extension
    from Cython.Distutils import build_ext
    
    setup(
      name = 'Test app',
      ext_modules=[
        Extension('test',
                  sources=['test.pyx'],
                  extra_compile_args=['-O3'],
                  language='c++')
        ],
      cmdclass = {'build_ext': build_ext}
    )
    

提交回复
热议问题