mirror of
				https://github.com/webmproject/libwebp.git
				synced 2025-10-31 10:25:46 +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:
		
							
								
								
									
										52
									
								
								Makefile.vc
									
									
									
									
									
								
							
							
						
						
									
										52
									
								
								Makefile.vc
									
									
									
									
									
								
							| @@ -7,8 +7,8 @@ LIB_NAME_DEBUG = libwebp_a_debug | |||||||
| # | # | ||||||
| # Stem for DLL import libs | # Stem for DLL import libs | ||||||
| # | # | ||||||
| IMPLIB_NAME       = libwebp | IMPLIB_NAME       = libwebp_dll | ||||||
| IMPLIB_NAME_DEBUG = libwepb_debug | IMPLIB_NAME_DEBUG = libwebp_dll_debug | ||||||
|  |  | ||||||
| !IFNDEF DEP_PATH | !IFNDEF DEP_PATH | ||||||
| DEPS_PATH   = ../../deps | 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     = /Isrc /nologo /W3 /EHsc /FD /c /GS | ||||||
| CFLAGS     = $(CFLAGS) /DWIN32 /D_CRT_SECURE_NO_WARNINGS /DHAVE_WINCODEC_H | CFLAGS     = $(CFLAGS) /DWIN32 /D_CRT_SECURE_NO_WARNINGS /DHAVE_WINCODEC_H | ||||||
| LDFLAGS    = /LARGEADDRESSAWARE /MANIFEST /NXCOMPAT /DYNAMICBASE $(PLATFORM_LDFLAGS) | LDFLAGS    = /LARGEADDRESSAWARE /MANIFEST /NXCOMPAT /DYNAMICBASE $(PLATFORM_LDFLAGS) | ||||||
| CFLAGSLIB  = /DLIBWEBP_STATICLIB |  | ||||||
| LNKDLL     = link.exe /DLL | LNKDLL     = link.exe /DLL | ||||||
| LNKLIB     = link.exe /lib | LNKLIB     = link.exe /lib | ||||||
| LNKEXE     = link.exe | LNKEXE     = link.exe | ||||||
| @@ -66,19 +65,35 @@ DIRLIB = $(DIRBASE)\lib | |||||||
| DIRINC = $(DIRBASE)\include | DIRINC = $(DIRBASE)\include | ||||||
| DIRBIN = $(DIRBASE)\bin | DIRBIN = $(DIRBASE)\bin | ||||||
|  |  | ||||||
| # release-static | # Target configuration | ||||||
| !IF "$(CFG)" == "release-static" | !IF "$(CFG)" == "release-static" | ||||||
| TARGET = $(LIB_NAME).lib | TARGET         = $(LIB_NAME).lib | ||||||
| LNK    = $(LNKLIB) /out:$(DIRLIB)\$(TARGET) | CC             = $(CCNODBG) | ||||||
| CC     = $(CCNODBG) $(RTLIB) $(CFLAGSLIB) | STATICLIBBUILD = TRUE | ||||||
| CFGSET = 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 | !ENDIF | ||||||
|  |  | ||||||
| # debug-static | !IF "$(STATICLIBBUILD)" == "TRUE" | ||||||
| !IF "$(CFG)" == "debug-static" | CC     = $(CC) $(RTLIB) | ||||||
| TARGET = $(LIB_NAME_DEBUG).lib |  | ||||||
| LNK    = $(LNKLIB) /out:$(DIRLIB)\$(TARGET) | 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 | CFGSET = TRUE | ||||||
| !ENDIF | !ENDIF | ||||||
|  |  | ||||||
| @@ -90,6 +105,8 @@ CFGSET = TRUE | |||||||
| !MESSAGE where <config> is one of: | !MESSAGE where <config> is one of: | ||||||
| !MESSAGE -  release-static                - release static library | !MESSAGE -  release-static                - release static library | ||||||
| !MESSAGE -  debug-static                  - debug 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 <target> may be: | ||||||
| !MESSAGE -  clean                         - perform a clean for CFG | !MESSAGE -  clean                         - perform a clean for CFG | ||||||
| !MESSAGE -  experimental                  - build CFG with experimental | !MESSAGE -  experimental                  - build CFG with experimental | ||||||
| @@ -174,6 +191,9 @@ $(DIRLIB)\$(TARGET): $(X_OBJS) | |||||||
| 	-xcopy $(DIROBJ)\*.pdb                 $(DIRLIB) /y | 	-xcopy $(DIROBJ)\*.pdb                 $(DIRLIB) /y | ||||||
|  |  | ||||||
| $(X_OBJS): $(DIROBJ)\enc $(DIROBJ)\dec $(DIRLIB) $(DIRINC) $(DIRBIN) | $(X_OBJS): $(DIROBJ)\enc $(DIROBJ)\dec $(DIRLIB) $(DIRINC) $(DIRBIN) | ||||||
|  | !IF "$(DLLBUILD)" == "TRUE" | ||||||
|  | $(X_OBJS): $(DIROBJ)\$(DLLINC) | ||||||
|  | !ENDIF | ||||||
|  |  | ||||||
| $(EXAMPLES_OBJS): $(DIROBJ)\examples $(DIRLIB)\$(TARGET) | $(EXAMPLES_OBJS): $(DIROBJ)\examples $(DIRLIB)\$(TARGET) | ||||||
|  |  | ||||||
| @@ -195,6 +215,13 @@ $(DIRINC): | |||||||
| $(DIRBIN): | $(DIRBIN): | ||||||
| 	@if not exist "$(DIRBIN)" mkdir $(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 | .SUFFIXES: .c .obj .res .exe | ||||||
| {examples}.c{$(DIROBJ)\examples}.obj: | {examples}.c{$(DIROBJ)\examples}.obj: | ||||||
| 	$(CC) $(CFLAGS) /Fo"$@"  $< | 	$(CC) $(CFLAGS) /Fo"$@"  $< | ||||||
| @@ -217,5 +244,6 @@ clean: | |||||||
| 	@-erase /s $(DIROBJ)\*.pch 2> NUL | 	@-erase /s $(DIROBJ)\*.pch 2> NUL | ||||||
| 	@-erase /s $(DIROBJ)\*.pdb 2> NUL | 	@-erase /s $(DIROBJ)\*.pdb 2> NUL | ||||||
| 	@-erase /s $(DIROBJ)\*.res 2> NUL | 	@-erase /s $(DIROBJ)\*.res 2> NUL | ||||||
|  | 	@-erase /s $(DIROBJ)\$(DLLINC) 2> NUL | ||||||
|  |  | ||||||
| !ENDIF  # End of case where a config was provided. | !ENDIF  # End of case where a config was provided. | ||||||
|   | |||||||
| @@ -53,7 +53,9 @@ DEFINE_GUID(GUID_WICPixelFormat32bppRGBA, | |||||||
|  |  | ||||||
| #include "webp/encode.h" | #include "webp/encode.h" | ||||||
| #include "stopwatch.h" | #include "stopwatch.h" | ||||||
|  | #ifndef WEBP_DLL | ||||||
| extern void* VP8EncGetCPUInfo;   // opaque forward declaration. | extern void* VP8EncGetCPUInfo;   // opaque forward declaration. | ||||||
|  | #endif | ||||||
|  |  | ||||||
| //----------------------------------------------------------------------------- | //----------------------------------------------------------------------------- | ||||||
|  |  | ||||||
| @@ -689,7 +691,9 @@ static void HelpLong(void) { | |||||||
|   printf("  -short ................. condense printed message\n"); |   printf("  -short ................. condense printed message\n"); | ||||||
|   printf("  -quiet ................. don't print anything.\n"); |   printf("  -quiet ................. don't print anything.\n"); | ||||||
|   printf("  -version ............... print version number and exit.\n"); |   printf("  -version ............... print version number and exit.\n"); | ||||||
|  | #ifndef WEBP_DLL | ||||||
|   printf("  -noasm ................. disable all assembly optimizations.\n"); |   printf("  -noasm ................. disable all assembly optimizations.\n"); | ||||||
|  | #endif | ||||||
|   printf("  -v ..................... verbose, e.g. print encoding/decoding " |   printf("  -v ..................... verbose, e.g. print encoding/decoding " | ||||||
|          "times\n"); |          "times\n"); | ||||||
|   printf("\n"); |   printf("\n"); | ||||||
| @@ -808,8 +812,10 @@ int main(int argc, const char *argv[]) { | |||||||
|     } else if (!strcmp(argv[c], "-resize") && c < argc - 2) { |     } else if (!strcmp(argv[c], "-resize") && c < argc - 2) { | ||||||
|       resize_w = strtol(argv[++c], NULL, 0); |       resize_w = strtol(argv[++c], NULL, 0); | ||||||
|       resize_h = strtol(argv[++c], NULL, 0); |       resize_h = strtol(argv[++c], NULL, 0); | ||||||
|  | #ifndef WEBP_DLL | ||||||
|     } else if (!strcmp(argv[c], "-noasm")) { |     } else if (!strcmp(argv[c], "-noasm")) { | ||||||
|       VP8EncGetCPUInfo = NULL; |       VP8EncGetCPUInfo = NULL; | ||||||
|  | #endif | ||||||
|     } else if (!strcmp(argv[c], "-version")) { |     } else if (!strcmp(argv[c], "-version")) { | ||||||
|       const int version = WebPGetEncoderVersion(); |       const int version = WebPGetEncoderVersion(); | ||||||
|       printf("%d.%d.%d\n", |       printf("%d.%d.%d\n", | ||||||
|   | |||||||
| @@ -45,7 +45,9 @@ extern "C" { | |||||||
| #endif | #endif | ||||||
|  |  | ||||||
| static int verbose = 0; | static int verbose = 0; | ||||||
|  | #ifndef WEBP_DLL | ||||||
| extern void* VP8DecGetCPUInfo;   // opaque forward declaration. | extern void* VP8DecGetCPUInfo;   // opaque forward declaration. | ||||||
|  | #endif | ||||||
|  |  | ||||||
| //----------------------------------------------------------------------------- | //----------------------------------------------------------------------------- | ||||||
|  |  | ||||||
| @@ -323,7 +325,9 @@ static void Help(void) { | |||||||
| #endif | #endif | ||||||
|          "  -h     ....... this help message.\n" |          "  -h     ....... this help message.\n" | ||||||
|          "  -v     ....... verbose (e.g. print encoding/decoding times)\n" |          "  -v     ....... verbose (e.g. print encoding/decoding times)\n" | ||||||
|  | #ifndef WEBP_DLL | ||||||
|          "  -noasm ....... disable all assembly optimizations.\n" |          "  -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); |       config.options.scaled_height = strtol(argv[++c], NULL, 0); | ||||||
|     } else if (!strcmp(argv[c], "-v")) { |     } else if (!strcmp(argv[c], "-v")) { | ||||||
|       verbose = 1; |       verbose = 1; | ||||||
|  | #ifndef WEBP_DLL | ||||||
|     } else if (!strcmp(argv[c], "-noasm")) { |     } else if (!strcmp(argv[c], "-noasm")) { | ||||||
|       VP8DecGetCPUInfo = NULL; |       VP8DecGetCPUInfo = NULL; | ||||||
|  | #endif | ||||||
|     } else if (argv[c][0] == '-') { |     } else if (argv[c][0] == '-') { | ||||||
|       printf("Unknown option '%s'\n", argv[c]); |       printf("Unknown option '%s'\n", argv[c]); | ||||||
|       Help(); |       Help(); | ||||||
|   | |||||||
		Reference in New Issue
	
	Block a user