how to compile multiple files in cython

Newbie to Cython. I am using the following code snippet in a file called setup.py to compile another file into Cython (it was suggested by an SO user to me over here):

from distutils.core import setup
from distutils.extension import Extension
from Cython.Distutils import build_ext

ext_modules = [Extension('func1', ['util/func1_pc.py'],)]

setup(
    name="Set 1 of Functions",
    cmdclass={'build_ext': build_ext},
    ext_modules=ext_modules
)

I compile it as python setup.py build_ext --inplace. This compiles my file at util/func1_pc.py into func1.pyd in the directory of setup.py.

Suppose I now have two files: util/funct1_pc.py and util/funct2_pc.py. Would it be possible for someone to suggest how to modify the above code snippet to generate func1.pyd and func2.pyd out of them?

Thanks.

Answer

The Extension constructor allows you to specify multiple source files, so changing the ext_modules line to this:

ext_modules = [Extension('func1', ['util/func1_pc.py', 'util/funct2_pc.py'],)]

should do the trick.