Fixed path issue in UVPROJXProject.

This commit is contained in:
cylon 2016-09-06 18:11:16 +02:00
parent 056f1ba35f
commit 57d45f6bad
2 changed files with 25 additions and 10 deletions

View File

@ -49,17 +49,16 @@ class CMake (object):
for inc in self.project['incs']: for inc in self.project['incs']:
cmake['incs'].append(inc) cmake['incs'].append(inc)
cmake['srcs'] = [] cmake['srcs'] = []
srcs = []
i=0 i=0
for src in self.project['srcs']:
s = os.path.dirname(src)
if len(s) and s not in srcs:
srcs.append(s)
cmake['srcs'].append({'path': s,'var':'DIR_SRC' + str(i)})
i = i+1
cmake['files']=[] cmake['files']=[]
for file in self.project['srcs']:
if file.endswith('.c') or file.endswith('.h'):
cmake['files'].append({'path': file,'var':'SRC_FILE' + str(i)})
i = i+1
for file in self.project['files']: for file in self.project['files']:
cmake['files'].append({'path': file,'var':'SRC_FILE' + str(i)}) cmake['files'].append({'path': file,'var':'SRC_FILE' + str(i)})
i = i+1 i = i+1

View File

@ -28,10 +28,26 @@ class UVPROJXProject (object):
if hasattr(element,'Files'): if hasattr(element,'Files'):
for file in element.Files.getchildren(): for file in element.Files.getchildren():
if not str(file.FilePath.text).endswith('.s'): if not str(file.FilePath.text).endswith('.s'):
self.project['srcs'].append(str(file.FilePath.text).replace('..', self.path)) s = str(file.FilePath.text)
if os.path.sep not in s:
if os.path.sep == '\\':
s = s.replace('/','\\')
elif os.path.sep == '/':
s = s.replace('\\','/')
self.project['srcs'].append(s.replace('..', self.path,1))
for i in range(0, len(self.project['incs'])): for i in range(0, len(self.project['incs'])):
self.project['incs'][i] = self.project['incs'][i].replace('..', self.path) s = str(self.project['incs'][i])
if os.path.sep not in s:
if os.path.sep == '\\':
s = s.replace('/','\\')
elif os.path.sep == '/':
s = s.replace('\\','/')
self.project['incs'][i] = s.replace('..', self.path,1)
self.project['files']=[] self.project['files']=[]
@ -49,7 +65,7 @@ class UVPROJXProject (object):
print ('Project chip:' + self.project['chip']) print ('Project chip:' + self.project['chip'])
print ('Project includes: ' + ' '.join(self.project['incs'])) print ('Project includes: ' + ' '.join(self.project['incs']))
print ('Project defines: ' + ' '.join(self.project['defs'])) print ('Project defines: ' + ' '.join(self.project['defs']))
print ('Project srcs: ' + ' '.join(self.project['defs'])) print ('Project srcs: ' + ' '.join(self.project['srcs']))
print ('Project: ' + self.project['mems']) print ('Project: ' + self.project['mems'])
def getProject(self): def getProject(self):