Re: [xml] [libxml2][patch] Makefile modifications for Visual Studio 2017 community and 32bit compilation

    Hi Boris,

  Okay, that looks reasonable, though I definitely never used Visual Studio
someone who does should proably double check, but I pushed it assuming it
was good



On Tue, Aug 22, 2017 at 02:39:21PM +0300, Boris shtrasman wrote:

Here are patches for Makefile.msvc to allow build with Visual Studio 2017
(community ) in 32 bit mode (win32).

I have choose to target 32 bit to be as close as possible to Igor Zlatkovic
work (he also provides 32 bit versions.

I choose sdk 8.1 because it's the same sdk Igor targeted.

From 90fac6a5302fbc19da7f39f4a5bc3390203956f0 Mon Sep 17 00:00:00 2001
From: Boris Shtrasman <borissh1983 gmail com>
Date: Wed, 16 Aug 2017 12:22:44 +0300
Subject: [PATCH] Allow build on Visual Studio 2017 community edition for WIN32
 on a 64 bit machine.

This patch hold the necessary changes to build libxml2 with Visual
Studio 2017 for WIN32 on a 64 bit machine.

Today 64 bit windows installation are very common, and Visual Studio
2017 community is the most recent version i have access to.

I have chosen 32 bit and SDK 8.1 to be as close as possible to Igor Zlatkovic work.
 win32/Makefile.msvc | 20 ++++++++++++++++----
 win32/Readme.txt    | 14 ++++++++++++++
 2 files changed, 30 insertions(+), 4 deletions(-)

diff --git a/win32/Makefile.msvc b/win32/Makefile.msvc
index d16c1a2d..2e4d6f83 100644
--- a/win32/Makefile.msvc
+++ b/win32/Makefile.msvc
@@ -26,6 +26,18 @@ XML_IMP = $(XML_BASENAME).lib
 XML_A = $(XML_BASENAME)_a.lib
 XML_A_DLL = $(XML_BASENAME)_a_dll.lib
+VS14_INCLUDE = "C:\Program Files (x86)\Microsoft Visual 
+VS14_INCLUDE_AUX = "C:\Program Files (x86)\Microsoft Visual Studio\2017\Community\VC\Auxiliary\VS\include"
+VS14_INCLUDE_UCRT = "C:\Program Files (x86)\Windows Kits\10\Include\10.0.15063.0\ucrt"
+VS14_INCLUDE_UM = "C:\Program Files (x86)\Windows Kits\10\Include\10.0.15063.0\um"
+VS14_INCLUDE_SHARED = "C:\Program Files (x86)\Windows Kits\10\Include\10.0.15063.0\shared"
+VS14_INCLUDE_WINRT = "C:\Program Files (x86)\Windows Kits\10\Include\10.0.15063.0\winrt\Include\um"
+WindowsSDK_IncludePath = "C:\Program Files (x86)\Windows Kits\10\Include\10.0.15063.0\um"
+VC14_LINK_LIBRARY_PATH_X86 = "C:\Program Files (x86)\Microsoft Visual 
+VC14_LINK_LIBRARY_PATH_X86_AUX = "C:\Program Files (x86)\Microsoft Visual 
+VC14_LINK_LIBRARY_PATH_X86_UCRT = "C:\Program Files (x86)\Windows Kits\10\lib\10.0.10240.0\ucrt\x86"
+VC14_LINK_LIBRARY_PATH_X86_WINSDK = "C:\Program Files (x86)\Windows Kits\8.1\lib\winv6.3\um\x86"
 # Place where we let the compiler put its output.
 BINDIR = bin.msvc
@@ -36,14 +48,14 @@ UTILS_INTDIR = int.utils.msvc
 # The preprocessor and its options.
 CPP = cl.exe /EP
-CPPFLAGS = /nologo /I$(XML_SRCDIR)\include /D "NOLIBTOOL" 
+CPPFLAGS = /nologo /I$(XML_SRCDIR)\include /D "NOLIBTOOL"
 !if "$(WITH_THREADS)" != "no"
 # The compiler and its options.
 CC = cl.exe
-CFLAGS = /nologo /D "WIN32" /D "_WINDOWS" /D "_MBCS" /D "NOLIBTOOL" /W1 $(CRUNTIME)
/I$(VS14_INCLUDE_SHARED) /I$(VS14_INCLUDE_WINRT) /I$(WindowsSDK_IncludePath)
 !if "$(WITH_THREADS)" != "no"
 # The linker and its options.
 LD = link.exe
 !if "$(WITH_FTP)" == "1" || "$(WITH_HTTP)" == "1"
 LIBS = $(LIBS) wsock32.lib ws2_32.lib
diff --git a/win32/Readme.txt b/win32/Readme.txt
index 6b3edddb..8f45238b 100644
--- a/win32/Readme.txt
+++ b/win32/Readme.txt
@@ -148,6 +148,20 @@ it will link to its own C-runtime named msvcr70.dll or msvcr71.dll. This
 file is not available on any machine which doesn't have Visual Studio 
 .NET installed.
+2.1.1 UCRT and 32bit
+If you use the compiler which comes with Visual Studio 2015 and above, note that
+it will link to its own C-runtime named msvcr140.dll or msvcr140.dll. That 
+files are redistributed via the ucrt packages (windows XP need the ucrt files manually copied).
+In order to build 32 bit on Visual Studio 2017 on a 64 bit machine,
+ you would need to call the 32 bit compiler:
+step1 update your path to call the 32bit versions (assuming Visual studio installed to C:\Program Files 
(x86)\Microsoft Visual Studio\2017\Community\VC\Tools\MSVC\14.10.25017):
+set PATH="C:\Program Files (x86)\Microsoft Visual 
+step 2 call name
+nmake /f Makefile.msvc
 2.2 GNU C/C++, Mingw edition

xml mailing list, project page
xml gnome org

Daniel Veillard      | Red Hat Developers Tools
veillard redhat com  | libxml Gnome XML XSLT toolkit | virtualization library

[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]