Beispiel #1
0
    def __init__(self, xmlNode=None, confType='Configuration'):
        '''字符串类型的变量都是以分号分割的字符串'''
        self.includePath = ''  # 分号分割的字符串
        self.compileOptions = ''  # 这是 C++ 的编译选项
        self.linkOptions = ''
        self.libs = ''  # 分号分割的字符串
        self.libPath = ''  # 分号分割的字符
        self.preprocessor = ''  # 分号分割的字符
        self.resCompileOptions = ''
        self.resCompileIncludePath = ''
        self.cCompileOptions = ''
        self.confType = confType  # xml node name
        # added on 2012-10-06
        self.cCxxCmplOpts = ''  # 同时用于 C 和 C++ 的编译选项

        if xmlNode:
            # 读取编译器设置
            compilerNode = XmlUtils.FindFirstByTagName(xmlNode, 'Compiler')
            if compilerNode:
                self.compileOptions = compilerNode.getAttribute('Options')\
                        .encode('utf-8')
                self.cCompileOptions = compilerNode.getAttribute('C_Options')\
                        .encode('utf-8')
                if compilerNode.hasAttribute('C_Cpp_Options'):  # 同时用于 C/C++
                    self.cCxxCmplOpts = compilerNode.getAttribute('C_Cpp_Options')\
                            .encode('utf-8')
                #if not self.cCompileOptions:
                # the attribute "C_Options" does not exist,
                # copy the values from the "Options" attribute
                # 只有这个属性不存在时才复制值, python 的实现不需要如此处理
                #self.cCompileOptions = self.compileOptions

                li1 = []
                li2 = []
                for i in compilerNode.childNodes:
                    if i.nodeName == 'IncludePath':
                        li1.append(XmlUtils.ReadString(i, 'Value'))
                    elif i.nodeName == 'Preprocessor':
                        li2.append(XmlUtils.ReadString(i, 'Value'))
                self.includePath = JoinToSmclStr(li1)
                self.preprocessor = JoinToSmclStr(li2)

            # 读取链接器设置
            linkerNode = XmlUtils.FindFirstByTagName(xmlNode, 'Linker')
            if linkerNode:
                self.linkOptions = XmlUtils.ReadString(linkerNode, 'Options')
                li1 = []
                li2 = []
                for i in linkerNode.childNodes:
                    if i.nodeName == 'Library':
                        li1.append(XmlUtils.ReadString(i, 'Value'))
                    elif i.nodeName == 'LibraryPath':
                        li2.append(XmlUtils.ReadString(i, 'Value'))
                self.libs = JoinToSmclStr(li1)
                self.libPath = JoinToSmclStr(li2)

            # 读取资源编译器设置
            resCmpNode = XmlUtils.FindFirstByTagName(xmlNode,
                                                     'ResourceCompiler')
            if resCmpNode:
                self.resCompileOptions = XmlUtils.ReadString(
                    resCmpNode, 'Options')
                li1 = []
                for i in resCmpNode.childNodes:
                    if i.nodeName == 'IncludePath':
                        li1.append(XmlUtils.ReadString(i, 'Value'))
                self.resCompileIncludePath = JoinToSmclStr(li1)
        else:
            if self.includePath:
                self.includePath += ';.'
            else:
                self.includePath += '.'
            if self.libPath:
                self.libPath += ';.'
            else:
                self.libPath += '.'
Beispiel #2
0
 def SetResCmpIncludePath(self, paths):
     if type(paths) == type([]):
         self.resCompileIncludePath = JoinToSmclStr(paths)
     else:
         self.resCompileIncludePath = paths
Beispiel #3
0
 def SetLibPath(self, paths):
     if type(paths) == type([]):
         self.libPath == JoinToSmclStr(paths)
     else:
         self.libPath = paths
Beispiel #4
0
 def SetLibraries(self, libs):
     if type(libs) == type([]):
         self.libs = JoinToSmclStr(libs)
     else:
         self.libs = libs
Beispiel #5
0
 def SetIncludePath(self, paths):
     if type(paths) == type([]):
         self.includePath = JoinToSmclStr(paths)
     else:
         self.includePath = paths
Beispiel #6
0
 def SetPreprocessor(self, prepr):
     if type(prepr) == type([]):
         self.preprocessor = JoinToSmclStr(prepr)
     else:
         self.preprocessor = prepr