mirror of
https://github.com/webmproject/libwebp.git
synced 2024-11-19 20:08:28 +01:00
Makefile.vc: add DLL configs
(release|debug)-dynamic These configurations will produce a dll in bin/ and an import lib under lib/. Currently the -noasm switch in the examples will be disabled for these builds due to a dependency on VP8EncGetCPUInfo. Change-Id: I2cbac0064f0e500698d14ffc03200791ca837090
This commit is contained in:
parent
998754a734
commit
b4d0ef8f58
50
Makefile.vc
50
Makefile.vc
@ -7,8 +7,8 @@ LIB_NAME_DEBUG = libwebp_a_debug
|
||||
#
|
||||
# Stem for DLL import libs
|
||||
#
|
||||
IMPLIB_NAME = libwebp
|
||||
IMPLIB_NAME_DEBUG = libwepb_debug
|
||||
IMPLIB_NAME = libwebp_dll
|
||||
IMPLIB_NAME_DEBUG = libwebp_dll_debug
|
||||
|
||||
!IFNDEF DEP_PATH
|
||||
DEPS_PATH = ../../deps
|
||||
@ -38,7 +38,6 @@ CCDEBUG = cl.exe /nologo /Od /Gm /Zi /D_DEBUG /RTC1
|
||||
CFLAGS = /Isrc /nologo /W3 /EHsc /FD /c /GS
|
||||
CFLAGS = $(CFLAGS) /DWIN32 /D_CRT_SECURE_NO_WARNINGS /DHAVE_WINCODEC_H
|
||||
LDFLAGS = /LARGEADDRESSAWARE /MANIFEST /NXCOMPAT /DYNAMICBASE $(PLATFORM_LDFLAGS)
|
||||
CFLAGSLIB = /DLIBWEBP_STATICLIB
|
||||
LNKDLL = link.exe /DLL
|
||||
LNKLIB = link.exe /lib
|
||||
LNKEXE = link.exe
|
||||
@ -66,19 +65,35 @@ DIRLIB = $(DIRBASE)\lib
|
||||
DIRINC = $(DIRBASE)\include
|
||||
DIRBIN = $(DIRBASE)\bin
|
||||
|
||||
# release-static
|
||||
# Target configuration
|
||||
!IF "$(CFG)" == "release-static"
|
||||
TARGET = $(LIB_NAME).lib
|
||||
LNK = $(LNKLIB) /out:$(DIRLIB)\$(TARGET)
|
||||
CC = $(CCNODBG) $(RTLIB) $(CFLAGSLIB)
|
||||
CFGSET = TRUE
|
||||
CC = $(CCNODBG)
|
||||
STATICLIBBUILD = TRUE
|
||||
!ELSE IF "$(CFG)" == "debug-static"
|
||||
TARGET = $(LIB_NAME_DEBUG).lib
|
||||
CC = $(CCDEBUG)
|
||||
STATICLIBBUILD = TRUE
|
||||
!ELSE IF "$(CFG)" == "release-dynamic"
|
||||
TARGETDLL = $(LIB_NAME).dll
|
||||
TARGET = $(IMPLIB_NAME).lib
|
||||
CC = $(CCNODBG)
|
||||
DLLBUILD = TRUE
|
||||
!ELSE IF "$(CFG)" == "debug-dynamic"
|
||||
TARGETDLL = $(LIB_NAME_DEBUG).dll
|
||||
TARGET = $(IMPLIB_NAME_DEBUG).lib
|
||||
CC = $(CCDEBUG)
|
||||
DLLBUILD = TRUE
|
||||
!ENDIF
|
||||
|
||||
# debug-static
|
||||
!IF "$(CFG)" == "debug-static"
|
||||
TARGET = $(LIB_NAME_DEBUG).lib
|
||||
!IF "$(STATICLIBBUILD)" == "TRUE"
|
||||
CC = $(CC) $(RTLIB)
|
||||
LNK = $(LNKLIB) /out:$(DIRLIB)\$(TARGET)
|
||||
CC = $(CCDEBUG) $(RTLIBD) $(CFLAGSLIB)
|
||||
CFGSET = TRUE
|
||||
!ELSE IF "$(DLLBUILD)" == "TRUE"
|
||||
DLLINC = webp_dll.h
|
||||
CC = $(CC) /I$(DIROBJ) /FI$(DLLINC) $(RTLIB) /DWEBP_DLL
|
||||
LNK = $(LNKDLL) /out:$(DIRBIN)\$(TARGETDLL) /implib:$(DIRLIB)\$(TARGET)
|
||||
CFGSET = TRUE
|
||||
!ENDIF
|
||||
|
||||
@ -90,6 +105,8 @@ CFGSET = TRUE
|
||||
!MESSAGE where <config> is one of:
|
||||
!MESSAGE - release-static - release static library
|
||||
!MESSAGE - debug-static - debug static library
|
||||
!MESSAGE - release-dynamic - release dynamic link library (DLL)
|
||||
!MESSAGE - debug-dynamic - debug dynamic link library (DLL)
|
||||
!MESSAGE <target> may be:
|
||||
!MESSAGE - clean - perform a clean for CFG
|
||||
!MESSAGE - experimental - build CFG with experimental
|
||||
@ -174,6 +191,9 @@ $(DIRLIB)\$(TARGET): $(X_OBJS)
|
||||
-xcopy $(DIROBJ)\*.pdb $(DIRLIB) /y
|
||||
|
||||
$(X_OBJS): $(DIROBJ)\enc $(DIROBJ)\dec $(DIRLIB) $(DIRINC) $(DIRBIN)
|
||||
!IF "$(DLLBUILD)" == "TRUE"
|
||||
$(X_OBJS): $(DIROBJ)\$(DLLINC)
|
||||
!ENDIF
|
||||
|
||||
$(EXAMPLES_OBJS): $(DIROBJ)\examples $(DIRLIB)\$(TARGET)
|
||||
|
||||
@ -195,6 +215,13 @@ $(DIRINC):
|
||||
$(DIRBIN):
|
||||
@if not exist "$(DIRBIN)" mkdir $(DIRBIN)
|
||||
|
||||
# generate a helper include to define WEBP_EXTERN suitable for the DLL build
|
||||
$(DIROBJ)\$(DLLINC):
|
||||
@echo #ifndef WEBP_DLL_H_ > $@
|
||||
@echo #define WEBP_DLL_H_ >> $@
|
||||
@echo #define WEBP_EXTERN(type) __declspec(dllexport) type >> $@
|
||||
@echo #endif /* WEBP_DLL_H_ */ >> $@
|
||||
|
||||
.SUFFIXES: .c .obj .res .exe
|
||||
{examples}.c{$(DIROBJ)\examples}.obj:
|
||||
$(CC) $(CFLAGS) /Fo"$@" $<
|
||||
@ -217,5 +244,6 @@ clean:
|
||||
@-erase /s $(DIROBJ)\*.pch 2> NUL
|
||||
@-erase /s $(DIROBJ)\*.pdb 2> NUL
|
||||
@-erase /s $(DIROBJ)\*.res 2> NUL
|
||||
@-erase /s $(DIROBJ)\$(DLLINC) 2> NUL
|
||||
|
||||
!ENDIF # End of case where a config was provided.
|
||||
|
@ -53,7 +53,9 @@ DEFINE_GUID(GUID_WICPixelFormat32bppRGBA,
|
||||
|
||||
#include "webp/encode.h"
|
||||
#include "stopwatch.h"
|
||||
#ifndef WEBP_DLL
|
||||
extern void* VP8EncGetCPUInfo; // opaque forward declaration.
|
||||
#endif
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
|
||||
@ -689,7 +691,9 @@ static void HelpLong(void) {
|
||||
printf(" -short ................. condense printed message\n");
|
||||
printf(" -quiet ................. don't print anything.\n");
|
||||
printf(" -version ............... print version number and exit.\n");
|
||||
#ifndef WEBP_DLL
|
||||
printf(" -noasm ................. disable all assembly optimizations.\n");
|
||||
#endif
|
||||
printf(" -v ..................... verbose, e.g. print encoding/decoding "
|
||||
"times\n");
|
||||
printf("\n");
|
||||
@ -808,8 +812,10 @@ int main(int argc, const char *argv[]) {
|
||||
} else if (!strcmp(argv[c], "-resize") && c < argc - 2) {
|
||||
resize_w = strtol(argv[++c], NULL, 0);
|
||||
resize_h = strtol(argv[++c], NULL, 0);
|
||||
#ifndef WEBP_DLL
|
||||
} else if (!strcmp(argv[c], "-noasm")) {
|
||||
VP8EncGetCPUInfo = NULL;
|
||||
#endif
|
||||
} else if (!strcmp(argv[c], "-version")) {
|
||||
const int version = WebPGetEncoderVersion();
|
||||
printf("%d.%d.%d\n",
|
||||
|
@ -45,7 +45,9 @@ extern "C" {
|
||||
#endif
|
||||
|
||||
static int verbose = 0;
|
||||
#ifndef WEBP_DLL
|
||||
extern void* VP8DecGetCPUInfo; // opaque forward declaration.
|
||||
#endif
|
||||
|
||||
//-----------------------------------------------------------------------------
|
||||
|
||||
@ -323,7 +325,9 @@ static void Help(void) {
|
||||
#endif
|
||||
" -h ....... this help message.\n"
|
||||
" -v ....... verbose (e.g. print encoding/decoding times)\n"
|
||||
#ifndef WEBP_DLL
|
||||
" -noasm ....... disable all assembly optimizations.\n"
|
||||
#endif
|
||||
);
|
||||
}
|
||||
|
||||
@ -380,8 +384,10 @@ int main(int argc, const char *argv[]) {
|
||||
config.options.scaled_height = strtol(argv[++c], NULL, 0);
|
||||
} else if (!strcmp(argv[c], "-v")) {
|
||||
verbose = 1;
|
||||
#ifndef WEBP_DLL
|
||||
} else if (!strcmp(argv[c], "-noasm")) {
|
||||
VP8DecGetCPUInfo = NULL;
|
||||
#endif
|
||||
} else if (argv[c][0] == '-') {
|
||||
printf("Unknown option '%s'\n", argv[c]);
|
||||
Help();
|
||||
|
Loading…
Reference in New Issue
Block a user