mirror of
https://github.com/phodina/ProjectConverter.git
synced 2026-04-30 19:09:16 +08:00
Fixed path issue in UVPROJXProject.
This commit is contained in:
parent
056f1ba35f
commit
57d45f6bad
13
cmake.py
13
cmake.py
@ -49,17 +49,16 @@ class CMake (object):
|
||||
for inc in self.project['incs']:
|
||||
cmake['incs'].append(inc)
|
||||
cmake['srcs'] = []
|
||||
srcs = []
|
||||
|
||||
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']=[]
|
||||
|
||||
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']:
|
||||
cmake['files'].append({'path': file,'var':'SRC_FILE' + str(i)})
|
||||
i = i+1
|
||||
|
||||
@ -28,10 +28,26 @@ class UVPROJXProject (object):
|
||||
if hasattr(element,'Files'):
|
||||
for file in element.Files.getchildren():
|
||||
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'])):
|
||||
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']=[]
|
||||
@ -49,7 +65,7 @@ class UVPROJXProject (object):
|
||||
print ('Project chip:' + self.project['chip'])
|
||||
print ('Project includes: ' + ' '.join(self.project['incs']))
|
||||
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'])
|
||||
|
||||
def getProject(self):
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user