You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@subversion.apache.org by "D.J. Heap" <dj...@shadyvale.net> on 2003/06/14 19:42:53 UTC

[PATCH] Windows vcproj generator

This patch catches up the vcproj generator to the dsp generator, I 
believe.  The supplied vcproj files should go into the build/win32 
directory and they will be copied to the appropriate apr directories if 
not already there, when the generator is run.

Log:

Fix up the vcproj generator -- mostly done by copying and tweaking code 
from the dsp generator.

* build/generator/gen_vcnet_vcproj.py:
   Many changes, mostly using tweaked code from gen_msvc_dsp.py

* build/generator/vcnet_vcproj.ezt:
   Change the template to use the new generator stuff, get rid of some
   linker warnings, add pool debugging and purify/quantify options

Re: [PATCH] Windows vcproj generator

Posted by Branko Čibej <br...@xbc.nu>.
D.J. Heap wrote:

> Branko Čibej wrote:
>
>>> @@ -99,73 +107,136 @@
>>>                                              myhash[20:32]))
>>>    return guid
>>>
>>> +  def move_proj_file(self, path, name):
>>> +    dest_file = os.path.join( path, name )
>>> +    if not os.path.exists(dest_file):
>>> +      source_file = os.path.join( 'build', 'win32', name )
>>> +      print 'Copying', dest_file
>>> +      print '    from', source_file
>>> +      self.copyfile(dest_file, source_file)
>>>
>>
>> I'd suggest using write_file_if_changed instead of copyfile, for the
>> same reason its used for writing the other project files.
>>
>
> Hmm, I was only copying the files over if they didn't exist on the
> assumption that apr might include or generate them someday, or the
> user converted a newer version of apr already, or whatever, and I
> didn't want to whack what they had already and possibly break their
> build (ie, a newer apr adds a new source file that is not in the
> apr.vcproj.in file).  Do you think that is too cautious and it should
> just use write_file_if_changed?

Yeah. If APR ever includes .vcproj files, we'll just remove ours, It's
not as if we have to support old versions of APR.

-- 
Brane Čibej   <br...@xbc.nu>   http://www.xbc.nu/brane/


---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@subversion.tigris.org
For additional commands, e-mail: dev-help@subversion.tigris.org

Re: [PATCH] Windows vcproj generator

Posted by "D.J. Heap" <dj...@shadyvale.net>.
Branko Čibej wrote:
>>@@ -99,73 +107,136 @@
>>                                              myhash[20:32]))
>>    return guid
>>
>>+  def move_proj_file(self, path, name):
>>+    dest_file = os.path.join( path, name )
>>+    if not os.path.exists(dest_file):
>>+      source_file = os.path.join( 'build', 'win32', name )
>>+      print 'Copying', dest_file
>>+      print '    from', source_file
>>+      self.copyfile(dest_file, source_file)
>>
> 
> I'd suggest using write_file_if_changed instead of copyfile, for the
> same reason its used for writing the other project files.
> 

Hmm, I was only copying the files over if they didn't exist on the 
assumption that apr might include or generate them someday, or the user 
converted a newer version of apr already, or whatever, and I didn't want 
to whack what they had already and possibly break their build (ie, a 
newer apr adds a new source file that is not in the apr.vcproj.in file). 
  Do you think that is too cautious and it should just use 
write_file_if_changed?

DJ


---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@subversion.tigris.org
For additional commands, e-mail: dev-help@subversion.tigris.org

Re: [PATCH] Windows vcproj generator

Posted by "D.J. Heap" <dj...@shadyvale.net>.
Branko Čibej wrote:
> Oh, and I think you missed one featore of msvc_dsp.ezt in
> vcnet_vcproj.ezt: you want
> 
> IntermediateDirectory="..\..\..\[configs.name]\[target.path][if-any target.shared_dir]\[target.name][end]
> 
> 
> (note the added conditional [target.name] component). That's used by the
> SWIG bindings generator to make sure you get separate copies of svn.res
> for each DLL.
> 

Yes, I also missed the custom build step for the swig .i files.  The 
converter didn't seem to like those either.  Anyway, should have a new 
patch soon and I'm testing the swig-py builds also.

DJ


---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@subversion.tigris.org
For additional commands, e-mail: dev-help@subversion.tigris.org

Re: [PATCH] Windows vcproj generator

Posted by Branko Čibej <br...@xbc.nu>.
D.J. Heap wrote:

> Ok, here's a revised patch against r6305.  I believe everything is
> generating now the same for dsp's and vcproj's including the new
> swig/bindings stuff.  However, I have not actually built the swig
> projects and bindings -- I'm not familiar at all with swig and it
> looks like I would need to download development packages for Python
> and/or Java, right?

I committed the APR and svn_config project files in revision 6311. The
patch itself doesn't apply cleanly to HEAD, though; could you please
post an updated version? Thanks.

Oh, and I think you missed one featore of msvc_dsp.ezt in
vcnet_vcproj.ezt: you want

IntermediateDirectory="..\..\..\[configs.name]\[target.path][if-any target.shared_dir]\[target.name][end]


(note the added conditional [target.name] component). That's used by the
SWIG bindings generator to make sure you get separate copies of svn.res
for each DLL.

-- 
Brane Čibej   <br...@xbc.nu>   http://www.xbc.nu/brane/


---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@subversion.tigris.org
For additional commands, e-mail: dev-help@subversion.tigris.org

Re: [PATCH] Windows vcproj generator

Posted by Branko Čibej <br...@xbc.nu>.
D.J. Heap wrote:

> Ok, here's a revised patch against r6305.  I believe everything is
> generating now the same for dsp's and vcproj's including the new
> swig/bindings stuff.  However, I have not actually built the swig
> projects and bindings -- I'm not familiar at all with swig and it
> looks like I would need to download development packages for Python
> and/or Java, right?

If you have Python installed, you already have all the development stuff
you need -- headers and librariea. You just have tell VS where to find
them. And you have to install SWIG, but that's trivial -- grab the
Windows binary from www.swig.org.

-- 
Brane Čibej   <br...@xbc.nu>   http://www.xbc.nu/brane/


---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@subversion.tigris.org
For additional commands, e-mail: dev-help@subversion.tigris.org

Re: [PATCH] Windows vcproj generator

Posted by Branko Čibej <br...@xbc.nu>.
Committed in revision 6328. Thanks!

D.J. Heap wrote:

> Revised refactoring patch with _item class changed to ProjectItem, and
> a bit of code beautification.
>
> Log:
>
> Refactor code common to dsp and vcproj generator into gen_win.py.
>
> * build/generator/gen_vcnet_vcproj.py
> * build/generator/gen_msvc_dsp.py
>   (write_project): refactor configs and sources generation into
>   calls to gen_win.py
>   (write): refactor install_targets generation into call to
>   gen_win.py and use it's new ProjectItem class
>   (class _item):  moved to gen_win.py as ProjectItem
>
> * build/generator/gen_win.py
>   (get_install_targets): refactored method
>   (get_configs): refactored method
>   (get_proj_sources): refactored method
>   (class ProjectItem): refactored class


-- 
Brane Čibej   <br...@xbc.nu>   http://www.xbc.nu/brane/


---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@subversion.tigris.org
For additional commands, e-mail: dev-help@subversion.tigris.org

Re: [PATCH] Windows vcproj generator

Posted by "D.J. Heap" <dj...@shadyvale.net>.
Revised refactoring patch with _item class changed to ProjectItem, and a 
bit of code beautification.

Log:

Refactor code common to dsp and vcproj generator into gen_win.py.

* build/generator/gen_vcnet_vcproj.py
* build/generator/gen_msvc_dsp.py
   (write_project): refactor configs and sources generation into
   calls to gen_win.py
   (write): refactor install_targets generation into call to
   gen_win.py and use it's new ProjectItem class
   (class _item):  moved to gen_win.py as ProjectItem

* build/generator/gen_win.py
   (get_install_targets): refactored method
   (get_configs): refactored method
   (get_proj_sources): refactored method
   (class ProjectItem): refactored class

Re: [PATCH] Windows vcproj generator

Posted by Branko Čibej <br...@xbc.nu>.
D.J. Heap wrote:

> Revised refactoring patch with _item class changed to ProjectItem.
>
> Log:
>
> Refactor code common to dsp and vcproj generator into gen_win.py.
>
> * build/generator/gen_vcnet_vcproj.py
> * build/generator/gen_msvc_dsp.py
>   (write_project): refactor configs and sources generation into
>   calls to gen_win.py
>   (write): refactor install_targets generation into call to
>   gen_win.py and use it's new ProjectItem class
>   (class _item):  moved to gen_win.py as ProjectItem
>
> * build/generator/gen_win.py
>   (get_install_targets): refactored method
>   (get_configs): refactored method
>   (get_proj_sources): refactored method
>   (class ProjectItem): refactored class 


[snip]

>@@ -201,10 +155,10 @@
> 
>       deplist = [ ]
>       for i in range(len(depends)):
>-        deplist.append(_item(guid=guids[depends[i].name],
>+        deplist.append(gen_win.ProjectItem(guid=guids[depends[i].name],
>                              index=i,
>                              ))
>-      targets.append(_item(name=target.name,
>+      targets.append(gen_win.ProjectItem(name=target.name,
>                            path=string.replace(fname, os.sep, '\\'),
>                            guid=guids[target.name],
>                            depends=deplist,
>
[snip]

>@@ -164,7 +118,7 @@
>       for dep in depends:
>         dep_names.append(dep.proj_name)
> 
>-      targets.append(_item(name=target.proj_name,
>+      targets.append(gen_win.ProjectItem(name=target.proj_name,
>                            dsp=string.replace(fname, os.sep, '\\'),
>                            depends=dep_names))
>

Except for parameter indentation in these two bits, the patch seems O.K.
to me.

-- 
Brane Čibej   <br...@xbc.nu>   http://www.xbc.nu/brane/


---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@subversion.tigris.org
For additional commands, e-mail: dev-help@subversion.tigris.org

Re: [PATCH] Windows vcproj generator

Posted by "D.J. Heap" <dj...@shadyvale.net>.
Revised refactoring patch with _item class changed to ProjectItem.

Log:

Refactor code common to dsp and vcproj generator into gen_win.py.

* build/generator/gen_vcnet_vcproj.py
* build/generator/gen_msvc_dsp.py
   (write_project): refactor configs and sources generation into
   calls to gen_win.py
   (write): refactor install_targets generation into call to
   gen_win.py and use it's new ProjectItem class
   (class _item):  moved to gen_win.py as ProjectItem

* build/generator/gen_win.py
   (get_install_targets): refactored method
   (get_configs): refactored method
   (get_proj_sources): refactored method
   (class ProjectItem): refactored class

Re: [PATCH] Windows vcproj generator

Posted by "D.J. Heap" <dj...@shadyvale.net>.
D.J. Heap wrote:
> Branko Čibej wrote:
> 
>> D.J. Heap wrote:
>>
>>
>>> This should apply against r6313 cleanly -- but I thought I had tested
>>> the last one, also, so if it doesn't work please let me know where the
>>> conflicts are.
>>
>>
>>
>> This patch applied cleanly for me, too. Committed in revision 6316. 
>> Thanks!
>>
>> There's still a ton of things that could be moved from gen_msvc_dsp.py
>> and gen_vcnet_vcproj.py into gen_win.py... Aaah, I'm too lazy to do it.
>>
> 
> Sorry, I was being lazy first.  This patch should move just about 
> everything possible into gen_win.py.  I wasn't sure if the _item class 
> that moved to gen_win.py should be renamed or not, so I just left it.
> 
> DJ
> 

And then I forget the log message...argh.

Log:

Refactor code common to dsp and vcproj generator into gen_win.py.

* build/generator/gen_vcnet_vcproj.py
* build/generator/gen_msvc_dsp.py
   (write_project): refactor configs and sources generation into
   calls to gen_win.py
   (write): refactor install_targets generation into call to
   gen_win.py and use it's new _item class
   (class _item):  moved to gen_win.py

* build/generator/gen_win.py
   (get_install_targets): refactored method
   (get_configs): refactored method
   (get_proj_sources): refactored method
   (class _item): refactored class

Re: [PATCH] Windows vcproj generator

Posted by Branko Čibej <br...@xbc.nu>.
D.J. Heap wrote:

> I wasn't sure if the _item class that moved to gen_win.py should be
> renamed or not, so I just left it. 

The Python convention is that names starting with a single underscore
are considered private to the module (although it's not enforeced by the
name lookup rules, as you noticed). So in this case it should be
renamed, yes. If the name reflected a bit more about what kind of item
it is, that would be even better.


-- 
Brane Čibej   <br...@xbc.nu>   http://www.xbc.nu/brane/


---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@subversion.tigris.org
For additional commands, e-mail: dev-help@subversion.tigris.org

Re: [PATCH] Windows vcproj generator

Posted by "D.J. Heap" <dj...@shadyvale.net>.
Branko Čibej wrote:
> D.J. Heap wrote:
> 
> 
>>This should apply against r6313 cleanly -- but I thought I had tested
>>the last one, also, so if it doesn't work please let me know where the
>>conflicts are.
> 
> 
> This patch applied cleanly for me, too. Committed in revision 6316. Thanks!
> 
> There's still a ton of things that could be moved from gen_msvc_dsp.py
> and gen_vcnet_vcproj.py into gen_win.py... Aaah, I'm too lazy to do it.
> 

Sorry, I was being lazy first.  This patch should move just about 
everything possible into gen_win.py.  I wasn't sure if the _item class 
that moved to gen_win.py should be renamed or not, so I just left it.

DJ

Re: [PATCH] Windows vcproj generator

Posted by Branko Čibej <br...@xbc.nu>.
D.J. Heap wrote:

> This should apply against r6313 cleanly -- but I thought I had tested
> the last one, also, so if it doesn't work please let me know where the
> conflicts are.

This patch applied cleanly for me, too. Committed in revision 6316. Thanks!

There's still a ton of things that could be moved from gen_msvc_dsp.py
and gen_vcnet_vcproj.py into gen_win.py... Aaah, I'm too lazy to do it.

-- 
Brane Čibej   <br...@xbc.nu>   http://www.xbc.nu/brane/


---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@subversion.tigris.org
For additional commands, e-mail: dev-help@subversion.tigris.org

Re: [PATCH] Windows vcproj generator

Posted by "D.J. Heap" <dj...@shadyvale.net>.
Michael Wood wrote:
> On Fri, Jun 20, 2003 at 05:44:33PM -0600, D.J. Heap wrote:
> [snip]
> 
>>D:\Temp>python -c "from svn import client"
>>Traceback (most recent call last):
>>  File "<string>", line 1, in ?
>>  File "C:\Python22\Lib\site-packages\svn\client.py", line 17, in ?
>>    from libsvn.client import *
>>ImportError: No module named libsvn.client
>>
>>Have I just got a path setup wrong or is it not building the dll's 
>>correctly?  The dll is in the 'C:\Python22\Lib\site-packages\svn' 
>>directory, but obviously I've got something wrong...
> 
> [snip]
> 
> The bindings were split into svn and libsvn, so you need a
> C:\Python22\Lib\site-packages\libsvn in addition to site-packages\svn.
> 

Ah, thanks, I will try that and the new instructions in INSTALL from 
Russel's patch.

DJ


---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@subversion.tigris.org
For additional commands, e-mail: dev-help@subversion.tigris.org

Re: [PATCH] Windows vcproj generator

Posted by Michael Wood <mw...@its.uct.ac.za>.
On Fri, Jun 20, 2003 at 05:44:33PM -0600, D.J. Heap wrote:
[snip]
> D:\Temp>python -c "from svn import client"
> Traceback (most recent call last):
>   File "<string>", line 1, in ?
>   File "C:\Python22\Lib\site-packages\svn\client.py", line 17, in ?
>     from libsvn.client import *
> ImportError: No module named libsvn.client
> 
> Have I just got a path setup wrong or is it not building the dll's 
> correctly?  The dll is in the 'C:\Python22\Lib\site-packages\svn' 
> directory, but obviously I've got something wrong...
[snip]

The bindings were split into svn and libsvn, so you need a
C:\Python22\Lib\site-packages\libsvn in addition to site-packages\svn.

-- 
Michael Wood <mw...@its.uct.ac.za>

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@subversion.tigris.org
For additional commands, e-mail: dev-help@subversion.tigris.org

Re: [PATCH] Windows vcproj generator

Posted by "D.J. Heap" <dj...@shadyvale.net>.
This should apply against r6313 cleanly -- but I thought I had tested 
the last one, also, so if it doesn't work please let me know where the 
conflicts are.  This builds all the normal subversion projects and the 
swig-python projects for me -- I didn't try java.  I believe it is 
building the swig-python stuff correctly (it looks the same as when I 
use converted dsps), but I get an error running the quick test:

D:\Temp>python -c "from svn import client"
Traceback (most recent call last):
   File "<string>", line 1, in ?
   File "C:\Python22\Lib\site-packages\svn\client.py", line 17, in ?
     from libsvn.client import *
ImportError: No module named libsvn.client

Have I just got a path setup wrong or is it not building the dll's 
correctly?  The dll is in the 'C:\Python22\Lib\site-packages\svn' 
directory, but obviously I've got something wrong...



Log:

Update the vcproj generator to get it working and refactor a bit of code 
into the Windows generator base class.

* build/generator/msvc_dsp.ezt
     Changed dsp_name to proj_name as part of refactoring.

* build/generator/gen_vcnet_vcproj.py
     Mostly rewritten, using gen_msvc_dsp.py as a basis.

* build/generator/vcnet_vcproj.ezt
     Updated template with new generator parameters.

* build/generator/gen_win.py
     (adjust_win_depends): added this new method to base generator
     to refactor code from vcproj and dsp generators -- it handles
     some special dependency cases.
     (gen_proj_names): added this as part of refactoring also -- it
     handles generator project names.

* build/generator/gen_msvc_dsp.py
     Renamed dsp_name to proj_name as part of code refactoring throughout
     the file.
     (write): Removed code that was refactored into the
     adjust_win_depends method of the base class.

Re: [PATCH] Windows vcproj generator

Posted by "D.J. Heap" <dj...@shadyvale.net>.
Ok, here's a revised patch against r6305.  I believe everything is 
generating now the same for dsp's and vcproj's including the new 
swig/bindings stuff.  However, I have not actually built the swig 
projects and bindings -- I'm not familiar at all with swig and it looks 
like I would need to download development packages for Python and/or 
Java, right?

Log:

Update the vcproj generator to get it working and refactor a bit of code 
into the Windows generator base class.

* build/generator/msvc_dsp.ezt
     Changed dsp_name to proj_name as part of refactoring.

* build/generator/gen_vcnet_vcproj.py
     Mostly rewritten, using gen_msvc_dsp.py as a basis.

* build/generator/vcnet_vcproj.ezt
     Updated template with new generator parameters.

* build/generator/gen_win.py
     (adjust_win_depends): added this new method to base generator
     to refactor code from vcproj and dsp generators -- it handles
     some special dependency cases.

* build/generator/gen_msvc_dsp.py
     Renamed dsp_name to proj_name as part of code refactoring throughout
     the file.
     (write): Removed code that was refactored into the
     adjust_win_depends method of the base class.


Re: [PATCH] Windows vcproj generator

Posted by "D.J. Heap" <dj...@shadyvale.net>.
Thanks for the review, those are very good points, of course.  I will 
re-factor and cleanup when I have some time -- probably this weekendish.

DJ


Branko Čibej wrote:
> I'd install this patch, since it can't break anything that's not broken
> yet :-) but I have a few comments.
> 
> A couple of general notes:
> 
>     * I suggest renaming the .vcproj files that get copied to apr to
>       .vcproj.in and renaming them on copy, to avoid any confusion.
>     * It looks like the dependency tweaks in Generator.write are 99%
>       identical to the ones in gen_msvc_dsp.py. It would be nice to
>       factor those into gen_win.py.
> 
> 

[snip]


---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@subversion.tigris.org
For additional commands, e-mail: dev-help@subversion.tigris.org

Re: [PATCH] Windows vcproj generator

Posted by Branko Čibej <br...@xbc.nu>.
I'd install this patch, since it can't break anything that's not broken
yet :-) but I have a few comments.

A couple of general notes:

    * I suggest renaming the .vcproj files that get copied to apr to
      .vcproj.in and renaming them on copy, to avoid any confusion.
    * It looks like the dependency tweaks in Generator.write are 99%
      identical to the ones in gen_msvc_dsp.py. It would be nice to
      factor those into gen_win.py.


[snip]

>@@ -50,15 +56,15 @@
>                            libs=self.get_win_libs(target, cfg),
>                            ))
> 
>+
>     sources = [ ]
>     for src, reldir in self.get_win_sources(target):
>-      rsrc = string.replace(string.replace(src, target.path + os.sep, ''),
>-                            os.sep, '\\')
>-      sources.append(rsrc)
>-
>-    # sort for output stability, to watch for regressions
>-    sources.sort()
>-
>+      rsrc = string.replace(os.path.join(rootpath, src), os.sep, '\\')
>+      if '-' in rsrc:
>+        rsrc = '%s' % rsrc
>
I don't get the point of this; bit; is rsrc changed in any way?

[snip]

>@@ -99,73 +107,136 @@
>                                               myhash[20:32]))
>     return guid
> 
>+  def move_proj_file(self, path, name):
>+    dest_file = os.path.join( path, name )
>+    if not os.path.exists(dest_file):
>+      source_file = os.path.join( 'build', 'win32', name )
>+      print 'Copying', dest_file
>+      print '    from', source_file
>+      self.copyfile(dest_file, source_file)
>
I'd suggest using write_file_if_changed instead of copyfile, for the
same reason its used for writing the other project files.

Oh, and please lose the spaces after the parens, eek.

-- 
Brane Čibej   <br...@xbc.nu>   http://www.xbc.nu/brane/


---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@subversion.tigris.org
For additional commands, e-mail: dev-help@subversion.tigris.org