-
Notifications
You must be signed in to change notification settings - Fork 13
/
pylib_generator.py
34 lines (27 loc) · 1.22 KB
/
pylib_generator.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
#!/usr/bin/python
from pygccxml import parser
from pyplusplus import module_builder
# Configurations that you may have to change on your system
generator_path = "/usr/bin/castxml"
generator_name = "castxml"
compiler = "gnu"
compiler_path = "/usr/bin/gcc"
# Create configuration for CastXML
xml_generator_config = parser.xml_generator_configuration_t(
xml_generator_path=generator_path,
xml_generator=generator_name,
compiler=compiler,
compiler_path=compiler_path)
# List of all the C++ header of our library
header_collection = ["Bonjour.hpp"]
# Parses the source files and creates a module_builder object
builder = module_builder.module_builder_t(
header_collection,
xml_generator_path=generator_path,
xml_generator_config=xml_generator_config)
# Automatically detect properties and associated getters/setters
builder.classes().add_properties(exclude_accessors=True)
# Define a name for the module
builder.build_code_creator(module_name="pylib_auto")
# Writes the C++ interface file
builder.write_module('pylib_auto.cpp')