Re: [pygccxml-development] Parsing a single header file for the whole project
Brought to you by:
mbaas,
roman_yakovenko
From: Roman Y. <rom...@gm...> - 2010-04-01 18:19:30
|
2010/4/1 Benoît Leveau <ben...@gm...>: > What I ended up doing is: > creating a temporary file with a list of #include "header_path" then > constructing the module_builder_t with this file. > > I first tried with create_text_fc but if you do that, in all the cpp > files generated by py++ , you won't get any include, so nothing will > compile. create_text_fc takes as argument valid C++ code. It is very useful for small tests: mb = module_builder.module_builder_t( [ module_builder.create_text_fc( 'namespace enums{ enum color{ red = 1}; }' )] , gccxml_path=autoconfig.gccxml.executable, compiler=pygccxml.utils.native_compiler.get_gccxml_compiler() ) mb.namespace( name='::enums' ).include() > The only weird thing now is that in all the cpp files, they all > include this temp file, so I need to keep this temp file for building. I believe you will end making that file "permanent". You will add there few work around and template instantiations. > I didn't know this create_cached_source... I'll try that to see if > that solves my problem. It will save you compilation of source files with gccxml, py++ will still have to parse the generated xml file. > I remember I tried the cache=cache_file_path option to > module_builder_t constructor, but it was not helping at all. > Each time the cache file was read, then recreated, and the generation > time was almost the same as without any cache. I guess, it was recreated because you generated temp file each time ( may be I wrong ). >From the benchmarks I did, "pickling" declarations tree was much slower then recreating it from the existing xml file. -- Roman Yakovenko C++ Python language binding http://www.language-binding.net/ |