pygccxml.parser.config module

Defines C++ parser configuration classes.

create_compiler_path(xml_generator, compiler_path)

Try to guess a path for the compiler.

If you want to use a specific compiler, please provide the compiler path manually, as the guess may not be what you are expecting. Providing the path can be done by passing it as an argument (compiler_path) to the xml_generator_configuration_t() or by defining it in your pygccxml configuration file.

load_xml_generator_configuration(configuration, **defaults)

Loads CastXML or GCC-XML configuration.

Parameters
  • configuration (string|configparser.ConfigParser) – can be a string (file path to a configuration file) or instance of configparser.ConfigParser.

  • defaults – can be used to override single configuration values.

Returns

a configuration object

Return type

xml_generator_configuration_t

The file passed needs to be in a format that can be parsed by configparser.ConfigParser.

An example configuration file skeleton can be found here.

class parser_configuration_t(working_directory='.', include_paths=None, define_symbols=None, undefine_symbols=None, cflags='', ccflags='', compiler=None, xml_generator=None, keep_xml=False, compiler_path=None, flags=None, castxml_epic_version=None)

Bases: object

C++ parser configuration holder

This class serves as a base class for the parameters that can be used to customize the call to a C++ parser.

This class also allows users to work with relative files paths. In this case files are searched in the following order:

  1. current directory

  2. working directory

  3. additional include paths specified by the user

append_ccflags(val)
append_cflags(val)
property castxml_epic_version

File format version used by castxml.

property ccflags

additional cross-compatible flags to pass directly to internal simulated compiler. Castxml removes any definitions of its pre-defined macros (e.g. -fopenmp). To propagate these down to the compiler, these flags must also be passed here. See cc-opt on castxml’s documentation page: https://github.com/CastXML/CastXML/blob/master/doc/manual/castxml.1.rst

property cflags

additional flags to pass to compiler

clone()
property compiler

get compiler name to simulate

property compiler_path

Get the path for the compiler.

property define_symbols

list of “define” directives

property flags

Optional flags for pygccxml.

property include_paths

list of include paths to look for header files

property keep_xml

Are xml files kept after errors.

raise_on_wrong_settings()

Validates the configuration settings and raises RuntimeError on error

property undefine_symbols

list of “undefine” directives

property working_directory
property xml_generator

get xml_generator (gccxml or castxml)

class xml_generator_configuration_t(gccxml_path='', xml_generator_path='', working_directory='.', include_paths=None, define_symbols=None, undefine_symbols=None, start_with_declarations=None, ignore_gccxml_output=False, cflags='', ccflags='', compiler=None, xml_generator=None, keep_xml=False, compiler_path=None, flags=None, castxml_epic_version=None)

Bases: pygccxml.parser.config.parser_configuration_t

Configuration object to collect parameters for invoking gccxml or castxml.

This class serves as a container for the parameters that can be used to customize the call to gccxml or castxml.

clone()
property ignore_gccxml_output

set this property to True, if you want pygccxml to ignore any error warning that comes from gccxml

raise_on_wrong_settings()

Validates the configuration settings and raises RuntimeError on error

property start_with_declarations

list of declarations gccxml should start with, when it dumps declaration tree

property xml_generator_from_xml_file

Configuration object containing information about the xml generator read from the xml file.

Returns

configuration object

Return type

utils.xml_generators

property xml_generator_path

XML generator binary location