matlab_wrap.py
Go to the documentation of this file.
1 #!/usr/bin/env python3
2 """
3 Helper script to wrap C++ to Matlab.
4 This script is installed via CMake to the user's binary directory
5 and invoked during the wrapping by CMake.
6 """
7 
8 import argparse
9 import sys
10 
11 from gtwrap.matlab_wrapper import MatlabWrapper
12 
13 if __name__ == "__main__":
14  arg_parser = argparse.ArgumentParser(
15  formatter_class=argparse.ArgumentDefaultsHelpFormatter)
16  arg_parser.add_argument("--src",
17  type=str,
18  required=True,
19  help="Input interface .h file.")
20  arg_parser.add_argument("--module_name",
21  type=str,
22  required=True,
23  help="Name of the C++ class being wrapped.")
24  arg_parser.add_argument("--out",
25  type=str,
26  required=True,
27  help="Name of the output folder.")
28  arg_parser.add_argument(
29  "--top_module_namespaces",
30  type=str,
31  default="",
32  help="C++ namespace for the top module, e.g. `ns1::ns2::ns3`. "
33  "Only the content within this namespace and its sub-namespaces "
34  "will be wrapped. The content of this namespace will be available at "
35  "the top module level, and its sub-namespaces' in the submodules.\n"
36  "For example, `import <module_name>` gives you access to a Python "
37  "`<module_name>.Class` of the corresponding C++ `ns1::ns2::ns3::Class`"
38  ", and `from <module_name> import ns4` gives you access to a Python "
39  "`ns4.Class` of the C++ `ns1::ns2::ns3::ns4::Class`. ")
40  arg_parser.add_argument(
41  "--ignore",
42  nargs='*',
43  type=str,
44  help="A space-separated list of classes to ignore. "
45  "Class names must include their full namespaces.")
46  arg_parser.add_argument(
47  "--use-boost-serialization",
48  action="store_true",
49  help="Allow boost based serialization methods",
50  )
51  args = arg_parser.parse_args()
52 
53  top_module_namespaces = args.top_module_namespaces.split("::")
54  if top_module_namespaces[0]:
55  top_module_namespaces = [''] + top_module_namespaces
56 
57  print(f"[MatlabWrapper] Ignoring classes: {args.ignore}", file=sys.stderr)
58 
59  wrapper = MatlabWrapper(
60  module_name=args.module_name,
61  top_module_namespace=top_module_namespaces,
62  ignore_classes=args.ignore,
63  use_boost_serialization=args.use_boost_serialization)
64 
65  sources = args.src.split(';')
66  cc_content = wrapper.wrap(sources, path=args.out)
EIGEN_STRONG_INLINE Packet4f print(const Packet4f &a)


gtsam
Author(s):
autogenerated on Tue Jul 4 2023 02:34:46