def test(self): module_builder.set_logger_level( logging.CRITICAL ) messages.disable( *messages.all_warning_msgs ) xml_file = parser.create_gccxml_fc( os.path.join( autoconfig.data_directory, 'particleuniverse.xml' ) ) mb = module_builder.module_builder_t( [ xml_file ] , gccxml_path=autoconfig.gccxml.executable , indexing_suite_version=2 , compiler=pygccxml.utils.native_compiler.get_gccxml_compiler()) mb.global_ns.exclude() mb.namespace('ParticleUniverse').include() mb.namespace('Ogre').include() mb.namespace('Ogre').classes().already_exposed = True target_dir = os.path.join( autoconfig.build_directory, 'particle_universe' ) #~ if os.path.exists( target_dir ): #~ shutil.rmtree( target_dir ) #~ os.mkdir( target_dir ) psp = mb.class_( '::ParticleUniverse::ParticleScriptParser' ) declarations.print_declarations( psp ) mb.build_code_creator( 'PU' ) mb.split_module( target_dir )
def test(self): module_builder.set_logger_level( logging.CRITICAL ) messages.disable( *messages.all_warning_msgs ) ogre_file = autoconfig.data_directory.replace( 'pyplusplus_dev', 'pygccxml_dev' ) ogre_file = parser.create_gccxml_fc( os.path.join( ogre_file, 'ogre.1.7.xml' ) ) mb = module_builder.module_builder_t( [ ogre_file ] , gccxml_path=autoconfig.gccxml.executable , indexing_suite_version=2 , compiler=pygccxml.utils.native_compiler.get_gccxml_compiler()) mb.global_ns.exclude() mb.namespace('Ogre').include() x = mb.global_ns.decls( lambda d: 'Animation*' in d.name and 'MapIterator' in d.name ) for y in x: print y.name print y.partial_name print declarations.full_name( y, with_defaults=False ) target_dir = os.path.join( autoconfig.build_directory, 'ogre' ) #~ if os.path.exists( target_dir ): #~ shutil.rmtree( target_dir ) #~ os.mkdir( target_dir ) mb.build_code_creator( 'Ogre3d' ) mb.split_module( target_dir )
def test(self): module_builder.set_logger_level( logging.CRITICAL ) messages.disable( *messages.all_warning_msgs ) ogre_file = autoconfig.data_directory.replace( 'pyplusplus_dev', 'pygccxml_dev' ) ogre_file = parser.create_gccxml_fc( os.path.join( ogre_file, 'ogre.1.7.xml' ) ) mb = module_builder.module_builder_t( [ ogre_file ] , xml_generator_config=autoconfig.xml_generator_config , indexing_suite_version=2) mb.global_ns.exclude() mb.namespace('Ogre').include() x = mb.global_ns.decls( lambda d: 'Animation*' in d.name and 'MapIterator' in d.name ) for y in x: print(y.name) print(y.partial_name) print(declarations.full_name( y, with_defaults=False )) target_dir = os.path.join( autoconfig.build_directory, 'ogre' ) #~ if os.path.exists( target_dir ): #~ shutil.rmtree( target_dir ) #~ os.mkdir( target_dir ) mb.build_code_creator( 'Ogre3d' ) mb.split_module( target_dir )
def __init__(self, name, deps=None, replacement_dict=default_replacement, indexing_suite_version = 2): """Constructor. @name name of the python module @dep name of another module this module depends on""" module_builder.set_logger_level( logging.INFO ) candidate_include_paths = [ "/home/lucas/private_ompl/omplapp/ompl/src", "/home/lucas/private_ompl/omplapp/src", "/usr/include/python2.7", "/usr/include", "/usr/local/include", ""] # Adding standard windows headers if platform == 'win32': compiler = getenv('GCCXML_COMPILER') # MinGW if compiler != None and (compiler.lower().endswith('g++') or compiler.lower().endswith('c++')): version = subprocess.Popen([compiler, '-dumpversion'], stdout=subprocess.PIPE).communicate()[0].strip() # Find whole path to MinGW compiler_path = "" for path in getenv('PATH').split(';'): if exists(join(path, compiler + '.exe')): compiler_path = path break if compiler_path is not "": # Adding in necessary include paths candidate_include_paths.append (join(compiler_path, "..", "include")) candidate_include_paths.append (join(compiler_path, "..", "lib", "gcc", "mingw32", version, "include")) candidate_include_paths.append (join(compiler_path, "..", "lib", "gcc", "mingw32", version, "include", "c++")) candidate_include_paths.append (join(compiler_path, "..", "lib", "gcc", "mingw32", version, "include", "c++", "mingw32")) include_paths = [] for path in candidate_include_paths: if len(path)>0 and exists(path): include_paths.append(path) self.mb = module_builder.module_builder_t( files = [ 'bindings/' + name + '.h' ], cache = '/home/lucas/private_ompl/omplapp/build/pyplusplus_'+name+'.cache', gccxml_path = "/usr/local/bin/gccxml", include_paths = include_paths, cflags="", indexing_suite_version = indexing_suite_version ) self.replacement = {} if replacement_dict==None else replacement_dict self.mb.classes().always_expose_using_scope = True self.mb.add_registration_code('PyEval_InitThreads();', tail=False) self.std_ns = self.mb.namespace('std') self.ompl_ns = self.mb.namespace('ompl') self.call_policies() self.filter_declarations() if deps!=None: for dep in deps: self.mb.register_module_dependency(dep) self.mb.build_code_creator( module_name='_'+name ) self.mb.split_module('bindings/' + name, use_files_sum_repository=True)
def __init__(self, name, deps=None, replacement_dict=default_replacement, indexing_suite_version=2): """Constructor. @name name of the python module @dep name of another module this module depends on""" module_builder.set_logger_level(logging.INFO) candidate_include_paths = [ "/home/kunal15595/ros/mp/omplapp/ompl/src", "/home/kunal15595/ros/mp/omplapp/src", "/usr/include/python2.7", "/usr/include", "/usr/include/assimp", "" ] # Adding standard windows headers if platform == 'win32': compiler = getenv('GCCXML_COMPILER') # MinGW if compiler != None and (compiler.lower().endswith('g++') or compiler.lower().endswith('c++')): version = subprocess.Popen( [compiler, '-dumpversion'], stdout=subprocess.PIPE).communicate()[0].strip() # Find whole path to MinGW compiler_path = "" for path in getenv('PATH').split(';'): if exists(join(path, compiler + '.exe')): compiler_path = path break if compiler_path is not "": # Adding in necessary include paths candidate_include_paths.append( join(compiler_path, "..", "include")) candidate_include_paths.append( join(compiler_path, "..", "lib", "gcc", "mingw32", version, "include")) candidate_include_paths.append( join(compiler_path, "..", "lib", "gcc", "mingw32", version, "include", "c++")) candidate_include_paths.append( join(compiler_path, "..", "lib", "gcc", "mingw32", version, "include", "c++", "mingw32")) include_paths = [] for path in candidate_include_paths: if len(path) > 0 and exists(path): include_paths.append(path) self.mb = module_builder.module_builder_t( files=['bindings/' + name + '.h'], cache='/home/kunal15595/ros/mp/omplapp/build/Release/pyplusplus_' + name + '.cache', gccxml_path="/usr/local/bin/gccxml", include_paths=include_paths, cflags="", indexing_suite_version=indexing_suite_version) self.replacement = {} if replacement_dict == None else replacement_dict self.mb.classes().always_expose_using_scope = True self.mb.add_registration_code('PyEval_InitThreads();', tail=False) self.std_ns = self.mb.namespace('std') self.ompl_ns = self.mb.namespace('ompl') self.call_policies() self.filter_declarations() if deps != None: for dep in deps: self.mb.register_module_dependency(dep) self.mb.build_code_creator(module_name='_' + name) self.mb.split_module('bindings/' + name, use_files_sum_repository=True)
def dopypp(task): global included_decls # Set the path for importing additional tools if not os.path.join(task.srcpath, 'tools', 'waf') in sys.path: sys.path.append(os.path.join(task.srcpath, 'tools', 'waf')) # Increase recursion limit for tough includes sys.setrecursionlimit(sys.getrecursionlimit()*2) from pyplusplus import module_builder, messages, utils, code_repository from pygccxml import declarations,parser from pyplusplus.module_builder import call_policies from pypp_utils import TemplateBuilder import logging # Disable some annoying messages if not Logs.verbose: module_builder.set_logger_level(logging.FATAL) messages.disable(messages.W1023) messages.disable(messages.W1025) messages.disable(messages.W1026) messages.disable(messages.W1027) messages.disable(messages.W1031) messages.disable(messages.W1043) elif Logs.verbose > 2: module_builder.set_logger_level(logging.DEBUG) ## ????????????????????????????????????? What is this for ????????????????????????????? logger_lock.acquire() log = logging.getLogger() temp_handler = None if len(log.handlers) > 0: temp_handler = log.handlers[0] log.removeHandler(log.handlers[0]) logger_lock.release() # Create source list with proper directories sources = map(lambda a: os.path.abspath(os.path.join(task.bldpath, a.srcpath(task.env))), task.inputs) # Create include list global_includes = task.includes global_includes += task.env['CPPPATH'] global_includes += [os.path.abspath(os.path.join(task.bldpath, i.srcpath(task.env))) for i in task.path_lst] try: #if int(task.env['CC_VERSION'][1]) >= 3: #compilerExec = task.env['CXX_OLD_VERSION'][0] #else: compilerExec = task.env['CXX'][0] # No cache can be used on mac-osx systems, otherwise pygccxml segfaults if sys.platform != 'darwin': mb = module_builder.module_builder_t( files=sources , start_with_declarations = task.start_decls , define_symbols = task.define_symbols , working_directory = task.bldpath , include_paths = global_includes , compiler = compilerExec , cache=parser.file_cache_t(os.path.abspath(os.path.join(task.bldpath, task.outputs[0].bldpath(task.env)+'_cache' )))) else: mb = module_builder.module_builder_t( files=sources , start_with_declarations = task.start_decls , define_symbols = task.define_symbols , working_directory = task.bldpath , include_paths = global_includes , compiler = compilerExec) except Exception, e: print e if temp_handler: log.addHandler(temp_handler) return 1