diff options
author | Rohit Goswami <rog32@hi.is> | 2021-11-15 21:07:38 +0000 |
---|---|---|
committer | Rohit Goswami <rog32@hi.is> | 2021-11-15 21:07:38 +0000 |
commit | a5bc4c124f884acb8aa4ee2d3c7db2e41aca738b (patch) | |
tree | d13f38b37c9e925d6bbb0521a4a815a6923adb8e /doc/source/f2py/code | |
parent | a311764ec016510cce62304d25e781f97da7d3b4 (diff) | |
download | numpy-a5bc4c124f884acb8aa4ee2d3c7db2e41aca738b.tar.gz |
DOC: Update meson and f2py for automated wrappers
Diffstat (limited to 'doc/source/f2py/code')
-rw-r--r-- | doc/source/f2py/code/meson.build | 16 | ||||
-rw-r--r-- | doc/source/f2py/code/meson_upd.build | 37 |
2 files changed, 49 insertions, 4 deletions
diff --git a/doc/source/f2py/code/meson.build b/doc/source/f2py/code/meson.build index 425ee90f6..b756abf8f 100644 --- a/doc/source/f2py/code/meson.build +++ b/doc/source/f2py/code/meson.build @@ -5,8 +5,10 @@ project('f2py_examples', 'c', add_languages('fortran') py_mod = import('python') -py3 = py_mod.find_installation() +py3 = py_mod.find_installation('python3') py3_dep = py3.dependency() +message(py3.path()) +message(py3.get_install_dir()) incdir_numpy = run_command(py3, ['-c', 'import os; os.chdir(".."); import numpy; print(numpy.get_include())'], @@ -18,13 +20,19 @@ incdir_f2py = run_command(py3, check : true ).stdout().strip() +fibby_source = custom_target('fibbymodule.c', + input : ['fib1.f'], + output : ['fibbymodule.c'], + command : [ py3, '-m', 'numpy.f2py', '@INPUT@', + '-m', 'fibby', '--lower' ] + ) + inc_np = include_directories(incdir_numpy, incdir_f2py) -py3.extension_module('fib2', +py3.extension_module('fibby', 'fib1.f', - 'fib2module.c', + fibby_source, incdir_f2py+'/fortranobject.c', include_directories: inc_np, dependencies : py3_dep, install : true) - diff --git a/doc/source/f2py/code/meson_upd.build b/doc/source/f2py/code/meson_upd.build new file mode 100644 index 000000000..97bd8d175 --- /dev/null +++ b/doc/source/f2py/code/meson_upd.build @@ -0,0 +1,37 @@ +project('f2py_examples', 'c', + version : '0.1', + default_options : ['warning_level=2']) + +add_languages('fortran') + +py_mod = import('python') +py3 = py_mod.find_installation('python3') +py3_dep = py3.dependency() +message(py3.path()) +message(py3.get_install_dir()) + +incdir_numpy = run_command(py3, + ['-c', 'import os; os.chdir(".."); import numpy; print(numpy.get_include())'], + check : true +).stdout().strip() + +incdir_f2py = run_command(py3, + ['-c', 'import os; os.chdir(".."); import numpy.f2py; print(numpy.f2py.get_include())'], + check : true +).stdout().strip() + +fibby_source = custom_target('fibbymodule.c', + input : ['fib1.f'], + output : ['fibbymodule.c'], + command : [ py3, '-m', 'numpy.f2py', '@INPUT@', + '-m', 'fibby', '--lower' ]) + +inc_np = include_directories(incdir_numpy, incdir_f2py) + +py3.extension_module('fibby', + 'fib1.f', + fibby_source, + incdir_f2py+'/fortranobject.c', + include_directories: inc_np, + dependencies : py3_dep, + install : true) |