GaseousStates / webp

Automatically exported from code.google.com/p/webp
0 stars 0 forks source link

Enable Makefile.vc to build Windows 2000+ compatible static lib. #228

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
Feature/enhancement request...

Editing: Makefile.vs
##############################################################
# Runtime library configuration
!IF "$(RTLIBCFG)" == "static"
RTLIB  = /MT
RTLIBD = /MTd
!ELSE
RTLIB   = /MD
RTLIBD  = /MDd
!ENDIF

To:
##############################################################
# Runtime library configuration
!IF "$(RTLIBCFG)" == "static"
RTLIB  = /MT
RTLIBD = /MTd
!ELSE IF "$(RTLIBCFG)" == "legacy"
RTLIBCFG = static
RTLIB  = /MT
RTLIBD = /MTd
CFLAGS = $(CFLAGS) /GS- /arch:IA32
!ELSE
RTLIB   = /MD
RTLIBD  = /MDd
!ENDIF

That way it's possible to do nmake /f makefile.vc CFG=release-static 
RTLIBCFG=legacy all
and get a static libwebpdecoder.lib that will work on Windows 2000.
Otherwise a normal build will cause a executable to fail due to SEH.
Ensuring that SSE2 is not used also makes sense.

Using /GS- /arch:IA32 makes it possible to use libwebpdecoder.lib built against 
msvcrt.dll

libwebpdecoder.lib with those flags has been deployed and in active public use 
with not a single reported issue regarding image decoding.

Although those still using Windows 2000 (and now Windows XP) are fewer and 
fewer, the fact that two simple config flags are all that is needed to make it 
possible to decode WebP on the Windows 5.x and Windows 6.x series with the same 
lib makes such a legacy option trivial to add.

A WebP 0.4.2 build of libwebpdecoder.lib with this legacy option has been 
tested and works with Windows 2000.

For those curious, the /GS- also makes libwebpdecoder.lib work fin on Windows 
XP retail, SP1. (I seem to recall SP2 or SP3 being the minimum for /GS to work 
without issues)

Do note that this is when building with VC11 (VS2012), I forget which VC 
started targeting XP SP3 as it's minimum target.

For those curious, the program in question that uses libwebpdecoder.lib has a 
minimum target of Windows 5.0 (Windows 2000), and uses feature detection to 
support XP/Vista/7/8 specific features and then utilizes those when 
present/detected. This effectively means the program "degrade gracefully" on 
older Windows systems.

Original issue reported on code.google.com by emsai....@gmail.com on 23 Oct 2014 at 8:48

GoogleCodeExporter commented 9 years ago
This is a reasonable suggestion and I'm all right with it if it works for you.

https://gerrit.chromium.org/gerrit/#/c/71995/

Original comment by jz...@google.com on 23 Oct 2014 at 3:02

GoogleCodeExporter commented 9 years ago
This has been merged. Thanks for the report, if there's anything else needed 
feel free to file another bug.

34c20c0 Makefile.vc: add a 'legacy' RTLIBCFG option

Original comment by jz...@google.com on 27 Oct 2014 at 9:59