ofProject script request

It seems that the ofProject script for generating codeblocks projects doesn’t take into account the “os” attribute for the include files section. While normal header files are generally cross-platform, I came across a case where libsndfile generates certain #defines in its main header file through the configure script, making that header not compatible with other platforms.
It would be nice to be therefore able to specify “os” attributes for includes…and maybe even for all tags, if this is not the case. thanks!

I’m no good at python, but I managed to figure it out :slight_smile:
What this enables is an “os” attribute for include paths in the install.xml file.
EDIT: I’ve attached the file in case the formatting gets lost in the post
Just replace the code in ofxDescriptor.py with this:

  
  
import sys  
import amara  
from ofEnvironment import of_platform  
class ofxDescriptor:  
    """Abstraction of an addon install.xml file"""  
    def __init__(self,name):  
        self.name=name  
         
        self.doc = amara.parse(name)  
  
    def _get_includes(self):  
		try:  
			includes=[]  
			for path in self.doc.install.add.include.path:  
				if hasattr(path,"os"):  
					if str(path.os) == of_platform:  
						includes.append(path)  
				else:  
					includes.append(path) #add if no os tag is present  
			return includes  
		except:  
			return []  
			  
    includePaths = property(  
	    fget = _get_includes  
        #fget = lambda self: self.doc.install.add.include.path  
    )  
  
    def _get_libraries(self):  
        try:  
            libs=[]  
            for lib in self.doc.install.add.link.lib:  
                if hasattr(lib,"os"):  
                    if str(lib.os) == of_platform:  
                        libs.append(lib)  
            return libs  
                       
        except:  
            return []  
              
    libraries = property(  
        fget = _get_libraries  
    )  
           
    folders = property(  
        fget = lambda self: self.doc.install.add.src.folder  
    )  

ofxDescriptor.py.zip