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.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.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(): 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.ogresdksample.root_dir, "python_ogresdksample.h" ) , environment.ogresdksample.cache_file ) defined_symbols = environment.defined_symbols defined_symbols.append( 'VERSION_' + environment.ogresdksample.version ) print environment.ogresdksample.include_dirs # # 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.ogresdksample.include_dirs , define_symbols=defined_symbols , indexing_suite_version=2 , cflags=environment.ogresdksample.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 ) #, special_vars=[] ) FindProtectedVars ( mb ) # # 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.ogresdksample ) ########################################################################################## # # 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='_ogresdksample_' , doc_extractor= extractor ) for inc in environment.ogresdksample.include_dirs: mb.code_creator.user_defined_directories.append(inc ) mb.code_creator.user_defined_directories.append( environment.ogresdksample.generated_dir ) mb.code_creator.replace_included_headers( customization_data.header_files( environment.ogresdksample.version ) ) huge_classes = map( mb.class_, customization_data.huge_classes( environment.ogresdksample.version ) ) mb.split_module(environment.ogresdksample.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.. # files = os.listdir( environment.Config.PATH_INCLUDE_sdksample ) # files_filtered = [] # for f in files: # if f.startswith ("Sample") or f.startswith ("FileSystem"): # files_filtered.append (f) # print files_filtered common_utils.copyTree ( sourcePath = environment.Config.PATH_INCLUDE_sdksample, destPath = environment.ogresdksample.generated_dir, recursive=False, extensions=['h'] ) # need the actual implementation file if environment.isWindows(): fileToCopy = ['FileSystemLayerImpl_WIN32.cpp'] elif environment.isLinux(): fileToCopy = ['FileSystemLayerImpl_Unix.cpp'] common_utils.copyTree ( sourcePath = environment.Config.PATH_INCLUDE_sdksample, destPath = environment.ogresdksample.generated_dir, recursive=False, files_in= fileToCopy ) if environment.ogre.version.startswith("1.7"): ## have a code generation issue that needs resolving... filesToFix=['SdkTrayManager.pypp.cpp'] for filename in filesToFix: fname = os.path.join( environment.ogresdksample.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.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 # ) # # 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.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, )