Skip to content

Instantly share code, notes, and snippets.

@carsten-forty2
Created June 16, 2015 16:05
Show Gist options
  • Save carsten-forty2/7b6b838e47d6936c6836 to your computer and use it in GitHub Desktop.
Save carsten-forty2/7b6b838e47d6936c6836 to your computer and use it in GitHub Desktop.
#!/usr/bin/env python
# -*- coding: utf-8 -*-
import os
import logging
from pygccxml import parser
from pygccxml import utils
from pygccxml import declarations
from pyplusplus import module_builder, decl_wrappers
def __parse_declarations(files,
gccxml_config,
cache,
indexing_suite_version):
compilation_mode = parser.COMPILATION_MODE.FILE_BY_FILE
reader = parser.project_reader_t(gccxml_config,
cache,
#decl_wrappers.dwfactory_t()
)
# error occurs here
decls = reader.read_files(files, compilation_mode)
def generate():
sourcedir = os.path.dirname(os.path.abspath(__file__))
sourceHeader = os.path.abspath(sourcedir + "/" + r"test.h")
xml_cached_fc = parser.create_cached_source_fc(sourceHeader, 'test.cache')
os.remove('test.cache')
#gccxmlpath = '/home/carsten/src/gimli/thirdParty/dist-Clang-3.6.0-64/bin/gccxml'
#caster = 'gccxml'
gccxmlpath = '/home/carsten/local/CastXML/build/bin/castxml'
caster = 'castxml'
logger = utils.loggers.cxx_parser
logger.setLevel(logging.DEBUG)
gccxml_config = parser.gccxml_configuration_t( gccxml_path=gccxmlpath
, working_directory='./'
, include_paths=[]
, define_symbols=[]
, undefine_symbols=[]
, start_with_declarations=None
, ignore_gccxml_output=False
, cflags=""
, compiler=None
, caster=caster)
__parse_declarations([xml_cached_fc],
gccxml_config,
cache=None,
indexing_suite_version=2)
#mb = module_builder.module_builder_t([xml_cached_fc],
#gccxml_path=gccxmlpath,
#working_directory='./',
#include_paths=[],
#define_symbols=[],
#indexing_suite_version=2,
#caster=caster
#)
if __name__ == '__main__':
generate()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment