Author: rhuijben
Date: Thu May 26 10:31:16 2011
New Revision: 1127859

URL: http://svn.apache.org/viewvc?rev=1127859&view=rev
Log:
Remove a bit more ..\..\.. magic from the Visual C++ project system to allow 
more
automatic dependency reduction in MSBuild via simple path comparing.

Note that $(SolutionDir) always ends in a final '\', but double slashes are
allowed.

* build/generator/gen_vcnet_vcproj.py
  (find_rootpath): New function.
  
* build/generator/gen_win.py
  (WinGeneratorBase.__init__): Use find_rootpath instead of a number of ..\
    instances.
  (find_rootpath): New function.
  
* build/generator/templates/vcnet_vcxproj.ezt
  Replace another ..\ style path with a variable pointing to the right path.

Modified:
    subversion/trunk/build/generator/gen_vcnet_vcproj.py
    subversion/trunk/build/generator/gen_win.py
    subversion/trunk/build/generator/templates/vcnet_vcxproj.ezt

Modified: subversion/trunk/build/generator/gen_vcnet_vcproj.py
URL: 
http://svn.apache.org/viewvc/subversion/trunk/build/generator/gen_vcnet_vcproj.py?rev=1127859&r1=1127858&r2=1127859&view=diff
==============================================================================
--- subversion/trunk/build/generator/gen_vcnet_vcproj.py (original)
+++ subversion/trunk/build/generator/gen_vcnet_vcproj.py Thu May 26 10:31:16 
2011
@@ -122,6 +122,10 @@ class Generator(gen_win.WinGeneratorBase
     else:
       self.write_with_template(fname, 'templates/vcnet_vcxproj.ezt', data)
       self.write_with_template(fname + '.filters', 
'templates/vcnet_vcxproj_filters.ezt', data)
+      
+  def find_rootpath(self):
+    "Gets the root path as understand by the project system"
+    return "$(SolutionDir)"
 
   def write(self):
     "Write a Solution (.sln)"
@@ -198,7 +202,7 @@ class Generator(gen_win.WinGeneratorBase
         if depends[i].fname.startswith(self.projfilesdir):
           path = depends[i].fname[len(self.projfilesdir) + 1:]
         else:
-          path = '..\\..\\..\\' + depends[i].fname
+          path = '$(SolutionDir)' + depends[i].fname
         deplist.append(gen_win.ProjectItem(guid=guids[depends[i].name],
                                            index=i,
                                            path=path,

Modified: subversion/trunk/build/generator/gen_win.py
URL: 
http://svn.apache.org/viewvc/subversion/trunk/build/generator/gen_win.py?rev=1127859&r1=1127858&r2=1127859&view=diff
==============================================================================
--- subversion/trunk/build/generator/gen_win.py (original)
+++ subversion/trunk/build/generator/gen_win.py Thu May 26 10:31:16 2011
@@ -288,7 +288,7 @@ class WinGeneratorBase(GeneratorBase):
     #Make the project files directory if it doesn't exist
     #TODO win32 might not be the best path as win64 stuff will go here too
     self.projfilesdir=os.path.join("build","win32",subdir)
-    self.rootpath = ".." + "\\.." * self.projfilesdir.count(os.sep)
+    self.rootpath = self.find_rootpath()
     if not os.path.exists(self.projfilesdir):
       os.makedirs(self.projfilesdir)
 
@@ -331,6 +331,10 @@ class WinGeneratorBase(GeneratorBase):
         swig.Generator(self.conf, self.swig_exe).write()
     else:
       print("%s not found; skipping SWIG file generation..." % self.swig_exe)
+      
+  def find_rootpath(self):
+    "Gets the root path as understand by the project system"
+    return ".." + "\\.." * self.projfilesdir.count(os.sep)
 
   def makeguid(self, data):
     "Generate a windows style GUID"

Modified: subversion/trunk/build/generator/templates/vcnet_vcxproj.ezt
URL: 
http://svn.apache.org/viewvc/subversion/trunk/build/generator/templates/vcnet_vcxproj.ezt?rev=1127859&r1=1127858&r2=1127859&view=diff
==============================================================================
--- subversion/trunk/build/generator/templates/vcnet_vcxproj.ezt (original)
+++ subversion/trunk/build/generator/templates/vcnet_vcxproj.ezt Thu May 26 
10:31:16 2011
@@ -42,8 +42,8 @@
   </ImportGroup>
 [end][end]  <PropertyGroup Label="UserMacros" />
   <PropertyGroup>
-[for configs][for platforms]    <OutDir 
Condition="'$(Configuration)|$(Platform)'=='[configs.name]|[platforms]'">..\..\..\[configs.name]\[target.output_dir]\</OutDir>
-    <IntDir 
Condition="'$(Configuration)|$(Platform)'=='[configs.name]|[platforms]'">..\..\..\[configs.name]\[target.intermediate_dir]\[target.proj_name]\</IntDir>
+[for configs][for platforms]    <OutDir 
Condition="'$(Configuration)|$(Platform)'=='[configs.name]|[platforms]'">$(SolutionDir)\[configs.name]\[target.output_dir]\</OutDir>
+    <IntDir 
Condition="'$(Configuration)|$(Platform)'=='[configs.name]|[platforms]'">$(SolutionDir)\[configs.name]\[target.intermediate_dir]\[target.proj_name]\</IntDir>
     <TargetName 
Condition="'$(Configuration)|$(Platform)'=='[configs.name]|[platforms]'">[target.output_name_without_ext]</TargetName>
 [is config_type "DynamicLibrary"][is target.output_ext ".dll"][else]    
<TargetExt>[target.output_ext]</TargetExt>
 [end][end][end][end]  </PropertyGroup>


Reply via email to