From c49cc8411fcbcf201f3200ad989b3dfdd0a63e41 Mon Sep 17 00:00:00 2001 From: Daniel Stenberg Date: Wed, 16 Oct 2013 23:23:26 +0200 Subject: [PATCH] windows build: fix build errors Fixes various link errors with VS2010 Reported-by: "kdekker" Fixes #272 --- src/NMakefile | 12 +++++++++++- win32/config.mk | 20 +++++++++++++++----- 2 files changed, 26 insertions(+), 6 deletions(-) diff --git a/src/NMakefile b/src/NMakefile index faa3916..0c4853f 100644 --- a/src/NMakefile +++ b/src/NMakefile @@ -4,15 +4,25 @@ CFLAGS=$(CFLAGS) +AR = lib +ARFLAGS = -nologo /LTCG + RESOURCE=$(INTDIR)\libssh2.res - DLL=libssh2$(SUFFIX).dll +STATICLIB=$(INTDIR)\libssh2.lib +!if "$(BUILD_STATIC_LIB)" == "" all: $(DLL) +!else +all: $(STATICLIB) +!endif $(DLL): $(OBJECTS) $(RESOURCE) $(CC) -o $(DLL) $(DLLFLAGS) $(OBJECTS) $(RESOURCE) $(LIBS) +$(STATICLIB): $(OBJECTS) + $(AR) $(ARFLAGS) -out:$@ $(OBJECTS) + $(RESOURCE): win32\libssh2.rc $(RC) $(RCFLAGS) /Fo"$@" $? diff --git a/win32/config.mk b/win32/config.mk index 1362fb9..4c8eb2a 100644 --- a/win32/config.mk +++ b/win32/config.mk @@ -1,10 +1,20 @@ # Tweak these for your system -OPENSSLINC=..\openssl-0.9.8y\inc32 -OPENSSLLIB=..\openssl-0.9.8y\out32dll +!if "$(OPENSSLINC)" == "" +OPENSSLINC=..\openssl-0.9.8x\inc32 +!endif +!if "$(OPENSSLLIB)" == "" +OPENSSLLIB=..\openssl-0.9.8x\out32dll +!endif + +!if "$(ZLIBINC)" == "" ZLIBINC=-DLIBSSH2_HAVE_ZLIB=1 /I..\zlib-1.2.7 +!endif + +!if "$(ZLIBLIB)" == "" ZLIBLIB=..\zlib-1.2.7 +!endif !if "$(TARGET)" == "" TARGET=Release @@ -15,15 +25,15 @@ SUFFIX=_debug CPPFLAGS=/Od /MDd DLLFLAGS=/DEBUG /LDd !else -CPPFLAGS=/Og /Oi /O2 /Oy /GF /Y- /MD /DNDEBUG +CPPFLAGS=/Oi /O2 /Oy /GF /Y- /MD /DNDEBUG DLLFLAGS=/DEBUG /LD !endif -CPPFLAGS=/nologo /GL /Zi /EHsc $(CPPFLAGS) /Iwin32 /Iinclude /I$(OPENSSLINC) $(ZLIBINC) -DLIBSSH2_WIN32 +CPPFLAGS=/nologo /GL /Zi /EHsc $(CPPFLAGS) /Iwin32 /Iinclude /I$(OPENSSLINC) $(ZLIBINC) CFLAGS=$(CPPFLAGS) RCFLAGS=/Iinclude DLLFLAGS=$(CFLAGS) $(DLLFLAGS) -LIBS=$(OPENSSLLIB)\libeay32.lib $(OPENSSLLIB)\ssleay32.lib ws2_32.lib user32.lib $(ZLIBLIB)\zlib.lib +LIBS=$(OPENSSLLIB)\libeay32.lib $(OPENSSLLIB)\ssleay32.lib $(ZLIBLIB)\zlib.lib ws2_32.lib user32.lib advapi32.lib gdi32.lib INTDIR=$(TARGET)\$(SUBDIR)