def generate_code(): xml_cached_fc = parser.create_cached_source_fc( os.path.join( environment.ogrerefapp.root_dir, "python_ogre.h" ) , environment.ogrerefapp.cache_file ) defined_symbols = [ 'OGREREFAPP_NONCLIENT_BUILD', 'OGRE_NONCLIENT_BUILD','__PYTHONOGRE_BUILD_CODE' ] defined_symbols.append( 'OGREREFAPP_VERSION_' + environment.ogrerefapp.version ) 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.ogrerefapp.include_dirs , define_symbols=defined_symbols , indexing_suite_version=2 ) filter_declarations (mb) # common_utils.set_declaration_aliases( mb.global_ns, customization_data.aliases( environment.ogrerefapp.version ) ) # # fix shared Ptr's that are defined as references but NOT const... # find_nonconst ( mb.namespace( 'OgreRefApp' ) ) mb.BOOST_PYTHON_MAX_ARITY = 25 mb.classes().always_expose_using_scope = True ogrerefapp_ns = mb.namespace( 'OgreRefApp' ) # common_utils.fix_unnamed_classes( ogre_ns.classes( name='' ), 'OgreRefApp' ) # common_utils.configure_shared_ptr(mb) # configure_exception( mb ) hand_made_wrappers.apply( mb ) set_call_policies ( mb.global_ns.namespace ('OgreRefApp') ) for cls in ogrerefapp_ns.classes(): cls.add_properties( recognizer=ogre_properties.ogre_property_recognizer_t() ) ## because we want backwards pyogre compatibility lets add leading lowercase properties common_utils.add_LeadingLowerProperties ( cls ) ## add additional version information to the module to help identify it correctly common_utils.addDetailVersion ( mb, environment, environment.ogrerefapp ) #Creating code creator. After this step you should not modify/customize declarations. extractor = exdoc.doc_extractor("") mb.build_code_creator (module_name='_ogrerefapp_',doc_extractor= extractor) for inc in environment.ogrerefapp.include_dirs : mb.code_creator.user_defined_directories.append(inc ) mb.code_creator.user_defined_directories.append( environment.ogrerefapp.generated_dir ) mb.code_creator.replace_included_headers( customization_data.header_files( environment.ogrerefapp.version ) ) huge_classes = map( mb.class_, customization_data.huge_classes( environment.ogrerefapp.version ) ) mb.split_module(environment.ogrerefapp.generated_dir, huge_classes)
def generate_ogrenewt(): xml_cached_fc = parser.create_cached_source_fc( os.path.join( environment.ogrenewt.root_dir, "python_ogrenewt.h" ) , environment.ogrenewt.cache_file ) defined_symbols = [ 'OGRE_NONCLIENT_BUILD','__PYTHONOGRE_BUILD_CODE', 'ogrenewt_NONCLIENT_BUILD','OIS_NONCLIENT_BUILD' ] #, 'OIS_STATIC_BUILD' ] defined_symbols.append( 'VERSION_' + environment.ogrenewt.version ) if environment._USE_THREADS: defined_symbols.append('BOOST_HAS_THREADS') defined_symbols.append('BOOST_HAS_WINTHREADS') if environment.isLinux(): defined_symbols.append('BOOST_IS_ENUM') mb = module_builder.module_builder_t( [ xml_cached_fc ] , gccxml_path=environment.gccxml_bin , working_directory=environment.root_dir , include_paths=environment.ogrenewt.include_dirs , define_symbols=defined_symbols , cflags=environment.ogrenewt.cflags , indexing_suite_version=2 ) ## This module depends on Ogre mb.register_module_dependency ( environment.ogre.generated_dir ) filter_declarations (mb) # # fix shared Ptr's that are defined as references but NOT const... # find_nonconst ( mb.namespace( 'Ogre' ) ) mb.BOOST_PYTHON_MAX_ARITY = 25 mb.classes().always_expose_using_scope = True # # the manual stuff all done here !!! # hand_made_wrappers.apply( mb ) # # We need to tell boost how to handle calling (and returning from) certain functions # set_call_policies ( mb.global_ns.namespace ('OgreNewt') ) # here we fixup functions that expect to modifiy their 'passed' variables # add_transformations ( mb ) # # now add properties # for cls in mb.namespace ('OgreNewt').classes(): cls.add_properties( recognizer=ogre_properties.ogre_property_recognizer_t() ) common_utils.add_LeadingLowerProperties ( cls ) ## add additional version information to the module to help identify it correctly common_utils.addDetailVersion ( mb, environment, environment.ogrenewt ) # create the doc extractor we'll be using extractor = exdoc.doc_extractor("") # #Creating the actual code. After this step you should not modify/customize declarations. # mb.build_code_creator (module_name='_ogrenewt_', doc_extractor= extractor) for incs in environment.ogrenewt.include_dirs: mb.code_creator.user_defined_directories.append( incs ) mb.code_creator.replace_included_headers( customization_data.header_files(environment.ogrenewt.version) ) huge_classes = map( mb.class_, customization_data.huge_classes(environment.ogrenewt.version) ) mb.split_module(environment.ogrenewt.generated_dir, huge_classes) # return_pointee_value_source_path \ # = os.path.join( environment.pyplusplus_install_dir # , 'pyplusplus_dev' # , 'pyplusplus' # , 'code_repository' ) # ## , 'return_pointee_value.hpp' ) ## Removed AJM 1/1/07 # return_pointee_value_target_path \ # = os.path.join( environment.ogrenewt.generated_dir, 'return_pointee_value.hpp' ) # if not os.path.exists( return_pointee_value_target_path ): # shutil.copy( return_pointee_value_source_path, environment.ogrenewt.generated_dir ) if environment.isMac(): ## now we need to ensure a series of headers and additional source files are ## copied to the generated directory.. basePath = os.path.join(environment.Config.PATH_OgreAddons,'ogrenewt', 'OgreNewt_Main') common_utils.copyTree ( sourcePath = os.path.join(basePath, 'inc'), destPath = environment.ogrenewt.generated_dir, recursive= False, extensions = ['h'] ) common_utils.copyTree ( sourcePath = os.path.join(basePath, 'src'), destPath = environment.ogrenewt.generated_dir, recursive= False, collapse = True, # put all the source in a single directory extensions = ['cpp'] )
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)