Subject: Re: [RFC] Enable compilation by Makefile for the MSVC toolchain

From: Marius Storm-Olsen <[email-masked]>
Date: Tue, 18 Aug 2009 19:55:01 +0200

Johannes Schindelin said the following on 18.08.2009 16:11:
> On Tue, 18 Aug 2009, Marius Storm-Olsen wrote:
>> So, instead of rely on these vcproj files which *will* go stale, we
>> can simply use the same Makefile system which everyone else is
>> using. :) After all, we're just compiling with a different
>> compiler. The end result will still rely on the *msysGit
>> environment* to function, so we already require it. Thus, GNU Make
>> is present, and we can use it.
> 
> We can also use sed or perl to generate/modify the .vcproj files, or
> run CMake (once Pau got it to build), and package the stuff using zip
> (once I got that to build).

Really? That would be some script being able to parse the Makefile, and 
create something reasonable as a vcproj script :) Keeping all the 
options in sync, conditional files/libs, all the various end executables 
(a separate .vcproj for each of them, and a solution file (.sln)to tie 
them all together into a .. "solution", a complete product blah blah 
blah) etc.

Just using the (GNU) Makefile as the 'default' way of compiling with 
MSVC seems to be the most reasonable to me. Then we could just have a 
contrib/vc/msvc2008.vcproj which someone can update when they feel like 
it. The default way should be hard to get out-of-sync, IMO.

>> diff --git a/Makefile b/Makefile
>> +ifneq (,$(findstring Microsoft Visual Studio, $(INCLUDE)))
...
>> +else
>>  ifneq (,$(findstring MINGW,$(uname_S)))
>>  	pathsep = ;
>>  	NO_PREAD = YesPlease
> 
> This means that gcc is never used when Visual C++ is available?  Hmm.

Yes it does :)
First, "This implementation is a quick hack to make it compile", so it 
was all about just making it compile, not being 100% correct. There are 
still some warnings and options which shouldn't be passed on to cl, so 
it's by no means complete. Second, having MSVC include paths in INCLUDE 
when you're compiling with MinGW would be plain wrong. I could use LIB 
instead, which would be even wronger ;)
I was actually going to replace it with a USE_MSVC variable check 
instead though, so you'd rather do 'make USE_MSVC=1'

>> diff --git a/compat/msvc.h b/compat/msvc.h
>> index 6071565..a9d5f7f 100644
>> --- a/compat/msvc.h
>> +++ b/compat/msvc.h
>> @@ -10,50 +10,120 @@
>>  
>>  /*Configuration*/
>>  
>> +#ifndef NO_PREAD
>>  #define NO_PREAD
>> +#endif
> 
> Why?  You now have the stuff in two places.  If you want to keep them in 
> compat/msvc.h to be able to generate .vcproj files, I'd rather not have 
> them duplicated in the Makefile.

The changes to the msvc.h where added just keep Frank's vcproj project 
working. I would have just nuked all that stuff in the msvc.h since the 
Makefile would just provide it for me anyways..

--
.marius