def generate_code(): messages.disable( # Warnings 1020 - 1031 are all about why Py++ generates wrapper for class X messages.W1020 , messages.W1021 , messages.W1022 , messages.W1023 , messages.W1024 , messages.W1025 , messages.W1026 , messages.W1027 , messages.W1028 , messages.W1029 , messages.W1030 , messages.W1031 , messages.W1035 , messages.W1040 , messages.W1038 , messages.W1041 # , messages.W1036 # pointer to Python immutable member # , messages.W1033 # unnamed variables # , messages.W1018 # expose unnamed classes # , messages.W1049 # returns reference to local variable # , messages.W1014 # unsupported '=' operator ) # # Use GCCXML to create the controlling XML file. # If the cache file (../cache/*.xml) doesn't exist it gets created, otherwise it just gets loaded # NOTE: If you update the source library code you need to manually delete the cache .XML file # xml_cached_fc = parser.create_cached_source_fc( os.path.join( environment.ois.root_dir, "python_ois.h" ) , environment.ois.cache_file ) defined_symbols = ['OIS_NONCLIENT_BUILD' ] defined_symbols.append( 'VERSION_' + environment.ois.version ) if environment.isMac(): defined_symbols.append ('OIS_APPLE_PLATFORM') # # build the core Py++ system from the GCCXML created source # mb = module_builder.module_builder_t( [ xml_cached_fc ] , gccxml_path=environment.gccxml_bin , working_directory=environment.root_dir , include_paths=environment.ois.include_dirs , define_symbols=defined_symbols , indexing_suite_version=2 , cflags=environment.ois.cflags ) # if this module depends on another set it here mb.register_module_dependency ( environment.ogre.generated_dir ) # normally implicit conversions work OK, however they can cause strange things to happen so safer to leave off mb.constructors().allow_implicit_conversion = False mb.BOOST_PYTHON_MAX_ARITY = 25 mb.classes().always_expose_using_scope = True # # We filter (both include and exclude) specific classes and functions that we want to wrap # global_ns = mb.global_ns global_ns.exclude() main_ns = global_ns.namespace( MAIN_NAMESPACE ) main_ns.include() common_utils.AutoExclude ( mb, MAIN_NAMESPACE ) ManualExclude ( mb ) common_utils.AutoInclude ( mb, MAIN_NAMESPACE ) ManualInclude ( mb ) # here we fixup functions that expect to modifiy their 'passed' variables ManualTransformations ( mb ) AutoFixes ( mb, MAIN_NAMESPACE ) ManualFixes ( mb ) common_utils.Auto_Functional_Transformation ( main_ns ) # # We need to tell boost how to handle calling (and returning from) certain functions # common_utils.Set_DefaultCall_Policies ( mb.global_ns.namespace ( MAIN_NAMESPACE ) ) # # the manual stuff all done here !!! # hand_made_wrappers.apply( mb ) NoPropClasses = [""] for cls in main_ns.classes(): if cls.name not in NoPropClasses: cls.add_properties( recognizer=ogre_properties.ogre_property_recognizer_t() ) ## add additional version information to the module to help identify it correctly common_utils.addDetailVersion ( mb, environment, environment.ois ) ########################################################################################## # # Creating the code. After this step you should not modify/customize declarations. # ########################################################################################## extractor = exdoc.doc_extractor() # I'm excluding the UTFstring docs as lots about nothing mb.build_code_creator (module_name='_ois_' , doc_extractor= extractor ) for inc in environment.ois.include_dirs: mb.code_creator.user_defined_directories.append(inc ) mb.code_creator.user_defined_directories.append( environment.ois.generated_dir ) # # # mb.code_creator.replace_included_headers( customization_data.header_files( environment.ois.version ) ) ## we need to remove the previous one lastc = mb.code_creator.creators[ mb.code_creator.last_include_index() ] mb.code_creator.remove_creator( lastc ) # and now add our precompiled ones.. for x in range (len (customization_data.header_files( environment.ois.version ) ), 0 ,-1 ): h = customization_data.header_files( environment.ois.version )[x-1] mb.code_creator.adopt_creator ( include.include_t ( header= h ), 0) huge_classes = map( mb.class_, customization_data.huge_classes( environment.ois.version ) ) mb.split_module(environment.ois.generated_dir, huge_classes, use_files_sum_repository=False)
def generate_code(): # messages.disable( # # Warnings 1020 - 1031 are all about why Py++ generates wrapper for class X # messages.W1020 # , messages.W1021 # , messages.W1022 # , messages.W1023 # , messages.W1024 # , messages.W1025 # , messages.W1026 # , messages.W1027 # , messages.W1028 # , messages.W1029 # , messages.W1030 # , messages.W1031 # , messages.W1035 # # , messages.W1040 # # , messages.W1038 # , messages.W1041 # , messages.W1036 # pointer to Python immutable member # , messages.W1033 # unnamed variables # , messages.W1018 # expose unnamed classes # # , messages.W1049 # returns reference to local variable # , messages.W1014 # unsupported '=' operator # ) xml_cached_fc = parser.create_cached_source_fc( os.path.join( environment.cegui.root_dir, "python_CEGUI.h" ) , environment.cegui.cache_file ) defined_symbols = [ 'OGRE_NONCLIENT_BUILD', 'CEGUI_NONCLIENT_BUILD','OGRE_GCC_VISIBILITY','__PYTHONOGRE_BUILD_CODE', 'OGRE_GUIRENDERER_EXPORTS'] defined_symbols.append( 'VERSION_' + environment.cegui.version.replace ('.','_') ) if environment._USE_THREADS: defined_symbols.append('BOOST_HAS_THREADS') defined_symbols.append('BOOST_HAS_WINTHREADS') mb = module_builder.module_builder_t( [ xml_cached_fc ] , gccxml_path=environment.gccxml_bin , working_directory=environment.root_dir , include_paths=environment.cegui.include_dirs , define_symbols=defined_symbols , indexing_suite_version=2 , cflags=environment.ogre.cflags ) # if this module depends on another set it here mb.register_module_dependency ( environment.ogre.generated_dir ) filter_declarations (mb) ns=mb.global_ns.namespace ('CEGUI') print "\n\n" c=ns.class_('::CEGUI::Checkbox') for f in c.member_functions(): print "LENGTH ", len( ns.member_functions(f.name ) ), "for ", f.name for c in ns.member_functions(f.name ): print "==:", c.decl_string print f.decl_string # # sys.exit() change_cls_alias( mb.global_ns.namespace ('CEGUI') ) mb.BOOST_PYTHON_MAX_ARITY = 25 mb.classes().always_expose_using_scope = True mb.class_('::CEGUI::EventSet').member_functions('subscribeEvent').exclude() # mb.class_('::CEGUI::Scrollbar').member_functions('subscribeEvent').exclude() configure_exception( mb ) hand_made_wrappers.apply( mb ) set_call_policies (mb) for cls in mb.global_ns.namespace ('CEGUI').classes(): cls.add_properties( recognizer=ogre_properties.ogre_property_recognizer_t() ) common_utils.add_LeadingLowerProperties ( cls ) v=mb.global_ns.namespace ('CEGUI') .class_('ScriptModule').variable('d_identifierString') print "INCLUDE:", v v.include() print "DONE" ## add additional version information to the module to help identify it correctly common_utils.addDetailVersion ( mb, environment, environment.cegui ) #Creating code creator. After this step you should not modify/customize declarations. extractor = exdoc.doc_extractor("") mb.build_code_creator (module_name='_cegui_', doc_extractor= extractor) print "VARIABLE exportable:", v.exportable for incs in environment.cegui.include_dirs: mb.code_creator.user_defined_directories.append( incs ) mb.code_creator.user_defined_directories.append( environment.cegui.generated_dir ) # mb.code_creator.replace_included_headers( customization_data.header_files(environment.cegui.version) ) ## we need to remove the previous one lastc = mb.code_creator.creators[ mb.code_creator.last_include_index() ] mb.code_creator.remove_creator( lastc ) # and now add our precompiled ones.. for x in range (len (customization_data.header_files( environment.cegui.version ) ), 0 ,-1 ): h = customization_data.header_files( environment.cegui.version )[x-1] mb.code_creator.adopt_creator ( include.include_t ( header= h ), 0) huge_classes = map( mb.class_, customization_data.huge_classes(environment.cegui.version) ) mb.split_module(environment.cegui.generated_dir, huge_classes)