diff options
author | Marcus Müller <marcus@hostalia.de> | 2020-06-19 11:07:54 +0200 |
---|---|---|
committer | Marcus Müller <marcus@hostalia.de> | 2020-06-19 11:07:54 +0200 |
commit | e76d04ca2f4f15e3b1a1ab2a81dd52c4e6d2472c (patch) | |
tree | 1d86f68fceed9cd7204d9a79e816dc06c15feaf4 /gr-utils/bindtool/scripts/bind_intree_file.py | |
parent | 98348e37209aa7daeb96fe5ead815e5b083dc6da (diff) | |
parent | 39311758cb1e6a7424d3213b3eb2c65c8c4dcfe1 (diff) |
Move from SWIG to Pybind11
Goodbye, and thanks for all the fish, SWIG.
Please refer to docs/PYBIND11.md for details on how to deal with Pybind.
Diffstat (limited to 'gr-utils/bindtool/scripts/bind_intree_file.py')
-rw-r--r-- | gr-utils/bindtool/scripts/bind_intree_file.py | 58 |
1 files changed, 58 insertions, 0 deletions
diff --git a/gr-utils/bindtool/scripts/bind_intree_file.py b/gr-utils/bindtool/scripts/bind_intree_file.py new file mode 100644 index 0000000000..79a9c3da1a --- /dev/null +++ b/gr-utils/bindtool/scripts/bind_intree_file.py @@ -0,0 +1,58 @@ +import warnings +import argparse +import os +from gnuradio.bindtool import BindingGenerator +import pathlib +import sys + +parser = argparse.ArgumentParser(description='Bind a GR In-Tree Module') +parser.add_argument('--module', type=str, + help='Name of gr module containing file to bind (e.g. fft digital analog)') + +parser.add_argument('--output_dir', default='/tmp', + help='Output directory of generated bindings') +parser.add_argument('--prefix', help='Prefix of Installed GNU Radio') +parser.add_argument('--src', help='Directory of gnuradio source tree', + default=os.path.dirname(os.path.abspath(__file__))+'/../../..') + +parser.add_argument( + '--filename', help="File to be parsed") + +parser.add_argument( + '--include', help='Additional Include Dirs, separated', default=(), nargs='+') + +parser.add_argument( + '--status', help='Location of output file for general status (used during cmake)', default=None +) +parser.add_argument( + '--flag_automatic', default='0' +) +parser.add_argument( + '--flag_pygccxml', default='0' +) + +args = parser.parse_args() + +prefix = args.prefix +output_dir = args.output_dir +includes = args.include +name = args.module + +if name not in ['gr', 'pmt']: + namespace = ['gr', name] + prefix_include_root = 'gnuradio/'+name # pmt, gnuradio/digital, etc. +else: + namespace = [name] + if name == 'gr': + prefix_include_root = 'gnuradio' + elif name == 'pmt': + prefix_include_root = 'pmt' + +with warnings.catch_warnings(): + warnings.filterwarnings("ignore", category=DeprecationWarning) + + bg = BindingGenerator(args.prefix, namespace, + prefix_include_root, output_dir, addl_includes=','.join(args.include), catch_exceptions=False, write_json_output=False, status_output=args.status, + flag_automatic=True if args.flag_automatic.lower() in ['1','true'] else False, + flag_pygccxml=True if args.flag_pygccxml.lower() in ['1','true'] else False) + bg.gen_file_binding(args.filename) |