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'] # defined_symbols.append( 'VERSION_' + environment.bullet.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.bullet.include_dirs , define_symbols=defined_symbols , indexing_suite_version=2 , cflags=environment.bullet.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 ) AutoExclude ( mb ) 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 # Set_Call_Policies ( mb.global_ns ) # # 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() ) common_utils.add_constants( mb, { 'bullet_version' : '"%s"' % environment.bullet.version.replace("\n", "\\\n") , 'python_version' : '"%s"' % sys.version.replace("\n", "\\\n" ) } ) ## need to create a welcome doc string for this... common_utils.add_constants( mb, { '__doc__' : '"bullet DESCRIPTION"' } ) ########################################################################################## # # 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='_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)
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_09.root_dir, "python_nxogre.h" ) , environment.nxogre_09.cache_file ) if os.name == 'nt': defined_symbols = [ 'NxExport','OGRE_NONCLIENT_BUILD', 'OGRE_GCC_VISIBILITY', 'WIN32', 'GCC_XML']#NXOGRE_EXPORTS' else: defined_symbols = [ '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_09.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_09.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() ) common_utils.add_constants( mb, { 'PROJECT_version' : '"%s"' % environment.nxogre_09.version.replace("\n", "\\\n") , 'python_version' : '"%s"' % sys.version.replace("\n", "\\\n" ) } ) ## need to create a welcome doc string for this... common_utils.add_constants( mb, { '__doc__' : '"NxOgre 0.9 PROJECT DESCRIPTION"' } ) ########################################################################################## # # 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_09_' , doc_extractor= extractor ) for inc in environment.nxogre_09.include_dirs: mb.code_creator.user_defined_directories.append(inc ) mb.code_creator.user_defined_directories.append( environment.nxogre_09.generated_dir ) mb.code_creator.replace_included_headers( customization_data.header_files( environment.nxogre_09.version ) ) huge_classes = map( mb.class_, customization_data.huge_classes( environment.nxogre_09.version ) ) mb.split_module(environment.nxogre_09.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_09, destPath = environment.nxogre_09.generated_dir, recursive=False )