Re: MSVC build broken (on cygwin)
- From
Marius Storm-Olsen <marius@storm-olsen.com>
- Date
- Oct 3, 2009, 20:29 UTC
- Message-ID
- <4AC7B42B.8020506@gmail.com>
- In-Reply-To
- <4AC7AEB9.3030404@ramsay1.demon.co.uk>
Ramsay Jones said the following on 03.10.2009 22:06:
Show 14 quoted lines
> Marius Storm-Olsen wrote: >> So, something like this maybe, in git-compat-util.h: >> >> #if defined(__MINGW32__) || defined(_MSC_VER) >> # defined API_WIN32 >> # defined OS_WINDOWS >> #elif defined(__CYGWIN__) >> # defined API_POSIX >> # defined OS_WINDOWS >> #else >> # defined API_POSIX >> #endif > > This is a much better idea.
OK, I'll write up a patch, tomorrow or Monday.
...
Show 8 quoted lines
> So, I think something like this in git-compat-util.h: > > #if defined(_WIN32) && !defined(__CYGWIN__) > # define WIN32_API > # define WIN32_LEAN_AND_MEAN > # include <winsock2.h> > # include <windows.h> > #endif
I agree with this one. Send a patch, and I'll ack.
> and replace all #if(n)def WIN32|_WIN32 with #if(n)def WIN32_API.
Ok, I might look into that too then.
> The only use of the <windows.h> header by cygwin can be moved > into compat/cygwin.c. (I don't much like cygwin using the > Win32 API anyway!)
I don't have Cygwin installed, so I won't touch this one.
Show 7 quoted lines
>> So, then we can use #ifdef API_WIN32 when using the Win32 API is the >> only option/preferred for MinGW or MSVC; and use #ifdef OS_WINDOWS >> when there are things that affect all the Windows builds. >> >> Opinions? > > see above. I don't think OS_WINDOWS is necessary.
Well, it was mostly intended where we'd have code/algorithms which are platform specific, and not really compiler specific; such as the *stat() optimizations. They could probably be joined into an OS_WINDOWS section, with a POSIX_API hunk for the Cygwin fallbacks.
Not really important though. Hopefully there won't be too much platform specific stuff anyways.
-- .marius