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.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.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.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_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(): if 0: 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.ogreterrain.root_dir, "python_ogreterrain.h" ) , environment.ogreterrain.cache_file ) defined_symbols = environment.defined_symbols defined_symbols.append( 'OGRE_TERRAIN_EXPORTS' ) defined_symbols.append( 'VERSION_' + environment.ogreterrain.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.ogreterrain.include_dirs , define_symbols=defined_symbols , indexing_suite_version=2 , cflags=environment.ogreterrain.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 ) 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=['::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() ) # 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.ogreterrain ) ########################################################################################## # # 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='_ogreterrain_' , doc_extractor= extractor ) for inc in environment.ogreterrain.include_dirs: mb.code_creator.user_defined_directories.append(inc ) mb.code_creator.user_defined_directories.append( environment.ogreterrain.generated_dir ) mb.code_creator.replace_included_headers( customization_data.header_files( environment.ogreterrain.version ) ) huge_classes = map( mb.class_, customization_data.huge_classes( environment.ogreterrain.version ) ) mb.split_module(environment.ogreterrain.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.. additional_files=[ os.path.join( environment.ogre.generated_dir, 'generators.h' ), os.path.join( environment.include_dir, 'tuples.hpp' ) ] for sourcefile in additional_files: p,filename = os.path.split(sourcefile) destfile = os.path.join(environment.ogreterrain.generated_dir, filename ) if not common_utils.samefile( sourcefile ,destfile ): shutil.copy( sourcefile, environment.ogreterrain.generated_dir ) print "Updated ", filename, "as it was missing or out of date" # common_utils.copyTree ( sourcePath = environment.Config.PATH_INCLUDE_ogreterrain, # destPath = environment.ogreterrain.generated_dir, # recursive=False ) if environment.ogre.version.startswith("1.7"): ## have a code generation issue that needs resolving... filesToFix=['TerrainGroup.pypp.cpp', 'stdVectorOgreTerrain.pypp.cpp'] for filename in filesToFix: fname = os.path.join( environment.ogreterrain.generated_dir, filename) try: f = open(fname, 'r') buf = f.read() f.close() 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.caelum.root_dir, "python_caelum.h" ) , environment.caelum.cache_file ) defined_symbols = [ 'OGRE_NONCLIENT_BUILD','__PYTHONOGRE_BUILD_CODE' ] defined_symbols.append( 'VERSION_' + environment.caelum.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.caelum.include_dirs , define_symbols=defined_symbols , indexing_suite_version=2 , cflags=environment.caelum.cflags ) # if this module depends on another set it here mb.register_module_dependency ( environment.ogre.generated_dir ) # normally implicit conversions work OK, however they can cause strange things to happen so safer to leave off # # mb.constructors().allow_implicit_conversion = False mb.BOOST_PYTHON_MAX_ARITY = 25 mb.classes().always_expose_using_scope = True # # We filter (both include and exclude) specific classes and functions that we want to wrap # global_ns = mb.global_ns global_ns.exclude() main_ns = global_ns.namespace( MAIN_NAMESPACE ) main_ns.include() common_utils.AutoExclude ( mb, MAIN_NAMESPACE ) ManualExclude ( mb ) common_utils.AutoInclude ( mb, MAIN_NAMESPACE ) ManualInclude ( mb ) # here we fixup functions that expect to modifiy their 'passed' variables ManualTransformations ( mb ) AutoFixes ( mb, MAIN_NAMESPACE ) ManualFixes ( mb ) common_utils.Auto_Functional_Transformation ( main_ns ) # # We need to tell boost how to handle calling (and returning from) certain functions # common_utils.Set_DefaultCall_Policies ( mb.global_ns.namespace ( MAIN_NAMESPACE ) ) # # the manual stuff all done here !!! # hand_made_wrappers.apply( mb ) NoPropClasses = [""] for cls in main_ns.classes(): if cls.name not in NoPropClasses: cls.add_properties( recognizer=ogre_properties.ogre_property_recognizer_t() ) ## add additional version information to the module to help identify it correctly common_utils.addDetailVersion ( mb, environment, environment.caelum ) ########################################################################################## # # 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='_caelum_' , doc_extractor= extractor ) for inc in environment.caelum.include_dirs: mb.code_creator.user_defined_directories.append(inc ) mb.code_creator.user_defined_directories.append( environment.caelum.generated_dir ) mb.code_creator.replace_included_headers( customization_data.header_files( environment.caelum.version ) ) huge_classes = map( mb.class_, customization_data.huge_classes( environment.caelum.version ) ) mb.split_module(environment.caelum.generated_dir, huge_classes, use_files_sum_repository=False) additional_dirs=[ [environment.Config.PATH_caelum, '.'], ] for d,dd in additional_dirs: for f in os.listdir(d): if f.endswith('cpp') or f.endswith('.h'): sourcefile = os.path.join(d, f) destfile = os.path.join(environment.caelum.generated_dir, dd, f ) if not os.path.exists ( os.path.join(environment.caelum.generated_dir, dd ) ): os.mkdir ( os.path.join(environment.caelum.generated_dir, dd ) ) if not common_utils.samefile( sourcefile ,destfile ): shutil.copy( sourcefile, destfile ) 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.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(): 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"