24 copy "%RTM_ROOT%\\etc\\rtm_config.vsprops" . 27 userprops =
"""<?xml version="1.0" encoding="shift_jis"?> 28 <VisualStudioPropertySheet 29 ProjectType="Visual C++" 41 </VisualStudioPropertySheet> 47 VC++ project-file generator 50 def __init__(self, data, opts):
71 base = self.data[
"basicInfo"][
"name"]
72 for key
in self.vcvers.keys():
75 v[
"sln_fname"] = base + suffix +
".sln" 76 v[
"exeproj_fname"] = base +
"Comp" + suffix +
".vcproj" 77 v[
"dllproj_fname"] = base + suffix +
".vcproj" 78 self.CreateSourceList()
81 self.gen_tags(self.tags)
85 def CreateSourceList(self):
86 name = self.data[
"basicInfo"][
"name"]
87 es = self.data[
"exesources"] = []
88 eh = self.data[
"exeheaders"] = []
89 ds = self.data[
"dllsources"] = []
90 dh = self.data[
"dllheaders"] = []
92 es += [name +
".cpp", name +
"Comp.cpp"]
99 nlist = [
"skel_basename",
"impl_basename"]
100 for sidl
in self.data[
"service_idl"]:
102 l += [(sidl[key] +
".cpp")
for key
in nlist]
104 l += [(sidl[key] +
".h")
for key
in nlist]
105 nlist = [
"stub_basename"]
106 for sidl
in self.data[
"consumer_idl"]:
108 l += [(sidl[key] +
".cpp")
for key
in nlist
if sidl.has_key(key)]
110 l += [(sidl[key] +
".h")
for key
in nlist
if sidl.has_key(key)]
113 def check_overwrite(self, fname, wmode="wb"):
115 Check file exist or not. 117 msg =
" already exists. Overwrite? (y/n)" 118 if (os.access(fname, os.F_OK)):
119 ans = raw_input(
"\"" + fname +
"\"" + msg)
120 if (ans ==
"y" or ans ==
"Y"):
121 return file(fname,
"wb")
125 return file(fname,
"wb")
128 def print_vcproject(self):
130 Generate VC++ project-file 133 proj_name = self.data[
"basicInfo"][
"name"]
134 version = self.data[
"basicInfo"][
"version"]
135 exefiles = {
"source": self.data[
"exesources"],
136 "header": self.data[
"exeheaders"],
139 dllfiles = {
"source": self.data[
"dllsources"],
140 "header": self.data[
"dllheaders"],
143 for key
in self.vcvers.keys():
147 proj_name+
"Comp", version,
150 fname = v[
"exeproj_fname"]
151 fd = self.check_overwrite(fname)
154 print " File \"" + fname +
"\" was generated." 161 fname = v[
"dllproj_fname"]
162 fd = self.check_overwrite(fname)
165 print " File \"" + fname +
"\" was generated." 169 def print_solution(self):
171 Generate VC++ solution-file 174 for key
in self.vcvers.keys():
176 fname = v[
"sln_fname"]
177 fd = self.check_overwrite(fname)
179 flist = [v[
"exeproj_fname"], v[
"dllproj_fname"]]
183 print " File \"" + fname +
"\" was generated." 187 def print_copybat(self):
188 fname =
"copyprops.bat" 189 fd = self.check_overwrite(fname)
191 o = copyprops.replace(
"\r\n",
"\n").replace(
"\n",
"\r\n")
193 print " File \"" + fname +
"\" was generated." 196 def print_userprops(self):
197 fname =
"user_config.vsprops" 198 fd = self.check_overwrite(fname)
200 o = userprops.replace(
"\r\n",
"\n").replace(
"\n",
"\r\n")
202 print " File \"" + fname +
"\" was generated." 206 self.print_vcproject()
207 self.print_solution()
209 self.print_userprops()