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.opcode.root_dir, "python_opcode.h" ) , environment.opcode.cache_file ) defined_symbols = ['OPCODE_EXPORTS'] #, 'ICE_NO_DLL'] #, 'OPC_USE_CALLBACKS' ] defined_symbols.append( 'VERSION_' + environment.opcode.version ) # # 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.opcode.include_dirs , define_symbols=defined_symbols , indexing_suite_version=2 , cflags=environment.ogre.cflags ) # NOTE THE CHANGE HERE 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() for ns in NAMESPACES: main_ns = global_ns.namespace( ns ) main_ns.include() AutoExclude ( mb ) ManualExclude ( mb ) AutoInclude ( mb ) ManualInclude ( mb ) # here we fixup functions that expect to modifiy their 'passed' variables ManualTransformations ( mb ) AutoFixes ( mb ) ManualFixes ( mb ) # # We need to tell boost how to handle calling (and returning from) certain functions # for ns in NAMESPACES: Set_Call_Policies ( mb.global_ns.namespace (ns) ) #IceMaths::Quat IceMaths::Matrix3x3::operator ::IceMaths::Quat() const [casting operator] c = mb.global_ns.namespace ( 'IceMaths').class_('Matrix3x3') for o in c.operators(): # print o # print dir(o) # print o.partial_decl_string # print o.name if 'Quat' in o.partial_decl_string: o.exclude() print "Excluded Op", o, "\n", o.partial_decl_string ## OP float const * IceMaths::Point::operator float const *() const [casting operator] c = mb.global_ns.namespace ( 'IceMaths').class_('Point') for o in c.operators(): if 'float const *' in o.partial_decl_string: o.exclude() print "Excluded Op", o, "\n", o.partial_decl_string ##Spere(udword nb_verts, const Point* verts); Not Implemented c = mb.global_ns.namespace ( 'IceMaths').class_('Sphere') for o in c.constructors(arg_types=("::udword","::IceMaths::Point const *") ): o.exclude() c = mb.global_ns.namespace ( 'IceMaths').class_('Matrix4x4') for o in c.constructors(): if len (o.arguments) > 10: o.exclude() for o in c.member_functions(): if len (o.arguments) > 10: print "Too Many Arguments - excluded:", o, o.partial_decl_string o.exclude() c = mb.global_ns.namespace ( 'IceMaths').class_('Matrix4x4') for o in c.casting_operators(): rett = o.return_type.decl_string if 'Quat' in rett or 'PR' in rett: o.exclude() print "Excluded Op", o # # the manual stuff all done here !!! # hand_made_wrappers.apply( mb ) NoPropClasses = [""] for ns in NAMESPACES: main_ns = global_ns.namespace( ns ) 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.opcode ) ########################################################################################## # # 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='_opcode_' , doc_extractor= extractor ) for inc in environment.opcode.include_dirs: mb.code_creator.user_defined_directories.append(inc ) mb.code_creator.user_defined_directories.append( environment.opcode.generated_dir ) mb.code_creator.replace_included_headers( customization_data.header_files( environment.opcode.version ) ) huge_classes = map( mb.class_, customization_data.huge_classes( environment.opcode.version ) ) mb.split_module(environment.opcode.generated_dir, huge_classes) ## now we need to ensure a series of headers and additional source files are ## copied to the generaated directory.. additional_dirs=[ [environment.Config.PATH_OPCODE ,''], [os.path.join(environment.Config.PATH_OPCODE, 'Ice'),'Ice'], [os.path.join(environment.Config.PATH_OPCODE, 'Ice'),''], ## double copy to make the compile work.. ] for d,d1 in additional_dirs: for f in os.listdir(d): if f.endswith('cpp') or f.endswith('.h') or f.endswith('.c'): sourcefile = os.path.join(d, f) destfile = os.path.join(environment.opcode.generated_dir, d1, f ) if not os.path.exists ( os.path.join(environment.opcode.generated_dir, d1 ) ): os.mkdir ( os.path.join(environment.opcode.generated_dir, d1 ) ) if not common_utils.samefile( sourcefile ,destfile ): shutil.copy( sourcefile, environment.opcode.generated_dir ) print "Updated ", f, "as it was missing or out of date"
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 ) # # 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.bullet.root_dir, "python_bullet.h" ) , environment.bullet.cache_file ) defined_symbols = [ 'BULLET_EXPORTS', '__GCCXML__', '_MSC_VER', '__MINGW32__' # needed to turn off allocator allignment which boost can't do.. ] defined_symbols.append( 'VERSION_' + environment.bullet.version ) if sys.platform.startswith ( 'linux' ): defined_symbols.append('USE_PTHREADS') # # 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.bullet.include_dirs , define_symbols=defined_symbols , indexing_suite_version=2 , cflags=environment.bullet.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() if MAIN_NAMESPACE == "" : main_ns = global_ns main_ns.include() else: main_ns = global_ns.namespace( MAIN_NAMESPACE ) main_ns.exclude () AutoInclude ( mb, MAIN_NAMESPACE ) ## note we use our own version, not common_utils common_utils.AutoExclude ( mb, MAIN_NAMESPACE ) ManualInclude ( mb ) # here we fixup functions that expect to modifiy their 'passed' variables ManualTransformations ( mb ) AutoFixes ( mb, MAIN_NAMESPACE ) # # We need to tell boost how to handle calling (and returning from) certain functions # Do this earlier than normal as I need to override the default in ManualFixes common_utils.Set_DefaultCall_Policies ( main_ns ) ManualFixes ( mb ) ManualExclude ( mb ) common_utils.Auto_Functional_Transformation ( main_ns ,special_vars=['btScalar *'] ) # # the manual stuff all done here !!! # hand_made_wrappers.apply( mb ) NoPropClasses = [""] for cls in main_ns.classes(): if cls.name not in NoPropClasses: rec = ogre_properties.ogre_property_recognizer_t() rec.addSetterType ( 'btScalar' ) # this type is a 'float/double' however we need to tell py++ such so it creates setters cls.add_properties( recognizer=rec ) common_utils.Auto_Document( mb, MAIN_NAMESPACE ) ## add additional version information to the module to help identify it correctly common_utils.addDetailVersion ( mb, environment, environment.bullet ) mem_fun = main_ns.member_function('::btVector3::setX') ##print "setter:", property_recognizer_i (mem_fun) if len( mem_fun.arguments ) != 1: print 'False1' if not declarations.is_void( mem_fun.return_type ): print 'False2' if mem_fun.has_const: print 'False3' if mem_fun.overloads: print 'False4' print "OK" ########################################################################################## # # Creating the code. After this step you should not modify/customize declarations. # ########################################################################################## # # extractor = exdoc.doc_extractor( "Ogre" ) # # mb.build_code_creator (module_name='_ogre_' , doc_extractor= extractor ) extractor = exdoc.doc_extractor() # I'm excluding the UTFstring docs as lots about nothing mb.build_code_creator (module_name='_bullet_' , doc_extractor= extractor ) for inc in environment.bullet.include_dirs: mb.code_creator.user_defined_directories.append(inc ) mb.code_creator.user_defined_directories.append( environment.bullet.generated_dir ) mb.code_creator.replace_included_headers( customization_data.header_files( environment.bullet.version ) ) huge_classes = map( mb.class_, customization_data.huge_classes( environment.bullet.version ) ) mb.split_module(environment.bullet.generated_dir, huge_classes, use_files_sum_repository=False) ## now we need to ensure a series of headers and additional source files are ## copied to the generaated directory.. additional_files=[ os.path.join( os.path.abspath(os.path.dirname(__file__) ), 'python_bullet_masterlist.h' ) ] if environment.isLinux(): #sBulletDNAlen is defined in the cpp file not the header!! additional_files.append ( os.path.join( environment.Config.PATH_Bullet, 'src', 'LinearMath','btSerializer.cpp' ) ) for sourcefile in additional_files: p,filename = os.path.split(sourcefile) destfile = os.path.join(environment.bullet.generated_dir, filename ) if not common_utils.samefile( sourcefile ,destfile ): shutil.copy( sourcefile, environment.bullet.generated_dir ) print "Updated ", filename, "as it was missing or out of date"
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.ogrertshadersystem.root_dir, "python_ogrertshadersystem.h" ) , environment.ogrertshadersystem.cache_file ) defined_symbols = environment.defined_symbols defined_symbols .append('OGRE_RTSHADERSYSTEM_EXPORTS') defined_symbols.append( 'VERSION_' + environment.ogrertshadersystem.version ) # # 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.ogrertshadersystem.include_dirs , define_symbols=defined_symbols , indexing_suite_version=2 , cflags=environment.ogrertshadersystem.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 ) common_utils.AutoInclude ( mb, MAIN_NAMESPACE ) ManualInclude ( mb ) ManualExclude ( 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 ) #, special_vars=[] ) # # 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() ) # THIS MUST BE AFTER Auto_Functional_Transformation common_utils.Auto_Document( mb, MAIN_NAMESPACE ) ## add additional version information to the module to help identify it correctly common_utils.addDetailVersion ( mb, environment, environment.ogrertshadersystem ) ########################################################################################## # # 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='_ogrertshadersystem_' , doc_extractor= extractor ) for inc in environment.ogrertshadersystem.include_dirs: mb.code_creator.user_defined_directories.append(inc ) mb.code_creator.user_defined_directories.append( environment.ogrertshadersystem.generated_dir ) mb.code_creator.replace_included_headers( customization_data.header_files( environment.ogrertshadersystem.version ) ) huge_classes = map( mb.class_, customization_data.huge_classes( environment.ogrertshadersystem.version ) ) mb.split_module(environment.ogrertshadersystem.generated_dir, huge_classes, use_files_sum_repository=False) ## now we need to ensure a series of headers and additional source files are ## copied to the generated directory.. # common_utils.copyTree ( sourcePath = environment.Config.PATH_INCLUDE_ogrertshadersystem, # destPath = environment.ogrertshadersystem.generated_dir, # recursive=False ) if environment.ogre.version.startswith("1.7"): ## have a code generation issue that needs resolving... filesToFix=['CGProgramProcessor.pypp.cpp', 'GLSLProgramProcessor.pypp.cpp','HLSLProgramProcessor.pypp.cpp', 'ProgramProcessor.pypp.cpp', 'stdMapRTShaderParameterOperand.pypp.cpp', 'stdMapRTShaderParameterParameter.pypp.cpp', 'CGProgramProcessor.pypp.cpp'] for filename in filesToFix: fname = os.path.join( environment.ogrertshadersystem.generated_dir, filename) try: f = open(fname, 'r') buf = f.read() f.close() print "CHECKING:", fname if (" MEMCATEGORY_GENERAL" in buf) or ("<MEMCATEGORY_GENERAL" in buf): buf = buf.replace ( " MEMCATEGORY_GENERAL", " Ogre::MEMCATEGORY_GENERAL") buf = buf.replace ( "<MEMCATEGORY_GENERAL", "<Ogre::MEMCATEGORY_GENERAL") f = open ( fname, 'w+') f.write ( buf ) f.close() print "UGLY FIX OK:", fname except: print "ERROR: Unable to fix:", fname
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.raknet.root_dir, "python_raknet.h" ) , environment.raknet.cache_file ) if os.name == 'nt': defined_symbols = [ '_WIN32', '__PYTHONOGRE_BUILD_CODE', '_RELEASE', '_CRT_NONSTDC_NO_DEPRECATE', '_STDINT' ] # '_RAKNET_LIB' ]_RAKNET_DLL # added _STDINT to stop overlaps in defines from stdint.h else: defined_symbols = [ '__PYTHONOGRE_BUILD_CODE', '_RELEASE', '_CRT_NONSTDC_NO_DEPRECATE', '_STDINT' ] defined_symbols.append( 'VERSION_' + environment.raknet.version ) # # 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.raknet.include_dirs , define_symbols=defined_symbols , indexing_suite_version=2 , cflags=environment.raknet.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() ManualInclude ( mb ) common_utils.AutoExclude ( mb, MAIN_NAMESPACE ) ManualExclude ( mb ) common_utils.AutoInclude ( mb, MAIN_NAMESPACE ) # 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 ( main_ns ) # # 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() ) # THIS MUST BE AFTER Auto_Functional_Transformation common_utils.Auto_Document( mb, MAIN_NAMESPACE ) ## add additional version information to the module to help identify it correctly common_utils.addDetailVersion ( mb, environment, environment.raknet ) ########################################################################################## # # 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='_raknet_' , doc_extractor= extractor ) for inc in environment.raknet.include_dirs: mb.code_creator.user_defined_directories.append(inc ) mb.code_creator.user_defined_directories.append( environment.raknet.generated_dir ) mb.code_creator.replace_included_headers( customization_data.header_files( environment.raknet.version ) ) huge_classes = map( mb.class_, customization_data.huge_classes( environment.raknet.version ) ) mb.split_module(environment.raknet.generated_dir, huge_classes, use_files_sum_repository=False) ## now we need to ensure a series of headers and additional source files are ## copied to the generated directory.. # we could change raknet to be dll exported in raknet source but this would mean patching :(. # so instead we simply include the missing class in our own wrapper.. #additional_files=[ 'ReliabilityLayer.cpp','RakMemoryOverride.cpp','DataBlockEncryptor.cpp', # 'SocketLayer.cpp','rijndael.cpp', 'CheckSum.cpp','WSAStartupSingleton.cpp', 'RakPeer.cpp', # 'RakThread.cpp' ] additional_files=['ReliabilityLayer.cpp','RakMemoryOverride.cpp','CCRakNetUDT.cpp','SuperFastHash.cpp','RakNetTypes.cpp', 'CheckSum.cpp','Itoa.cpp','SocketLayer.cpp','WSAStartupSingleton.cpp', 'RakPeer.cpp'] for sourcefile in additional_files: sourcefile = os.path.join(environment.Config.PATH_INCLUDE_raknet, sourcefile ) p,filename = os.path.split(sourcefile) destfile = os.path.join(environment.raknet.generated_dir, filename ) if not common_utils.samefile( sourcefile ,destfile ): shutil.copy( sourcefile, environment.raknet.generated_dir ) print "Updated ", filename, "as it was missing or out of date"
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.watermesh.root_dir, "python_watermesh.h" ) , environment.watermesh.cache_file ) defined_symbols = ['OGRE_NONCLIENT_BUILD'] defined_symbols.append( 'VERSION_' + environment.watermesh.version ) # # 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.watermesh.include_dirs , define_symbols=defined_symbols , indexing_suite_version=2 , cflags=environment.watermesh.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.exclude() 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.watermesh ) ########################################################################################## # # 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='_watermesh_' , doc_extractor= extractor ) for inc in environment.watermesh.include_dirs: mb.code_creator.user_defined_directories.append(inc ) mb.code_creator.user_defined_directories.append( environment.watermesh.generated_dir ) mb.code_creator.replace_included_headers( customization_data.header_files( environment.watermesh.version ) ) huge_classes = map( mb.class_, customization_data.huge_classes( environment.watermesh.version ) ) mb.split_module(environment.watermesh.generated_dir, huge_classes, use_files_sum_repository=False) ## now we need to ensure a series of headers and additional source files are ## copied to the generated directory.. common_utils.copyTree ( sourcePath = environment.Config.PATH_watermesh, destPath = environment.watermesh.generated_dir, recursive=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)
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.noise.root_dir, "python_noise.h" ) , environment.noise.cache_file ) defined_symbols = [ 'OGRE_NONCLIENT_BUILD','__PYTHONOGRE_BUILD_CODE' ] if environment._USE_THREADS: defined_symbols.append('BOOST_HAS_THREADS') defined_symbols.append('BOOST_HAS_WINTHREADS') defined_symbols.append( 'VERSION_' + environment.noise.version ) # # 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.noise.include_dirs , define_symbols=defined_symbols , indexing_suite_version=2 , cflags=environment.noise.cflags ) # NOTE THE CHANGE HERE mb.constructors().allow_implicit_conversion = False mb.BOOST_PYTHON_MAX_ARITY = 25 mb.classes().always_expose_using_scope = True global_ns = mb.global_ns global_ns.exclude() for n in mb.global_ns.namespaces(): print n._name namespaces = ['noise', 'utils', 'model', 'module'] for n in namespaces: global_ns.namespace(n).include() common_utils.AutoExclude ( mb, n ) ## Manual Excludes global_ns.mem_fun('::noise::module::Terrace::GetControlPointArray').exclude() ## These generate "<<protected declaration>>\n" and compile fails global_ns.mem_fun('::noise::module::Curve::FindInsertionPos').exclude() global_ns.mem_fun('::noise::module::Curve::InsertAtPos').exclude() global_ns.mem_fun('::noise::module::RidgedMulti::CalcSpectralWeights').exclude() global_ns.mem_fun('::noise::module::Terrace::FindInsertionPos').exclude() global_ns.mem_fun('::noise::module::Terrace::InsertAtPos').exclude() global_ns.mem_fun('::noise::utils::WriterBMP::CalcWidthByteCount').exclude() global_ns.mem_fun('::noise::utils::WriterTER::CalcWidthByteCount').exclude() for n in namespaces: common_utils.AutoInclude ( mb, n) ManualInclude ( mb ) # here we fixup functions that expect to modifiy their 'passed' variables ManualTransformations ( mb ) for n in namespaces: AutoFixes ( mb, n ) ManualFixes ( mb ) ## namespaces namespaces = ['noise', 'model' , 'module', 'utils'] # # We need to tell boost how to handle calling (and returning from) certain functions # for ns in namespaces: common_utils.Set_DefaultCall_Policies (mb.global_ns.namespace(ns)) common_utils.Auto_Functional_Transformation ( mb.global_ns.namespace(ns) ) # # the manual stuff all done here !!! # hand_made_wrappers.apply( mb ) ## add properties to the 4 namespaces, in a conservative fashion for ns in namespaces: for cls in mb.global_ns.namespace(ns).classes(): 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.noise ) ########################################################################################## # # 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='_noise_' , doc_extractor= extractor ) for inc in environment.noise.include_dirs: mb.code_creator.user_defined_directories.append(inc ) mb.code_creator.user_defined_directories.append( environment.noise.generated_dir ) mb.code_creator.replace_included_headers( customization_data.header_files( environment.noise.version ) ) huge_classes = map( mb.class_, customization_data.huge_classes( environment.noise.version ) ) mb.split_module(environment.noise.generated_dir, huge_classes, use_files_sum_repository=False) ## now we need to ensure a series of headers and additional source files are ## copied to the generated directory.. common_utils.copyTree ( sourcePath = environment.Config.PATH_noise, destPath = environment.noise.generated_dir, recursive=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.ode.root_dir, "python_ode.h" ) , environment.ode.cache_file ) mb = module_builder.module_builder_t( [ xml_cached_fc ] , gccxml_path=environment.gccxml_bin , working_directory=environment.root_dir , include_paths=environment.ode.include_dirs , define_symbols=['ode_NONCLIENT_BUILD', 'ODE_LIB'] , indexing_suite_version=2 ) filter_declarations (mb) query = lambda decl: isinstance( decl, ( declarations.class_t, declarations.class_declaration_t ) ) \ and decl.name.startswith( 'dx' ) mb.global_ns.decls( query ).opaque = True # mb.global_ns.variable('dSpaceID').opaque=True # ## here we adjust for functions that return poiners to ODE "ID's", which are really C structs # ## I may have been over agressive in identifing these functions but hopefully not... # for func in mb.namespace( 'OgreOde' ).member_functions(): # if func.return_type.decl_string.endswith('ID'): # print "Setting ", func.name, "to Opaque" # func.opaque = True # func.call_policies = call_policies.return_value_policy( # call_policies.return_opaque_pointer ) mb.BOOST_PYTHON_MAX_ARITY = 25 mb.classes().always_expose_using_scope = True Set_Call_Policies (mb) AutoArrayArgs( mb ) ReturnReals( mb ) hand_made_wrappers.apply( mb ) ode_ns = mb.global_ns ## .namespace ('ode') common_utils.add_properties( ode_ns.classes() ) ## add additional version information to the module to help identify it correctly common_utils.addDetailVersion ( mb, environment, environment.ode ) #Creating code creator. After this step you should not modify/customize declarations. extractor = exdoc.doc_extractor("") mb.build_code_creator (module_name='_ode_' , doc_extractor= extractor) for inc in environment.ode.include_dirs: mb.code_creator.user_defined_directories.append(inc ) mb.code_creator.user_defined_directories.append( environment.ode.generated_dir ) mb.code_creator.replace_included_headers( customization_data.header_files(environment.ode.version) ) # # mb.code_creator.add_include( "__convenience.pypp.hpp" ) # # mb.code_creator.add_system_header( code_repository.convenience.file_name ) huge_classes = map( mb.class_, customization_data.huge_classes(environment.ode.version) ) mb.split_module(environment.ode.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' ) if not os.path.exists(return_pointee_value_source_path): return_pointee_value_source_path \ = os.path.join ( os.path.dirname(code_repository.__file__), 'return_pointee_value.hpp') if not os.path.exists(return_pointee_value_source_path): return_pointee_value_source_path \ = os.path.join ( os.getcwd(), 'return_pointee_value.hpp') return_pointee_value_target_path \ = os.path.join( environment.ode.generated_dir, 'return_pointee_value.hpp' ) if not os.path.exists( return_pointee_value_target_path ): shutil.copy( return_pointee_value_source_path, environment.ode.generated_dir )
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.physx.root_dir, "python_physx.h" ) , environment.physx.cache_file ) if os.name == 'nt': defined_symbols = ['NXPHYSICS_EXPORTS', 'WIN32', 'PHYSX_EXPORTS'] #'WIN32', else: defined_symbols = ['LINUX','NX_DISABLE_FLUIDS'] defined_symbols.append( 'VERSION_' + environment.physx.version ) defined_symbols.append ( '__PYTHONOGRE_BUILD_CODE' ) # # 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.physx.include_dirs , define_symbols=defined_symbols , indexing_suite_version=2 , cflags=environment.physx.cflags ) # NOTE THE CHANGE HERE 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() AutoInclude ( mb ) common_utils.AutoExclude ( mb, MAIN_NAMESPACE ) ManualExclude ( mb ) ManualInclude ( mb ) # here we fixup functions that expect to modifiy their 'passed' variables ManualTransformations ( mb ) AutoFixes ( mb ) ManualFixes ( mb ) # # We need to tell boost how to handle calling (and returning from) certain functions # common_utils.Set_DefaultCall_Policies ( mb.global_ns ) ignore=['mallocDEBUG', '::NxUserAllocator::mallocDEBUG' ,'NxUserAllocator::mallocDEBUG' ] common_utils.Auto_Functional_Transformation ( mb.global_ns, ignore_funs = ignore ) ## special_vars=['::Ogre::Real &','::Ogre::ushort &','size_t &'] ) # # the manual stuff all done here !!! # hand_made_wrappers.apply( mb ) NoPropClasses = [""] main_ns = global_ns 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.physx ) # for func in mb.global_ns.free_functions (): # if not func.ignore: # print "Free Func Included", func # print func.exportable, func.why_not_exportable() ########################################################################################## # # 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='_physx_' , doc_extractor= extractor ) for inc in environment.physx.include_dirs: mb.code_creator.user_defined_directories.append(inc ) mb.code_creator.user_defined_directories.append( environment.physx.generated_dir ) mb.code_creator.replace_included_headers( customization_data.header_files( environment.physx.version ) ) huge_classes = map( mb.class_, customization_data.huge_classes( environment.physx.version ) ) mb.split_module(environment.physx.generated_dir, huge_classes,use_files_sum_repository=False) ## now we need to ensure a series of headers and additional source files are ## copied to the generaated directory.. additional_files=['Stream.h', 'Stream.cpp', 'Joints.h', 'Joints.cpp'] for sourcefile in additional_files: sourcefile = os.path.join(environment.Config.PATH_INCLUDE_PhysX_Samples, sourcefile ) p,filename = os.path.split(sourcefile) destfile = os.path.join(environment.physx.generated_dir, filename ) if not common_utils.samefile( sourcefile ,destfile ): shutil.copy( sourcefile, environment.physx.generated_dir ) print "Updated ", filename, "as it was missing or out of date"
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_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.ogrepcz.root_dir, "python_ogrepcz.h" ) , environment.ogrepcz.cache_file ) defined_symbols = [ 'OGRE_NONCLIENT_BUILD', 'OGRE_GCC_VISIBILITY', 'OGRE_PCZPLUGIN_EXPORTS', '__PYTHONOGRE_BUILD_CODE'] defined_symbols.append( 'VERSION_' + environment.ogrepcz.version ) if environment._USE_THREADS: defined_symbols.append('BOOST_HAS_THREADS') defined_symbols.append('BOOST_HAS_WINTHREADS') # # 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.ogrepcz.include_dirs , define_symbols=defined_symbols , indexing_suite_version=2 , cflags=environment.ogrepcz.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() # # # # I'm assuming that any 'std' classes etc we need will have already been exposed by the Ogre library # # # std_ns = global_ns.namespace('std') # std_ns.include(already_exposed=True) # We don't include all of MAIN_NAMESPACE otherwise we get the same full wrapper # so instead we include classes with names that start with PCZ main_ns = global_ns.namespace( MAIN_NAMESPACE ) # # main_ns.include( already_exposed = True ) ## force the ogre class to be exposed as well... for c in main_ns.classes(): if c.name.startswith ('PCZ') or c.name.startswith ('PCPlane') or c.name.startswith ('Portal'): c.include() print "Including ", c, c.already_exposed for c in ['Portal','PCPlane']: main_ns.class_(c).include() print "Including ", c common_utils.AutoExclude ( mb, MAIN_NAMESPACE ) ManualInclude ( mb ) ManualExclude ( mb ) common_utils.AutoInclude ( mb, MAIN_NAMESPACE ) # 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.ogrepcz ) ########################################################################################## # # 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='_ogrepcz_' , doc_extractor= extractor ) for inc in environment.ogrepcz.include_dirs: mb.code_creator.user_defined_directories.append(inc ) mb.code_creator.user_defined_directories.append( environment.ogrepcz.generated_dir ) mb.code_creator.replace_included_headers( customization_data.header_files( environment.ogrepcz.version ) ) huge_classes = map( mb.class_, customization_data.huge_classes( environment.ogrepcz.version ) ) mb.split_module(environment.ogrepcz.generated_dir, huge_classes, use_files_sum_repository=False) ## now we need to ensure a series of headers and additional source files are ## copied to the generated directory.. # common_utils.copyTree ( sourcePath = environment.Config.PATH_INCLUDE_ogrepcz, # destPath = environment.ogrepcz.generated_dir, # recursive=False ) if environment.ogre.version.startswith("1.7"): ## have a code generation issue that needs resolving... filesToFix=['PCZoneFactoryManager.pypp.cpp'] for filename in filesToFix: fname = os.path.join( environment.ogrepcz.generated_dir, filename) try: f = open(fname, 'r') buf = f.read() f.close() buf = buf.replace ( " MEMCATEGORY_GENERAL", " Ogre::MEMCATEGORY_GENERAL") buf = buf.replace ( "<MEMCATEGORY_GENERAL", "<Ogre::MEMCATEGORY_GENERAL") f = open ( fname, 'w+') f.write ( buf ) f.close() print "UGLY FIX OK:", fname except: print "ERROR: Unable to fix:", fname
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 # # print "XXXXXXXXXXXX", environment.ogrevideoffmpeg.root_dir xml_cached_fc = parser.create_cached_source_fc( os.path.join( environment.ogrevideoffmpeg.root_dir, "python_ogrevideoffmpeg.h" ) , environment.ogrevideoffmpeg.cache_file ) defined_symbols = environment.defined_symbols defined_symbols.append( 'VERSION_' + environment.ogrevideoffmpeg.version ) # # 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.ogrevideoffmpeg.include_dirs , define_symbols=defined_symbols , indexing_suite_version=2 , cflags=environment.ogrevideoffmpeg.cflags ) # NOTE THE CHANGE HERE mb.constructors().allow_implicit_conversion = False mb.register_module_dependency ( environment.ogre.generated_dir ) 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() global_ns.class_('cVideoPlayer').include() main_ns = global_ns # .namespace( MAIN_NAMESPACE ) # # main_ns.include() AutoExclude ( mb ) ManualExclude ( mb ) AutoInclude ( mb ) ManualInclude ( mb ) # here we fixup functions that expect to modifiy their 'passed' variables ManualTransformations ( mb ) AutoFixes ( mb ) ManualFixes ( mb ) mb.global_ns.namespace ('Ogre').vars( 'ms_Singleton' ).disable_warnings( messages.W1035 ) #singleton pointers coming up we need to ignore # # We need to tell boost how to handle calling (and returning from) certain functions # Set_Call_Policies ( mb.global_ns) # .namespace (MAIN_NAMESPACE) ) Set_Call_Policies ( mb.global_ns.namespace ('Ogre') ) ## need this as we are forcing singleton classes # # 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.ogrevideoffmpeg ) ########################################################################################## # # Creating the code. After this step you should not modify/customize declarations. # ########################################################################################## #extractor = exdoc.doc_extractor("::Ogre") # I'm excluding the UTFstring docs as lots about nothing mb.build_code_creator (module_name='_ogrevideoffmpeg_' ) #, doc_extractor= extractor ) for inc in environment.ogrevideoffmpeg.include_dirs: mb.code_creator.user_defined_directories.append(inc ) mb.code_creator.user_defined_directories.append( environment.ogrevideoffmpeg.generated_dir ) mb.code_creator.replace_included_headers( customization_data.header_files( environment.ogrevideoffmpeg.version ) ) huge_classes = map( mb.class_, customization_data.huge_classes( environment.ogrevideoffmpeg.version ) ) mb.split_module(environment.ogrevideoffmpeg.generated_dir, huge_classes) ## now we need to ensure a series of headers and additional source files are ## copied to the generated directory.. additional_files = [] paths = [environment.Config.PATH_INCLUDE_ogrevideoffmpeg] for p in paths: additional_files = os.listdir(p) for f in additional_files: if f.endswith('cpp') or f.endswith('.h'): sourcefile = os.path.join(p, f) destfile = os.path.join(environment.ogrevideoffmpeg.generated_dir, f ) if not common_utils.samefile( sourcefile ,destfile ): shutil.copy( sourcefile, environment.ogrevideoffmpeg.generated_dir ) print "Updated ", f, "as it was missing or out of date"
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.plsm2.root_dir, "python_plsm2.h" ) , environment.plsm2.cache_file ) defined_symbols = [ '_MSC_VER' ,'_PLSM_OCTREE' ,'OGRE_NONCLIENT_BUILD' , 'OGRE_GCC_VISIBILITY' ,'__PYTHONOGRE_BUILD_CODE' ] defined_symbols.append( 'VERSION_' + environment.plsm2.version ) # threads not tested if environment._USE_THREADS: defined_symbols.append('BOOST_HAS_THREADS') defined_symbols.append('BOOST_HAS_WINTHREADS') # # 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.plsm2.include_dirs , define_symbols=defined_symbols , indexing_suite_version=2 , cflags=environment.plsm2.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() # # # # I'm assuming that any 'std' classes etc we need will have already been exposed by the Ogre library # # # some of the std classes we need haven't been exposed i.e ColourValue #std_ns = global_ns.namespace('std') #std_ns.include(already_exposed=True) # We don't include all of MAIN_NAMESPACE otherwise we get the same full wrapper # so instead we include classes with names that start with PCZ main_ns = global_ns.namespace( MAIN_NAMESPACE ) main_ns.include( already_exposed = True ) ## force the ogre class to be exposed as well... # We don't include all of MAIN_NAMESPACE otherwise we get the same full wrapper # so instead we include classes as follows: includes = [ 'PagingLandScape' ,'PagingLandscape' ,'MsgQueType' ,'distanceToBoxSort' ,'FrontToBackNodeSorterOperator' ,'LodTracker' ,'Occlusion' ,'OcclusionBoundingBox' ,'OcclusionElement' ,'OctreeSet' ,'PoolSet' ,'QuerySet' ,'RegisterCameraTraversal' ,'RenderLevel' ,'Traversal' ,'CHCTraversal' ,'SWTraversal' ,'TraversalConst' ,'UnregisterCameraTraversal' ,'ConstTraversalConst' ,'ViewFrustumCullingTraversal' ,'ViewFrustumCullingTraversalDirect' ,'VisibilityData' ,'CDRGNURBSSurface' ,'Point4D' ,'splinePoint' ] # temp hack to overcome problem with gccxml fast delegates taken from plsm samples includes.append('CustomPagingLandScapeListener') for c in main_ns.classes(): for i in includes: if c.name.startswith(i): print "Including Class: ", c c.include() # same for member functions includes = ['vectorToBoxDistance'] for f in main_ns.member_functions(): for i in includes: if f.name.startswith(i): print "Including Function: ", f f.include() # same for std namespace #includes = [ 'std::list< Ogre::SceneNode* >' # ,'std::vector< Ogre::ColourValue >' # ,'std::vector <Ogre::Real>' ] std_ns = global_ns.namespace('std') #for c in std_ns.classes(): # print "STDXX ", c.name #for c in std_ns.classes(): # for i in includes: # if c.name.startswith(i): # print "Including Std: ", c # c.include() # problem with colorvalue again #std_ns.class_('vector<Ogre::ColourValue, std::allocator<Ogre::ColourValue> >').exclude() #std_ns.class_('list<Ogre::PagingLandScapeData2D*, std::allocator<Ogre::PagingLandScapeData2D*> >').include() #std_ns.class_('list<Ogre::PagingLandScapeTile*, std::allocator<Ogre::PagingLandScapeTile*> >').include() #std_ns.class_('list<Ogre::PagingLandScapePage*, std::allocator<Ogre::PagingLandScapePage*> >').include() #std_ns.class_('list<Ogre::PagingLandScapeOctreeNode*, std::allocator<Ogre::PagingLandScapeOctreeNode*> >').include() stdex_ns = mb.global_ns.namespace("stdext") for cls in stdex_ns.classes(): print "STDEXT ", cls.name #cc=jj # same for enums includes = [ 'culling_modes' ,'Intersection' ,'Neighbor' ,'PageQueuingState' ,'PageState' ] for c in main_ns.enums(): for i in includes: if c.name.startswith(i): print "Including Enum: ", c c.include() # exclude nameless structures fixUnionStructs(mb) 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.plsm2 ) ########################################################################################## # # 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='_plsm2_' , doc_extractor= extractor ) for inc in environment.plsm2.include_dirs: mb.code_creator.user_defined_directories.append(inc ) mb.code_creator.user_defined_directories.append( environment.plsm2.generated_dir ) mb.code_creator.replace_included_headers( customization_data.header_files( environment.plsm2.version ) ) huge_classes = map( mb.class_, customization_data.huge_classes( environment.plsm2.version ) ) mb.split_module(environment.plsm2.generated_dir, huge_classes, use_files_sum_repository=False) ## now we need to ensure a series of headers and additional source files are ## copied to the generated directory.. common_utils.copyTree ( sourcePath = environment.Config.PATH_INCLUDE_plsm2, destPath = environment.plsm2.generated_dir, recursive=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.W1039 # , 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.theora.root_dir, "python_theora.h" ) , environment.theora.cache_file ) defined_symbols = [ 'THEORAVIDEO_PLUGIN_EXPORTS','OGRE_NONCLIENT_BUILD', 'OGRE_GCC_VISIBILITY','__PYTHONOGRE_BUILD_CODE'] if os.name == 'nt': defined_symbols.append ( 'WIN32' ) if environment._USE_THREADS: defined_symbols.append('BOOST_HAS_THREADS') defined_symbols.append('BOOST_HAS_WINTHREADS') defined_symbols.append( 'VERSION_' + environment.theora.version ) undefined_symbols = [] # # 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.theora.include_dirs , define_symbols=defined_symbols # # , undefine_symbols = undefined_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 ) # NOTE THE CHANGE HERE 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.exclude() ## Note we exclude so we don't get the ogre stuff AutoExclude ( mb ) AutoInclude ( mb ) ManualInclude ( mb ) ManualExclude ( mb ) # here we fixup functions that expect to modifiy their 'passed' variables ManualTransformations ( mb ) AutoFixes ( mb ) ManualFixes ( mb ) # # We need to tell boost how to handle calling (and returning from) certain functions # Set_Call_Policies ( mb.global_ns.namespace (MAIN_NAMESPACE) ) c = main_ns.class_('::Ogre::ExternalTextureSource' ).include(already_exposed=True) # # 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.theora ) ########################################################################################## # # Creating the code. After this step you should not modify/customize declarations. # ########################################################################################## extractor = exdoc.doc_extractor("") mb.build_code_creator (module_name='_theora_' , doc_extractor= extractor ) for inc in environment.theora.include_dirs: mb.code_creator.user_defined_directories.append(inc ) mb.code_creator.user_defined_directories.append( environment.theora.generated_dir ) mb.code_creator.replace_included_headers( customization_data.header_files( environment.theora.version ) ) huge_classes = map( mb.class_, customization_data.huge_classes( environment.theora.version ) ) mb.split_module(environment.theora.generated_dir, huge_classes,use_files_sum_repository=False) ## now we need to ensure a series of headers and additional source files are ## copied to the generaated directory.. additional_files=[ # os.path.join( environment.shared_ptr_dir, 'py_shared_ptr.h'), # # os.path.join( os.path.abspath(os.path.dirname(__file__) ), 'generators.h' ), # # os.path.join( os.path.abspath(os.path.dirname(__file__) ), 'custom_rvalue.cpp' ), # os.path.join( environment.include_dir, 'tuples.hpp' ) ] for sourcefile in additional_files: p,filename = os.path.split(sourcefile) destfile = os.path.join(environment.ogre.generated_dir, filename ) if not common_utils.samefile( sourcefile ,destfile ): shutil.copy( sourcefile, environment.ogre.generated_dir ) print "Updated ", filename, "as it was missing or out of date"
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.W1039 # , 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.nxogre.root_dir, "python_nxogre.h" ) , environment.nxogre.cache_file ) if os.name == 'nt': defined_symbols = [ '__PYTHONOGRE_BUILD_CODE','OGRE_NONCLIENT_BUILD', 'OGRE_GCC_VISIBILITY', 'WIN32', 'GCC_XML','NXOGRE_EXPORTS'] else: defined_symbols = [ '__PYTHONOGRE_BUILD_CODE','LINUX','NX_LINUX', 'NX_DISABLE_FLUIDS', 'OGRE_NONCLIENT_BUILD', 'OGRE_GCC_VISIBILITY', 'GCC_XML'] if environment._USE_THREADS: defined_symbols.append('BOOST_HAS_THREADS') defined_symbols.append('BOOST_HAS_WINTHREADS') defined_symbols.append( 'VERSION_' + environment.nxogre.version ) undefined_symbols = [] # # 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.nxogre.include_dirs , define_symbols=defined_symbols # # , undefine_symbols = undefined_symbols , indexing_suite_version=2 , cflags=environment.ogre.cflags ) # NOTE THE CHANGE HERE mb.constructors().allow_implicit_conversion = False ## This module depends on Ogre and physx mb.register_module_dependency ( environment.ogre.generated_dir ) mb.register_module_dependency ( environment.physx.generated_dir ) 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() AutoExclude ( mb ) ManualExclude ( mb ) AutoInclude ( mb ) ManualInclude ( mb ) # here we fixup functions that expect to modifiy their 'passed' variables common_utils.Auto_Functional_Transformation ( main_ns ) #, special_vars=['::Ogre::Real &','::Ogre::ushort &','size_t &'] ) ManualTransformations ( mb ) AutoFixes ( mb ) ManualFixes ( mb ) # # We need to tell boost how to handle calling (and returning from) certain functions # Set_Call_Policies ( mb.global_ns.namespace (MAIN_NAMESPACE) ) # # for op in main_ns.operators(): # # print "op1", op # # # if op.allow_implicit_conversion: # # # print "Implicit conversion on operator ", op # # print dir(op) # # for op in main_ns.constructors(): # # print "con1", op # # if op.allow_implicit_conversion: # # print "Implicit conversion on constructor ", op # # print dir(op) # # for op in main_ns.free_operators(): # # print "op2", op # # # if op.allow_implicit_conversion: # # # print "Implicit conversion on free operator ", op # # print dir(op) # # 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.nxogre ) ########################################################################################## # # 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='_nxogre_' , doc_extractor= extractor ) for inc in environment.nxogre.include_dirs: mb.code_creator.user_defined_directories.append(inc ) mb.code_creator.user_defined_directories.append( environment.nxogre.generated_dir ) mb.code_creator.replace_included_headers( customization_data.header_files( environment.nxogre.version ) ) huge_classes = map( mb.class_, customization_data.huge_classes( environment.nxogre.version ) ) mb.split_module(environment.nxogre.generated_dir, huge_classes,use_files_sum_repository=False) ## now we need to ensure a series of headers and additional source files are ## copied to the generaated directory.. common_utils.copyTree ( sourcePath = environment.Config.PATH_NxOgre, destPath = environment.nxogre.generated_dir, recursive=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 ) # # 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.ogreode.root_dir, "python_ogreode.h" ) , environment.ogreode.cache_file ) defined_symbols = ['OGRE_NONCLIENT_BUILD', 'ODE_LIB','__PYTHONOGRE_BUILD_CODE' ] defined_symbols.append( 'OGREODE_VERSION_' + environment.ogreode.version ) if environment._USE_THREADS: defined_symbols.append('BOOST_HAS_THREADS') defined_symbols.append('BOOST_HAS_WINTHREADS') # # 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.ogreode.include_dirs , define_symbols=defined_symbols , indexing_suite_version=2 , cflags=environment.ogreode.cflags ) # if this module depends on another set it here mb.register_module_dependency ( environment.ogre.generated_dir ) mb.register_module_dependency ( environment.ode.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() query = lambda decl: isinstance( decl, ( declarations.class_t, declarations.class_declaration_t ) ) \ and decl.name.startswith( 'dx' ) mb.global_ns.decls( query ).opaque = True for ns in MAIN_NAMESPACE: main_ns = global_ns.namespace( ns ) main_ns.include() common_utils.AutoExclude ( mb, ns ) common_utils.AutoInclude ( mb, ns ) ManualInclude ( mb, ns ) # here we fixup functions that expect to modifiy their 'passed' variables ManualTransformations ( mb, ns ) AutoFixes ( mb, ns ) ManualFixes ( mb, ns ) 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 ( ns ) ) ManualExclude ( mb ) #mb.global_ns.class_('::std::list<Ogre::Plane, Ogre::STLAllocator<Ogre::Plane, Ogre::CategorisedAllocPolicy<(Ogre::MemoryCategory)0> > >').include(already_exposed=True) try: mb.global_ns.class_('::std::list<Ogre::Plane, Ogre::STLAllocator<Ogre::Plane, Ogre::CategorisedAllocPolicy<(Ogre::MemoryCategory)0> > >').exclude() except: pass # # 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.ogreode ) for cls in global_ns.classes(): if not cls.ignore: print cls, cls.decl_string for cls in mb.global_ns.namespace("std").classes(): if not cls.ignore: print cls, cls.decl_string ########################################################################################## # # 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='_ogreode_' , doc_extractor= extractor ) for inc in environment.ogreode.include_dirs: mb.code_creator.user_defined_directories.append(inc ) mb.code_creator.user_defined_directories.append( environment.ogreode.generated_dir ) mb.code_creator.replace_included_headers( customization_data.header_files( environment.ogreode.version ) ) huge_classes = map( mb.class_, customization_data.huge_classes( environment.ogreode.version ) ) mb.split_module(environment.ogreode.generated_dir, huge_classes, use_files_sum_repository=False) if False: ## UGLY FIX ## we have a class that needs to be removed and for some reason py++ isn't doing it :( ## for f in ['StdListPlane.pypp.cpp','StdListPlane.pypp.hpp']: fname = os.path.join( environment.ogreode.generated_dir, f) os.remove ( fname ) #remove the extra files # now remove the entries for the stdlistplane class fname = os.path.join( environment.ogreode.generated_dir, '_ogreode_.main.cpp') f = open(fname, 'r') buf = f.readlines() f.close() newbuf =[] for line in buf: if ('stdlistplane' not in line ) and ('StdListPlane' not in line): newbuf.append(line) f = open ( fname, 'w+') f.writelines ( newbuf ) f.close()
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.particleuniverse.root_dir, "python_particleuniverse.h" ) , environment.particleuniverse.cache_file ) defined_symbols = [ 'OGRE_NONCLIENT_BUILD', 'OGRE_GCC_VISIBILITY' ,'PARTICLE_UNIVERSE_EXPORTS', '__PYTHONOGRE_BUILD_CODE' ] defined_symbols.append( 'VERSION_' + environment.particleuniverse.version ) if environment._USE_THREADS: defined_symbols.append('BOOST_HAS_THREADS') defined_symbols.append('BOOST_HAS_WINTHREADS') # # 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.particleuniverse.include_dirs , define_symbols=defined_symbols , indexing_suite_version=2 , cflags=environment.particleuniverse.cflags ) # 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() # if this module depends on another set it here -- we need to do this after the 'global' excludes as includes pulled from Ogre need to be considered mb.register_module_dependency ( environment.ogre.generated_dir ) print "AFTER LOAD" print mb.global_ns.class_("::Ogre::Compiler2Pass").already_exposed print mb.global_ns.class_("::Ogre::Compiler2Pass").ignore 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, special_vars=['::Ogre::Real &','::Ogre::ushort &','size_t &'] ) # # 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.particleuniverse ) ########################################################################################## # # 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='_particleuniverse_' , doc_extractor= extractor ) for inc in environment.particleuniverse.include_dirs: mb.code_creator.user_defined_directories.append(inc ) mb.code_creator.user_defined_directories.append( environment.particleuniverse.generated_dir ) mb.code_creator.replace_included_headers( customization_data.header_files( environment.particleuniverse.version ) ) print "1111", customization_data.header_files( environment.particleuniverse.version ) huge_classes = map( mb.class_, customization_data.huge_classes( environment.particleuniverse.version ) ) mb.split_module(environment.particleuniverse.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.W1039 # , 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.navi.root_dir, "python_navi.h" ) , environment.navi.cache_file ) defined_symbols = [ 'OGRE_NONCLIENT_BUILD', 'OGRE_GCC_VISIBILITY', 'NAVI_DYNAMIC_LIB', '__VECTOR_C','_WIN32'] if environment._USE_THREADS: defined_symbols.append('BOOST_HAS_THREADS') defined_symbols.append('BOOST_HAS_WINTHREADS') defined_symbols.append( 'VERSION_' + environment.navi.version ) undefined_symbols = [] # # 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.navi.include_dirs , define_symbols=defined_symbols , indexing_suite_version=2 , cflags=environment.navi.cflags # , undefine_symbols = undefined_symbols ) # NOTE THE CHANGE HERE mb.constructors().allow_implicit_conversion = False mb.register_module_dependency ( environment.ogre.generated_dir ) 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 and are not autmatically fixed ManualTransformations ( mb ) AutoFixes ( mb, MAIN_NAMESPACE ) ManualFixes ( mb ) common_utils.Auto_Functional_Transformation ( main_ns, special_vars=['::Ogre::Real &','::Ogre::ushort &','size_t &'] ) # # We need to tell boost how to handle calling (and returning from) certain functions # Set_Call_Policies ( mb.global_ns ) # # 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.navi ) ########################################################################################## # # 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='_navi_' , doc_extractor= extractor ) for inc in environment.navi.include_dirs: mb.code_creator.user_defined_directories.append(inc ) mb.code_creator.user_defined_directories.append( environment.navi.generated_dir ) mb.code_creator.replace_included_headers( customization_data.header_files( environment.navi.version ) ) huge_classes = map( mb.class_, customization_data.huge_classes( environment.navi.version ) ) mb.split_module(environment.navi.generated_dir, huge_classes,use_files_sum_repository=False) ## now we need to ensure a series of headers and additional source files are ## copied to the generaated directory.. additional_files = [] paths = [] for p in paths: additional_files = os.listdir(p) for f in additional_files: if f.endswith('cpp') or f.endswith('.h'): sourcefile = os.path.join(p, f) destfile = os.path.join(environment.navi.generated_dir, f ) if not common_utils.samefile( sourcefile ,destfile ): shutil.copy( sourcefile, environment.navi.generated_dir ) print "Updated ", f, "as it was missing or out of date"
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.ogreforests.root_dir, "python_forests.h"), environment.ogreforests.cache_file ) defined_symbols = ["OGRE_NONCLIENT_BUILD", "WIN32", "GCCXML_BUG", "__PYTHONOGRE_BUILD_CODE"] undefine_symbols = [] if environment._USE_THREADS: defined_symbols.append("BOOST_HAS_THREADS") defined_symbols.append("BOOST_HAS_WINTHREADS") defined_symbols.append("VERSION_" + environment.ogreforests.version) # # 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.ogreforests.include_dirs, define_symbols=defined_symbols, indexing_suite_version=2, cflags=environment.ogreforests.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.register_module_dependency(environment.ogre.generated_dir) 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 and are not autmatically fixed ManualTransformations(mb) AutoFixes(mb, MAIN_NAMESPACE) ManualFixes(mb) common_utils.Auto_Functional_Transformation(main_ns) common_utils.Auto_Document(mb, MAIN_NAMESPACE) ## note change to clear prefix_output as this will force all transforms to be inout (and not 'output') to ensure the arguments are matched ## problem with overload virtual fuctions from parent class such as getMetrics in RenderWindow and RenderTarget common_utils.Auto_Functional_Transformation( main_ns ) ##, special_vars=['::Ogre::Real &','::Ogre::ushort &','size_t &'] ) # # We need to tell boost how to handle calling (and returning from) certain functions # common_utils.Set_DefaultCall_Policies(main_ns) for c in main_ns.classes(): print "CLass", c # # 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.ogreforests) ########################################################################################## # # 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="_ogreforests_", doc_extractor=extractor) for inc in environment.ogreforests.include_dirs: mb.code_creator.user_defined_directories.append(inc) mb.code_creator.user_defined_directories.append(environment.ogreforests.generated_dir) mb.code_creator.replace_included_headers(customization_data.header_files(environment.ogreforests.version)) huge_classes = map(mb.class_, customization_data.huge_classes(environment.ogreforests.version)) mb.split_module(environment.ogreforests.generated_dir, huge_classes, use_files_sum_repository=False) ## now we need to ensure a series of headers and additional source files are ## copied to the generated directory.. common_utils.copyTree( sourcePath=environment.Config.PATH_INCLUDE_ogreforests, destPath=environment.ogreforests.generated_dir, recursive=False, )