Hi Pearu! On Sat, Mar 12, 2011 at 2:30 AM, Pearu Peterson <pearu.peter...@gmail.com> wrote: > > > On Fri, Mar 11, 2011 at 3:58 AM, Ondrej Certik <ond...@certik.cz> wrote: >> >> Hi, >> >> I spent about an hour googling and didn't figure this out. Here is my >> setup.py: >> >> setup( >> name = "libqsnake", >> cmdclass = {'build_ext': build_ext}, >> version = "0.1", >> packages = [ >> 'qsnake', >> 'qsnake.calculators', >> 'qsnake.calculators.tests', >> 'qsnake.data', >> 'qsnake.mesh2d', >> 'qsnake.tests', >> ], >> package_data = { >> 'qsnake.tests': ['phaml_data/domain.*'], >> }, >> include_dirs=[numpy.get_include()], >> ext_modules = [Extension("qsnake.cmesh", [ >> "qsnake/cmesh.pyx", >> "qsnake/fmesh.f90", >> ])], >> description = "Qsnake standard library", >> license = "BSD", >> ) >> > > You can specify Fortran code, that you don't want to process with f2py, in > the libraries list > and then use the corresponding library in the extension, for example: > > setup(... > libraries = [('foo', dict(sources=['qsnake/fmesh.f90']))], > ext_modules = [Extension("qsnake.cmesh", > sources = > ["qsnake/cmesh.pyx"], > libraries = ['foo'] > )], > ... > ) > > See also scipy/integrate/setup.py that resolves the same issue but just > using the configuration function approach.
Indeed, I just tried it and it works! Thanks. I am now able to compile fortran code into the extension module. The only problem is that I am not able to convince Cython to also parse the .pyx files, it clashes with the numpy's implementation of build_ext. Which usually is not a problem, as long as one doesn't need to compile Fortran and .pyx at the same time. So cmake seems like the only robust option anyway. Ondrej _______________________________________________ NumPy-Discussion mailing list NumPy-Discussion@scipy.org http://mail.scipy.org/mailman/listinfo/numpy-discussion