Re: [pygccxml-development] building project with include subFolder
Brought to you by:
mbaas,
roman_yakovenko
From: Roman Y. <rom...@gm...> - 2008-07-22 18:27:08
|
On Tue, Jul 22, 2008 at 8:46 PM, Damien Fagnou <dam...@mo...> wrote: > Hi , > > the library that I need to convert is organized sort like : > > src/algo > /misc/string > /number > /utils > /stream > > then inside the file the include are : > > #include "algo/sort.h" > #include "misc/string/capitalize.h" > #include "stream/save.h" > > reading the documentation I originally copied all the header into a > single directory an include those into the main file to Bind. > this work quite well but there is some problem . > - I can't use the live files > - there are some file with the same names . > - etc > > I there a way to update my project so I could have one include file : > > #include "algo/sort.h" > #include "misc/string/capitalize.h" > #include "stream/save.h" > #include "utils/io.h" > > then setup my search so it doesnt exlude the class registered in ./algo > , ./mist , ./stream , ./utils ? > I have try using the include path , but didnt manage to make it work . > just want to make sure its possible . Hope next code will help you, at least will give you some direction import os source_dir = absolute path to "src" directory source_files = iterate over source_dir recursive and gather all files, use absolute paths tmp = [] for f in source_files: tmp.append( '#include "%s"' % f ) tmp = os.linesep.join( tmp ) from pygccxml import parser mb = module_builder_t( [ parser.create_text_fc( tmp ) ], .... ); #now I hope you can filter on location: def my_filter( decl ): if not decl.location: return True elif decl.location.file_name is under one of your directories: return True else: return False mb.global_ns.exclude() mb.global_ns.decls( my_filter ).include() HTH -- Roman Yakovenko C++ Python language binding http://www.language-binding.net/ |