2
# python 2.6 required (for os.path.relpath)
4
# Replace absolute paths with relative
5
# goes through recursively from ../release directory
9
directories_release = ['..\solution_directx', '..\solution_ogre', '..\solution_opengl']
15
def findChar(line, character, frompos):
16
pos = line.find(character, frompos)
21
def replaceAbsolutePaths(fileName):
23
print "Converting " + fileName
24
file = open(fileName,"r")
26
relpath = os.path.relpath(dir_sources, currentFolder)
27
relpath = relpath.replace('\\','/')
28
#print "Current folder: " + currentFolder
29
#print "Relative path: " + relpath
30
#print "dir_sources: " + dir_sources
31
#print os.path.join(currentFolder, relpath)
33
# trackPrint used for debug only
37
trackFile = open("trackedLine.txt","w")
38
trackFile.write("original :" + line)
40
line = file.readline()
44
if (line.find(dir_sources.replace('/','\\')) != -1):
46
line = line.replace('\\','/')
48
trackFile.write("replace \\:" + line)
49
pos = line.find(dir_sources)
51
#print "Line changed: " + line.lstrip()
52
rpos1 = findChar(line,"\"", pos)
53
rpos2 = findChar(line,"<", pos)
54
rpos3 = findChar(line,";", pos)
55
rpos = min(rpos1, min(rpos2, rpos3))
56
path = line[pos : rpos] #.replace('\\','/')
57
relpath = os.path.relpath(path, currentFolder).replace('\\','/')
58
#print path + " | " + relpath
61
trackFile.write("relpath :" + relpath + "\n")
64
relpath = relpath.replace('/','\\')
65
line = line.replace(path, relpath, 1)
68
trackFile.write("relpath \\:" + relpath + "\n")
69
trackFile.write("line unrel" + line)
71
#print "to next line: " + line.lstrip()
73
pos = line.find(dir_sources)
75
line = line.replace("C:/MYGUIHACK ", "$(")
76
line = line.replace("C:\\MYGUIHACK ", "$(")
77
line = line.replace(" MYGUIBRACKETHACK", ")")
79
if (line.find("cmake.exe") != -1 and line.find("CommandLine") != -1):
80
lpos = line.find("\"", 0)
81
rpos = line.find("\"", lpos + 1)
83
trackFile.write("Remove cmake.exe: " + line)
84
trackFile.write(" lines: " + str(lpos) + " " + str(rpos) + "\n")
85
trackFile.write(" replaced: " + line.replace(line[lpos + 1 : rpos], ""))
86
line = line.replace(line[lpos + 1 : rpos], "")
89
alllines.append( line )
90
line = file.readline()
95
file = open(fileName,"w")
96
#file = open(fileName + ".txt","w")
97
file.writelines(alllines)
102
def isIgnoredProject(name):
103
#ignores = ["api-docs", "INSTALL", "ALL_BUILD", "ZERO_CHECK", "PACKAGE"]
105
for ignore in ignores:
106
if name.startswith(ignore):
108
if name.endswith(".cmake") or name.endswith("tmp"):
114
dir_sources = os.path.realpath(dir_sources)
115
dir_sources = dir_sources.replace('\\','/')
118
for dir_release in directories_release:
120
os.system("mkdir " + dir_release)
121
os.chdir(dir_release)
122
os.system("cmake ../ -DMYGUI_RENDERSYSTEM=" + str(index) + " -DMYGUI_BUILD_UNITTESTS=True -DMYGUI_BUILD_WRAPPER=True -DMYGUI_STANDALONE_BUILD=True -DMYGUI_BUILD_DOCS=True")
123
os.chdir("../Scripts")
124
for root, dirs, files in os.walk(dir_release):
126
if not isIgnoredProject(name):
128
f_src = os.path.join(root, name)
129
f_src = f_src.replace('\\','/')
130
currentFolder = os.path.realpath(f_src)
131
currentFolder = currentFolder.replace(name, "")
132
currentFolder = currentFolder.replace('\\','/')
133
replaceAbsolutePaths(f_src)
2
# python 2.6 required (for os.path.relpath)
4
# Replace absolute paths with relative
5
# goes through recursively from ../release directory
9
directories_release = ['..\solution_directx', '..\solution_ogre', '..\solution_opengl']
15
def findChar(line, character, frompos):
16
pos = line.find(character, frompos)
21
def replaceAbsolutePaths(fileName):
23
print "Converting " + fileName
24
file = open(fileName,"r")
26
relpath = os.path.relpath(dir_sources, currentFolder)
27
relpath = relpath.replace('\\','/')
28
#print "Current folder: " + currentFolder
29
#print "Relative path: " + relpath
30
#print "dir_sources: " + dir_sources
31
#print os.path.join(currentFolder, relpath)
33
# trackPrint used for debug only
37
trackFile = open("trackedLine.txt","w")
38
trackFile.write("original :" + line)
40
line = file.readline()
44
if (line.find(dir_sources.replace('/','\\')) != -1):
46
line = line.replace('\\','/')
48
trackFile.write("replace \\:" + line)
49
pos = line.find(dir_sources)
51
#print "Line changed: " + line.lstrip()
52
rpos1 = findChar(line,"\"", pos)
53
rpos2 = findChar(line,"<", pos)
54
rpos3 = findChar(line,";", pos)
55
rpos = min(rpos1, min(rpos2, rpos3))
56
path = line[pos : rpos] #.replace('\\','/')
57
relpath = os.path.relpath(path, currentFolder).replace('\\','/')
58
#print path + " | " + relpath
61
trackFile.write("relpath :" + relpath + "\n")
64
relpath = relpath.replace('/','\\')
65
line = line.replace(path, relpath, 1)
68
trackFile.write("relpath \\:" + relpath + "\n")
69
trackFile.write("line unrel" + line)
71
#print "to next line: " + line.lstrip()
73
pos = line.find(dir_sources)
75
line = line.replace("C:/MYGUIHACK ", "$(")
76
line = line.replace("C:\\MYGUIHACK ", "$(")
77
line = line.replace(" MYGUIBRACKETHACK", ")")
79
if (line.find("cmake.exe") != -1 and line.find("CommandLine") != -1):
80
lpos = line.find("\"", 0)
81
rpos = line.find("\"", lpos + 1)
83
trackFile.write("Remove cmake.exe: " + line)
84
trackFile.write(" lines: " + str(lpos) + " " + str(rpos) + "\n")
85
trackFile.write(" replaced: " + line.replace(line[lpos + 1 : rpos], ""))
86
line = line.replace(line[lpos + 1 : rpos], "")
89
alllines.append( line )
90
line = file.readline()
95
file = open(fileName,"w")
96
#file = open(fileName + ".txt","w")
97
file.writelines(alllines)
102
def isIgnoredProject(name):
103
#ignores = ["api-docs", "INSTALL", "ALL_BUILD", "ZERO_CHECK", "PACKAGE"]
105
for ignore in ignores:
106
if name.startswith(ignore):
108
if name.endswith(".cmake") or name.endswith("tmp"):
114
dir_sources = os.path.realpath(dir_sources)
115
dir_sources = dir_sources.replace('\\','/')
118
for dir_release in directories_release:
120
os.system("mkdir " + dir_release)
121
os.chdir(dir_release)
122
os.system("cmake ../ -DMYGUI_RENDERSYSTEM=" + str(index) + " -DMYGUI_BUILD_UNITTESTS=True -DMYGUI_BUILD_WRAPPER=True -DMYGUI_STANDALONE_BUILD=True -DMYGUI_BUILD_DOCS=True")
123
os.chdir("../Scripts")
124
for root, dirs, files in os.walk(dir_release):
126
if not isIgnoredProject(name):
128
f_src = os.path.join(root, name)
129
f_src = f_src.replace('\\','/')
130
currentFolder = os.path.realpath(f_src)
131
currentFolder = currentFolder.replace(name, "")
132
currentFolder = currentFolder.replace('\\','/')
133
replaceAbsolutePaths(f_src)
b'\\ No newline at end of file'