Briefly, I'm encountering difficulties getting things working in numpy
distutils for fwrap's build system.
Here are the steps I want the build system to accomplish:
1) Compile a directory of Fortran 90 source code -- this works.
- The .mod files generated by this compilation step are put in the
build directory.
2) Fwrap needs to call numpy.distutils.config.try_compile with some
generated fortran source code that depends on the .mod files generated
in 1).
For example:
Suppose a fortran 90 module 'type_params.mod' is generated in step 1).
Fwrap would generate this fortran source code and try to compile it:
subroutine s0(a)
use, intrinsic :: iso_c_binding
integer(c_int) :: a
interface
subroutine s1(a)
use type_params, only : int_param
integer(int_param) :: a
end subroutine s1
end interface
call s1(a)
end subroutine s0
If this compiles correctly with no errors about type
incompatibilities, then we know that the int_param in type_params
module corresponds to the C int type. If it doesn't, then we try the
other C integer types ('c_long', 'c_long_long', 'c_short', 'c_char')
until no error is generated (otherwise fail). This then ensures that
the type mappings between Fortran and C are correct, and we can then
go on to generate appropriate config files with this information.
So, this generated fortran source code depends on step 1), since the
type_params.mod file must exist first. Then we call
config.try_compile and see if it works.
My problem is in instantiating numpy.distutils.config such that it is
appropriately configured with command line flags.
I've tried the following with no success:
('self' is a build_ext instance)
cfg = self.distribution.get_command_obj('config')
cfg.initialize_options()
cfg.finalize_options() # doesn't do what I hoped it would do.
This creates a config object, but it doesn't use the command line
flags (e.g. --fcompiler=gfortran doesn't affect the fortran compiler
used).
Any pointers? More generally -- seeing the above, any ideas on how to
go about doing what I'm trying to do better?
Thanks,
Kurt
_______________________________________________
NumPy-Discussion mailing list
[email protected]
http://mail.scipy.org/mailman/listinfo/numpy-discussion