[libxmlplusplus/nmake-3-2: 1/2] Add NMake Makefiles



commit 912424d8db1a06144353fb569f96a7a4258cd2a3
Author: Chun-wei Fan <fanchunwei src gnome org>
Date:   Fri Jun 12 12:36:26 2020 +0800

    Add NMake Makefiles
    
    This adds a set of NMake Makefiles that can be used to build libxml++,
    which will replace the Visual Studio 2010(!) projects that reside in the
    repository (which is probably broken and we actually need Visual Studio
    2017+ to build the current code due to a bug in the Visual Studio 2015
    compiler).
    
    The unfortunate fact is that we do need to link to a glibmm that is
    built with the same compiler, otherwise linking will fail and the
    binaries of the dependent glibmm and libsigc++ libraries built with
    other compilers won't work well with the builds here if they are built
    with other Visual Studio compilers, so we will need to separate the
    output filenames for the resulting .lib and .dll files for Visual Studio
    2015, 2017 and 2019.  A NMake Makefile build options "USE_COMPAT_LIBS"
    is added if linking to xxxx-vc140-y_z.lib for libsigc++ and glibmm is
    still desired, such as in the case where these libraries were actually
    built with Visual Studio 2017 or 2019.

 MSVC_NMake/Makefile.vc           |  61 ++++++++++++++
 MSVC_NMake/build-rules-msvc.mak  | 105 ++++++++++++++++++++++++
 MSVC_NMake/config-msvc.mak       |  65 +++++++++++++++
 MSVC_NMake/create-lists-msvc.mak |  86 ++++++++++++++++++++
 MSVC_NMake/create-lists.bat      |  42 ++++++++++
 MSVC_NMake/detectenv-msvc.mak    | 169 +++++++++++++++++++++++++++++++++++++++
 MSVC_NMake/filelist.am           |  11 ++-
 MSVC_NMake/generate-msvc.mak     |  50 ++++++++++++
 MSVC_NMake/info-msvc.mak         |  44 ++++++++++
 MSVC_NMake/install.mak           |  18 +++++
 10 files changed, 650 insertions(+), 1 deletion(-)
---
diff --git a/MSVC_NMake/Makefile.vc b/MSVC_NMake/Makefile.vc
new file mode 100644
index 0000000..75d5794
--- /dev/null
+++ b/MSVC_NMake/Makefile.vc
@@ -0,0 +1,61 @@
+# NMake Makefile for building libxml++ on Windows using Visual Studio
+
+# The items below this line should not be changed, unless one is maintaining
+# the NMake Makefiles.  Customizations can be done in the following NMake Makefile
+# portions (please see comments in the these files to see what can be customized):
+#
+# detectenv-msvc.mak
+# config-msvc.mak
+
+!include detectenv-msvc.mak
+
+# Include the Makefile portions with the source listings
+!include ..\libxml++\filelist.am
+
+# Include the Makefile portion that enables features based on user input
+!include config-msvc.mak
+
+!if "$(VALID_CFGSET)" == "TRUE"
+
+# We need Visual Studio 2015 or later
+!if $(VSVER) < 14
+VALID_MSC = FALSE
+!else
+VALID_MSC = TRUE
+!endif
+
+!if "$(VALID_MSC)" == "TRUE"
+
+all: $(LIBXMLXX_LIB) libxmlxx_examples all-build-info
+
+# Include the Makefile portion to convert the source and header lists
+# into the lists we need for compilation
+!include create-lists-msvc.mak
+
+!ifdef GENERATE_VERSIONED_FILES
+!include pkg-ver.mak
+!endif
+
+tests: $(libxmlxx_tests) all-build-info
+
+libxmlxx_examples: $(libxmlxx_examples)
+
+# Include the build rules for sources, DLLs and executables
+!include generate-msvc.mak
+!include build-rules-msvc.mak
+
+!include install.mak
+
+!else # "$(VALID_MSC)" == "TRUE"
+all:
+       @echo You need Visual Studio 2015 or later.
+
+!endif # "$(VALID_MSC)" == "TRUE"
+
+!else # "$(VALID_CFGSET)" == "TRUE"
+all: help
+       @echo You need to specify a valid configuration, via
+       @echo CFG=release or CFG=debug
+!endif # "$(VALID_CFGSET)" == "TRUE"
+
+!include info-msvc.mak
diff --git a/MSVC_NMake/build-rules-msvc.mak b/MSVC_NMake/build-rules-msvc.mak
new file mode 100644
index 0000000..e9ba4d1
--- /dev/null
+++ b/MSVC_NMake/build-rules-msvc.mak
@@ -0,0 +1,105 @@
+# NMake Makefile portion for compilation rules
+# Items in here should not need to be edited unless
+# one is maintaining the NMake build files.  The format
+# of NMake Makefiles here are different from the GNU
+# Makefiles.  Please see the comments about these formats.
+
+# Inference rules for compiling the .obj files.
+# Used for libs and programs with more than a single source file.
+# Format is as follows
+# (all dirs must have a trailing '\'):
+#
+# {$(srcdir)}.$(srcext){$(destdir)}.obj::
+#      $(CC)|$(CXX) $(cflags) /Fo$(destdir) /c @<<
+# $<
+# <<
+
+{..\libxml++\}.cc{vs$(VSVER)\$(CFG)\$(PLAT)\libxmlxx\}.obj::
+       @if not exist vs$(VSVER)\$(CFG)\$(PLAT)\libxmlxx\ md vs$(VSVER)\$(CFG)\$(PLAT)\libxmlxx
+       $(CXX) $(LIBXMLXX_CFLAGS) $(CFLAGS_NOGL) /Fovs$(VSVER)\$(CFG)\$(PLAT)\libxmlxx\ 
/Fdvs$(VSVER)\$(CFG)\$(PLAT)\libxmlxx\ /c @<<
+$<
+<<
+
+{..\libxml++\exceptions\}.cc{vs$(VSVER)\$(CFG)\$(PLAT)\libxmlxx\}.obj::
+       @if not exist vs$(VSVER)\$(CFG)\$(PLAT)\libxmlxx\ md vs$(VSVER)\$(CFG)\$(PLAT)\libxmlxx
+       $(CXX) $(LIBXMLXX_CFLAGS) $(CFLAGS_NOGL) /Fovs$(VSVER)\$(CFG)\$(PLAT)\libxmlxx\ 
/Fdvs$(VSVER)\$(CFG)\$(PLAT)\libxmlxx\ /c @<<
+$<
+<<
+
+{..\libxml++\io\}.cc{vs$(VSVER)\$(CFG)\$(PLAT)\libxmlxx\}.obj::
+       @if not exist vs$(VSVER)\$(CFG)\$(PLAT)\libxmlxx\ md vs$(VSVER)\$(CFG)\$(PLAT)\libxmlxx
+       $(CXX) $(LIBXMLXX_CFLAGS) $(CFLAGS_NOGL) /Fovs$(VSVER)\$(CFG)\$(PLAT)\libxmlxx\ 
/Fdvs$(VSVER)\$(CFG)\$(PLAT)\libxmlxx\ /c @<<
+$<
+<<
+
+{..\libxml++\nodes\}.cc{vs$(VSVER)\$(CFG)\$(PLAT)\libxmlxx\}.obj::
+       @if not exist vs$(VSVER)\$(CFG)\$(PLAT)\libxmlxx\ md vs$(VSVER)\$(CFG)\$(PLAT)\libxmlxx
+       $(CXX) $(LIBXMLXX_CFLAGS) $(CFLAGS_NOGL) /Fovs$(VSVER)\$(CFG)\$(PLAT)\libxmlxx\ 
/Fdvs$(VSVER)\$(CFG)\$(PLAT)\libxmlxx\ /c @<<
+$<
+<<
+
+{..\libxml++\parsers\}.cc{vs$(VSVER)\$(CFG)\$(PLAT)\libxmlxx\}.obj::
+       @if not exist vs$(VSVER)\$(CFG)\$(PLAT)\libxmlxx\ md vs$(VSVER)\$(CFG)\$(PLAT)\libxmlxx
+       $(CXX) $(LIBXMLXX_CFLAGS) $(CFLAGS_NOGL) /Fovs$(VSVER)\$(CFG)\$(PLAT)\libxmlxx\ 
/Fdvs$(VSVER)\$(CFG)\$(PLAT)\libxmlxx\ /c @<<
+$<
+<<
+
+{..\libxml++\validators\}.cc{vs$(VSVER)\$(CFG)\$(PLAT)\libxmlxx\}.obj::
+       @if not exist vs$(VSVER)\$(CFG)\$(PLAT)\libxmlxx\ md vs$(VSVER)\$(CFG)\$(PLAT)\libxmlxx
+       $(CXX) $(LIBXMLXX_CFLAGS) $(CFLAGS_NOGL) /Fovs$(VSVER)\$(CFG)\$(PLAT)\libxmlxx\ 
/Fdvs$(VSVER)\$(CFG)\$(PLAT)\libxmlxx\ /c @<<
+$<
+<<
+
+{.\libxml++\}.rc{vs$(VSVER)\$(CFG)\$(PLAT)\libxmlxx\}.res:
+       @if not exist $(@D)\ md $(@D)
+       rc /fo$@ $<
+
+# Rules for building .lib files
+$(LIBXMLXX_LIB): $(LIBXMLXX_DLL)
+
+# Rules for linking DLLs
+# Format is as follows (the mt command is needed for MSVC 2005/2008 builds):
+# $(dll_name_with_path): $(dependent_libs_files_objects_and_items)
+#      link /DLL [$(linker_flags)] [$(dependent_libs)] [/def:$(def_file_if_used)] 
[/implib:$(lib_name_if_needed)] -out:$@ @<<
+# $(dependent_objects)
+# <<
+#      @-if exist $@.manifest mt /manifest $@.manifest /outputresource:$@;2
+$(LIBXMLXX_DLL): $(libxmlxx_OBJS) vs$(VSVER)\$(CFG)\$(PLAT)\libxmlxx\libxml++.def
+       link /DLL $(LDFLAGS_NOLTCG) $(GLIBMM_LIB) $(LIBXML2_LIBS) $(GOBJECT_LIBS) $(LIBSIGC_LIB) 
/implib:$(LIBXMLXX_LIB) /def:vs$(VSVER)\$(CFG)\$(PLAT)\libxmlxx\libxml++.def -out:$@ @<<
+$(libxmlxx_OBJS)
+<<
+       @-if exist $@.manifest mt /manifest $@.manifest /outputresource:$@;2
+
+# Rules for linking Executables
+# Format is as follows (the mt command is needed for MSVC 2005/2008 builds):
+# $(dll_name_with_path): $(dependent_libs_files_objects_and_items)
+#      link [$(linker_flags)] [$(dependent_libs)] -out:$@ @<<
+# $(dependent_objects)
+# <<
+#      @-if exist $@.manifest mt /manifest $@.manifest /outputresource:$@;1
+$(GENDEF): gendef\gendef.cc
+       @if not exist $(@D)\gendef\ md $(@D)\gendef
+       $(CXX) $(CFLAGS) /Fo$(@D)\gendef\ /Fd$(@D)\gendef\ $** /Fe:$@ /link $(LDFLAGS) -out:$@ 
+       @-if exist $@.manifest mt /manifest $@.manifest /outputresource:$@;1
+
+clean:
+       @-del /f /q vs$(VSVER)\$(CFG)\$(PLAT)\*.exe
+       @-del /f /q vs$(VSVER)\$(CFG)\$(PLAT)\*.dll
+       @-del /f /q vs$(VSVER)\$(CFG)\$(PLAT)\*.pdb
+       @-del /f /q vs$(VSVER)\$(CFG)\$(PLAT)\*.ilk
+       @-del /f /q vs$(VSVER)\$(CFG)\$(PLAT)\*.exp
+       @-del /f /q vs$(VSVER)\$(CFG)\$(PLAT)\*.lib
+       @-del /f /q vs$(VSVER)\$(CFG)\$(PLAT)\libxmlxx-tests\*.obj
+       @-del /f /q vs$(VSVER)\$(CFG)\$(PLAT)\libxmlxx-tests\*.pdb
+       @-del /f /q vs$(VSVER)\$(CFG)\$(PLAT)\libxmlxx-examples\*.obj
+       @-del /f /q vs$(VSVER)\$(CFG)\$(PLAT)\libxmlxx-examples\*.pdb
+       @-del /f /q vs$(VSVER)\$(CFG)\$(PLAT)\libxmlxx\*.def
+       @-del /f /q vs$(VSVER)\$(CFG)\$(PLAT)\libxmlxx\*.res
+       @-del /f /q vs$(VSVER)\$(CFG)\$(PLAT)\libxmlxx\*.obj
+       @-del /f /q vs$(VSVER)\$(CFG)\$(PLAT)\libxmlxx\*.pdb
+       @-del /f /q vs$(VSVER)\$(CFG)\$(PLAT)\gendef\*.obj
+       @-del /f /q vs$(VSVER)\$(CFG)\$(PLAT)\gendef\*.pdb
+       @-rd vs$(VSVER)\$(CFG)\$(PLAT)\libxmlxx-tests
+       @-rd vs$(VSVER)\$(CFG)\$(PLAT)\libxmlxx-examples
+       @-rd vs$(VSVER)\$(CFG)\$(PLAT)\libxmlxx
+       @-rd vs$(VSVER)\$(CFG)\$(PLAT)\gendef
diff --git a/MSVC_NMake/config-msvc.mak b/MSVC_NMake/config-msvc.mak
new file mode 100644
index 0000000..48f9fd4
--- /dev/null
+++ b/MSVC_NMake/config-msvc.mak
@@ -0,0 +1,65 @@
+# NMake Makefile portion for enabling features for Windows builds
+
+# These are the base minimum libraries required for building glibmm.
+BASE_INCLUDES =        /I$(PREFIX)\include
+
+# Please do not change anything beneath this line unless maintaining the NMake Makefiles
+LIBXMLXX_MAJOR_VERSION = 3
+LIBXMLXX_MINOR_VERSION = 0
+
+GLIB_API_VERSION = 2.0
+
+GLIBMM_MAJOR_VERSION = 2
+GLIBMM_MINOR_VERSION = 4
+
+LIBSIGC_MAJOR_VERSION = 2
+LIBSIGC_MINOR_VERSION = 0
+
+!if "$(CFG)" == "debug" || "$(CFG)" == "Debug"
+DEBUG_SUFFIX = -d
+!else
+DEBUG_SUFFIX =
+!endif
+
+LIBXMLXX_BASE_CFLAGS =                 \
+       /I.\libxml++ /I..               \
+       /wd4530 /wd4251 /wd4275 /EHsc   \
+       /FImsvc_recommended_pragmas.h
+
+LIBXMLXX_EXTRA_INCLUDES =      \
+       /I$(PREFIX)\include\libxml2     \
+       /I$(PREFIX)\include\glibmm-$(GLIBMM_MAJOR_VERSION).$(GLIBMM_MINOR_VERSION)      \
+       /I$(PREFIX)\lib\glibmm-$(GLIBMM_MAJOR_VERSION).$(GLIBMM_MINOR_VERSION)\includes \
+       /I$(PREFIX)\include\gio-win32-$(GLIB_API_VERSION)       \
+       /I$(PREFIX)\include\glib-$(GLIB_API_VERSION)    \
+       /I$(PREFIX)\lib\glib-$(GLIB_API_VERSION)\include        \
+       /I$(PREFIX)\include\sigc++-$(LIBSIGC_MAJOR_VERSION).$(LIBSIGC_MINOR_VERSION)    \
+       /I$(PREFIX)\lib\sigc++-$(LIBSIGC_MAJOR_VERSION).$(LIBSIGC_MINOR_VERSION)\include
+
+LIBXMLXX_CFLAGS = /DLIBXMLPP_BUILD $(LIBXMLXX_BASE_CFLAGS) $(LIBXMLXX_EXTRA_INCLUDES)
+LIBXMLXX_EX_CFLAGS = $(LIBXMLXX_BASE_CFLAGS) $(LIBXMLXX_EXTRA_INCLUDES)
+
+# We build xml++-vc$(VSVER_LIB)-$(LIBXMLXX_MAJOR_VERSION)_$(LIBXMLXX_MINOR_VERSION).dll or
+#          xml++-vc$(VSVER_LIB)-d-$(LIBXMLXX_MAJOR_VERSION)_$(LIBXMLXX_MINOR_VERSION).dll at least
+
+!ifdef USE_MESON_LIBS
+LIBSIGC_LIBNAME = sigc-$(LIBSIGC_MAJOR_VERSION).$(LIBSIGC_MINOR_VERSION)
+GLIBMM_LIBNAME = glibmm-$(GLIBMM_MAJOR_VERSION).$(GLIBMM_MINOR_VERSION)
+LIBSIGC_DLL = $(LIBSIGC_LIBNAME)-0.dll
+GLIBMM_DLL = $(GLIBMM_LIBNAME)-1.dll
+!else
+LIBSIGC_LIBNAME = sigc-vc$(VSVER_LIB)$(DEBUG_SUFFIX)-$(LIBSIGC_MAJOR_VERSION)_$(LIBSIGC_MINOR_VERSION)
+GLIBMM_LIBNAME = glibmm-vc$(VSVER_LIB)$(DEBUG_SUFFIX)-$(GLIBMM_MAJOR_VERSION)_$(GLIBMM_MINOR_VERSION)
+LIBSIGC_DLL = $(LIBSIGC_LIBNAME).dll
+GLIBMM_DLL = $(GLIBMM_LIBNAME).dll
+!endif
+
+LIBSIGC_LIB = $(LIBSIGC_LIBNAME).lib
+GLIBMM_LIB = $(GLIBMM_LIBNAME).lib
+
+LIBXMLXX_DLL = 
vs$(VSVER)\$(CFG)\$(PLAT)\xml++-vc$(VSVER_LIB)$(DEBUG_SUFFIX)-$(LIBXMLXX_MAJOR_VERSION)_$(LIBXMLXX_MINOR_VERSION).dll
+LIBXMLXX_LIB = 
vs$(VSVER)\$(CFG)\$(PLAT)\xml++-vc$(VSVER_LIB)$(DEBUG_SUFFIX)-$(LIBXMLXX_MAJOR_VERSION)_$(LIBXMLXX_MINOR_VERSION).lib
+GENDEF = vs$(VSVER)\$(CFG)\$(PLAT)\gendef.exe
+
+LIBXML2_LIBS = libxml2.lib
+GOBJECT_LIBS = gobject-2.0.lib gmodule-2.0.lib glib-2.0.lib
diff --git a/MSVC_NMake/create-lists-msvc.mak b/MSVC_NMake/create-lists-msvc.mak
new file mode 100644
index 0000000..fa529cb
--- /dev/null
+++ b/MSVC_NMake/create-lists-msvc.mak
@@ -0,0 +1,86 @@
+# Convert the source listing to object (.obj) listing in
+# another NMake Makefile module, include it, and clean it up.
+# This is a "fact-of-life" regarding NMake Makefiles...
+# This file does not need to be changed unless one is maintaining the NMake Makefiles
+
+# For those wanting to add things here:
+# To add a list, do the following:
+# # $(description_of_list)
+# if [call create-lists.bat header $(makefile_snippet_file) $(variable_name)]
+# endif
+#
+# if [call create-lists.bat file $(makefile_snippet_file) $(file_name)]
+# endif
+#
+# if [call create-lists.bat footer $(makefile_snippet_file)]
+# endif
+# ... (repeat the if [call ...] lines in the above order if needed)
+# !include $(makefile_snippet_file)
+#
+# (add the following after checking the entries in $(makefile_snippet_file) is correct)
+# (the batch script appends to $(makefile_snippet_file), you will need to clear the file unless the 
following line is added)
+#!if [del /f /q $(makefile_snippet_file)]
+#!endif
+
+# In order to obtain the .obj filename that is needed for NMake Makefiles to build DLLs/static LIBs or EXEs, 
do the following
+# instead when doing 'if [call create-lists.bat file $(makefile_snippet_file) $(file_name)]'
+# (repeat if there are multiple $(srcext)'s in $(source_list), ignore any headers):
+# !if [for %c in ($(source_list)) do @if "%~xc" == ".$(srcext)" @call create-lists.bat file 
$(makefile_snippet_file) $(intdir)\%~nc.obj]
+#
+# $(intdir)\%~nc.obj needs to correspond to the rules added in build-rules-msvc.mak
+# %~xc gives the file extension of a given file, %c in this case, so if %c is a.cc, %~xc means .cc
+# %~nc gives the file name of a given file without extension, %c in this case, so if %c is a.cc, %~nc means a
+
+NULL=
+
+# For libxml++
+
+!if [call create-lists.bat header libxmlxx.mak libxmlxx_OBJS]
+!endif
+
+!if [for %c in ($(cc_sources)) do @if "%~xc" == ".cc" @call create-lists.bat file libxmlxx.mak 
vs^$(VSVER)\^$(CFG)\^$(PLAT)\libxmlxx\%~nc.obj]
+!endif
+
+!if [@call create-lists.bat file libxmlxx.mak vs^$(VSVER)\^$(CFG)\^$(PLAT)\libxmlxx\libxml++.res]
+!endif
+
+!if [call create-lists.bat footer libxmlxx.mak]
+!endif
+
+!if [call create-lists.bat header libxmlxx.mak libxmlxx_real_hdrs]
+!endif
+
+!if [for %c in ($(h_sources_public:/=\)) do @call create-lists.bat file libxmlxx.mak ..\libxml++\%c]
+!endif
+
+!if [call create-lists.bat footer libxmlxx.mak]
+!endif
+
+!if [for %d in (examples tests) do @call create-lists.bat header libxmlxx.mak libxmlxx_%d & @(for /f %t in 
('dir /ad /b ..\%d') do @call create-lists.bat file libxmlxx.mak vs$(VSVER)\$(CFG)\$(PLAT)\%t.exe) & @call 
create-lists.bat footer libxmlxx.mak]
+!endif
+
+!if [for %d in (examples tests) do @for /f %t in ('dir /ad /b ..\%d') do @call create-lists.bat header 
libxmlxx.mak %t_OBJS & @(for %s in (..\%d\%t\*.cc) do @call create-lists.bat file libxmlxx.mak 
vs$(VSVER)\$(CFG)\$(PLAT)\libxmlxx-%d\%t-%~ns.obj) & @call create-lists.bat footer libxmlxx.mak]
+!endif
+
+!if [for %t in (dom_parser dom_parse_entities) do @echo %t_OBJS = ^$(%t_OBJS) 
vs^$(VSVER)\^$(CFG)\^$(PLAT)\libxmlxx-examples\testutilities.obj>>libxmlxx.mak]
+!endif
+
+!if [echo.>>libxmlxx.mak]
+!endif
+
+!if [for %d in (examples tests) do @for /f %t in ('dir /ad /b ..\%d') do @for %s in (..\%d\%t\*.cc) do @echo 
vs^$(VSVER)\^$(CFG)\^$(PLAT)\libxmlxx-%d\%t-%~ns.obj: %s>>libxmlxx.mak & @echo. if not exist ^$(@D)\ md 
^$(@D)>>libxmlxx.mak & @echo.     ^$(CXX) ^$(LIBXMLXX_EX_CFLAGS) ^$(CFLAGS) /Fo^$(@D)\%t-%~ns.obj /Fd^$(@D)\ 
^$** /c>>libxmlxx.mak & @echo.>>libxmlxx.mak]
+!endif
+
+!if [echo vs^$(VSVER)\^$(CFG)\^$(PLAT)\libxmlxx-examples\testutilities.obj: 
..\examples\testutilities.cc>>libxmlxx.mak & @echo. if not exist ^$(@D)\ md ^$(@D)>>libxmlxx.mak & @echo.  
^$(CXX) ^$(LIBXMLXX_EX_CFLAGS) ^$(CFLAGS) /Fo^$(@D)\ /Fd^$(@D)\ ^$** /c>>libxmlxx.mak & @echo.>>libxmlxx.mak]
+!endif
+
+!if [for %d in (examples tests) do @for /f %t in ('dir /ad /b ..\%d') do @echo 
vs^$(VSVER)\^$(CFG)\^$(PLAT)\%t.exe: ^$(LIBXMLXX_LIB) ^$(%t_OBJS)>>libxmlxx.mak & @echo.        link 
^$(LDFLAGS) ^$** ^$(GLIBMM_LIB) ^$(LIBXML2_LIBS) ^$(GOBJECT_LIBS) ^$(LIBSIGC_LIB) /out:^$@>>libxmlxx.mak & 
@echo.>>libxmlxx.mak]
+!endif
+
+!if [echo.>>libxmlxx.mak]
+!endif
+
+!include libxmlxx.mak
+
+!if [del /f /q libxmlxx.mak]
+!endif
diff --git a/MSVC_NMake/create-lists.bat b/MSVC_NMake/create-lists.bat
new file mode 100644
index 0000000..ef60d5c
--- /dev/null
+++ b/MSVC_NMake/create-lists.bat
@@ -0,0 +1,42 @@
+@echo off
+rem Simple .bat script for creating the NMake Makefile snippets.
+
+if not "%1" == "header" if not "%1" == "file" if not "%1" == "footer" goto :error_cmd
+if "%2" == "" goto error_no_destfile
+
+if "%1" == "header" goto :header
+if "%1" == "file" goto :addfile
+if "%1" == "footer" goto :footer
+
+:header
+if "%3" == "" goto error_var
+echo %3 =      \>>%2
+goto done
+
+:addfile
+if "%3" == "" goto error_file
+echo.  %3      \>>%2
+goto done
+
+:footer
+echo.  $(NULL)>>%2
+echo.>>%2
+goto done
+
+:error_cmd
+echo Specified command '%1' was invalid.  Valid commands are: header file footer.
+goto done
+
+:error_no_destfile
+echo Destination NMake snippet file must be specified
+goto done
+
+:error_var
+echo A name must be specified for using '%1'.
+goto done
+
+:error_file
+echo A file must be specified for using '%1'.
+goto done
+
+:done
\ No newline at end of file
diff --git a/MSVC_NMake/detectenv-msvc.mak b/MSVC_NMake/detectenv-msvc.mak
new file mode 100644
index 0000000..c59e029
--- /dev/null
+++ b/MSVC_NMake/detectenv-msvc.mak
@@ -0,0 +1,169 @@
+# Change this (or specify PREFIX= when invoking this NMake Makefile) if
+# necessary, so that the libs and headers of the dependent third-party
+# libraries can be located.  For instance, if building from GLib's
+# included Visual Studio projects, this should be able to locate the GLib
+# build out-of-the-box if they were not moved.  GLib's headers will be
+# found in $(GLIB_PREFIX)\include\glib-2.0 and
+# $(GLIB_PREFIX)\lib\glib-2.0\include and its import library will be found
+# in $(GLIB_PREFIX)\lib.
+
+!if "$(PREFIX)" == ""
+PREFIX = ..\..\vs$(VSVER)\$(PLAT)
+!endif
+
+# Location of the PERL interpreter, for running glib-mkenums.  glib-mkenums
+# needs to be found in $(PREFIX)\bin.  Using either a 32-bit or x64 PERL
+# interpreter are supported for either a 32-bit or x64 build.
+
+!if "$(PERL)" == ""
+PERL = perl
+!endif
+
+# Location of the Python interpreter, for building introspection.  The complete set
+# of Python Modules for introspection (the giscanner Python scripts and the _giscanner.pyd
+# compiled module) needs to be found in $(PREFIX)\lib\gobject-introspection\giscanner, and
+# the g-ir-scanner Python script and g-ir-compiler utility program needs to be found
+# in $(PREFIX)\bin, together with any DLLs they will depend on, if those DLLs are not already
+# in your PATH.
+# Note that the Python interpreter and the introspection modules and utility progam must
+# correspond to the build type (i.e. 32-bit Release for 32-bit Release builds, and so on).
+#
+# For introspection, currently only Python 2.7.x is supported.  This may change when Python 3.x
+# support is added upstream in gobject-introspection--when this happens, the _giscanner.pyd must
+# be the one that is built against the release series of Python that is used here.
+
+!if "$(PYTHON)" == ""
+PYTHON = python
+!endif
+
+# Location of the pkg-config utility program, for building introspection.  It needs to be able
+# to find the pkg-config (.pc) files so that the correct libraries and headers for the needed libraries
+# can be located, using PKG_CONFIG_PATH.  Using either a 32-bit or x64 pkg-config are supported for
+# either a 32-bit or x64 build.
+
+!if "$(PKG_CONFIG)" == ""
+PKG_CONFIG = pkg-config
+!endif
+
+# The items below this line should not be changed, unless one is maintaining
+# the NMake Makefiles.  The exception is for the CFLAGS_ADD line(s) where one
+# could use his/her desired compiler optimization flags, if he/she knows what is
+# being done.
+
+# Check to see we are configured to build with MSVC (MSDEVDIR, MSVCDIR or
+# VCINSTALLDIR) or with the MS Platform SDK (MSSDK or WindowsSDKDir)
+!if !defined(VCINSTALLDIR) && !defined(WINDOWSSDKDIR)
+MSG = ^
+This Makefile is only for Visual Studio 2008 and later.^
+You need to ensure that the Visual Studio Environment is properly set up^
+before running this Makefile.
+!error $(MSG)
+!endif
+
+ERRNUL  = 2>NUL
+_HASH=^#
+
+!if ![echo VCVERSION=_MSC_VER > vercl.x] \
+    && ![echo $(_HASH)if defined(_M_IX86) >> vercl.x] \
+    && ![echo PLAT=Win32 >> vercl.x] \
+    && ![echo $(_HASH)elif defined(_M_AMD64) >> vercl.x] \
+    && ![echo PLAT=x64 >> vercl.x] \
+    && ![echo $(_HASH)endif >> vercl.x] \
+    && ![cl -nologo -TC -P vercl.x $(ERRNUL)]
+!include vercl.i
+!if ![echo VCVER= ^\> vercl.vc] \
+    && ![set /a $(VCVERSION) / 100 - 6 >> vercl.vc]
+!include vercl.vc
+!endif
+!endif
+!if ![del $(ERRNUL) /q/f vercl.x vercl.i vercl.vc]
+!endif
+
+VSVER = 0
+PDBVER = 0
+VSVER_SUFFIX = 0
+
+!if $(VCVERSION) > 1499 && $(VCVERSION) < 1600
+PDBVER = 9
+!elseif $(VCVERSION) > 1599 && $(VCVERSION) < 1700
+PDBVER = 10
+!elseif $(VCVERSION) > 1699 && $(VCVERSION) < 1800
+PDBVER = 11
+!elseif $(VCVERSION) > 1799 && $(VCVERSION) < 1900
+PDBVER = 12
+!elseif $(VCVERSION) > 1899 && $(VCVERSION) < 2000
+PDBVER = 14
+!if $(VCVERSION) > 1909 && $(VCVERSION) < 1920
+VSVER_SUFFIX = 1
+VSVER = 15
+!elseif $(VCVERSION) > 1919 && $(VCVERSION) < 2000
+VSVER_SUFFIX = 2
+VSVER = 16
+!else
+VSVER = $(PDBVER)
+!endif
+!else
+VSVER = $(PDBVER)
+!endif
+
+!if $(VSVER) > 14 && "$(USE_COMPAT_LIBS)" != ""
+VSVER_LIB = $(PDBVER)0
+!else
+VSVER_LIB = $(PDBVER)$(VSVER_SUFFIX)
+!endif
+
+!if "$(VSVER)" == "0"
+MSG = ^
+This NMake Makefile set supports Visual Studio^
+9 (2008) through 16 (2019).  Your Visual Studio^
+version is not supported.
+!error $(MSG)
+!endif
+
+VALID_CFGSET = FALSE
+!if "$(CFG)" == "release" || "$(CFG)" == "Release" || "$(CFG)" == "debug" || "$(CFG)" == "Debug"
+VALID_CFGSET = TRUE
+!endif
+
+# One may change these items, but be sure to test
+# the resulting binaries
+!if "$(CFG)" == "release" || "$(CFG)" == "Release"
+CFLAGS_ADD_NO_GL = /MD /O2 /MP
+CFLAGS_ADD = $(CFLAGS_ADD_NO_GL) /GL
+!if "$(VSVER)" != "9"
+CFLAGS_ADD = $(CFLAGS_ADD) /d2Zi+
+CFLAGS_ADD_NO_GL = $(CFLAGS_ADD_NO_GL) /d2Zi+
+!if $(VSVER) >= 14
+CFLAGS_ADD = $(CFLAGS_ADD) /utf-8
+CFLAGS_ADD_NO_GL = $(CFLAGS_ADD_NO_GL) /utf-8
+!endif
+!endif
+!else
+CFLAGS_ADD = /MDd /Od
+CFLAGS_ADD_NO_GL = $(CFLAGS_ADD)
+!endif
+
+!if "$(PLAT)" == "x64"
+LDFLAGS_ARCH = /machine:x64
+!else
+LDFLAGS_ARCH = /machine:x86
+!endif
+
+!if "$(VALID_CFGSET)" == "TRUE"
+CFLAGS_NOGL = $(CFLAGS_ADD_NO_GL) /W3 /Zi
+CFLAGS = $(CFLAGS_ADD) /W3 /Zi
+
+LDFLAGS_BASE = $(LDFLAGS_ARCH) /libpath:$(PREFIX)\lib /DEBUG
+
+!if "$(CFG)" == "debug" || "$(CFG)" == "Debug"
+ARFLAGS_NOLTCG = $(LDFLAGS_ARCH)
+ARFLAGS = $(LDFLAGS_ARCH)
+LDFLAGS_NOLTCG = $(LDFLAGS_BASE)
+LDFLAGS = $(LDFLAGS_BASE)
+!else
+ARFLAGS_NOLTCG = $(LDFLAGS_ARCH) /LTCG
+ARFLAGS = $(ARFLAGS_NOLTCG) /LTCG
+LDFLAGS_NOLTCG = $(LDFLAGS_BASE) /opt:ref
+LDFLAGS = $(LDFLAGS_NOLTCG) /LTCG
+!endif
+!endif
diff --git a/MSVC_NMake/filelist.am b/MSVC_NMake/filelist.am
index 4550698..ee2e742 100644
--- a/MSVC_NMake/filelist.am
+++ b/MSVC_NMake/filelist.am
@@ -37,4 +37,13 @@ msvc_net2010_data = \
   examples/schemavalidation/schemavalidation.vcxproj \
   examples/schemavalidation/schemavalidation.vcxproj.filters \
   examples/textreader/textreader.vcxproj \
-  examples/textreader/textreader.vcxproj.filters
+  examples/textreader/textreader.vcxproj.filters \
+  build-rules-msvc.mak \
+  config-msvc.mak \
+  create-lists-msvc.mak \
+  create-lists.bat \
+  detectenv-msvc.mak \
+  generate-msvc.mak \
+  info-msvc.mak \
+  install.mak \
+  Makefile.vc
diff --git a/MSVC_NMake/generate-msvc.mak b/MSVC_NMake/generate-msvc.mak
new file mode 100644
index 0000000..a7772e9
--- /dev/null
+++ b/MSVC_NMake/generate-msvc.mak
@@ -0,0 +1,50 @@
+# NMake Makefile portion for code generation and
+# intermediate build directory creation
+# Items in here should not need to be edited unless
+# one is maintaining the NMake build files.
+
+# Create the build directories
+vs$(VSVER)\$(CFG)\$(PLAT)\libxmlxx:
+       @-md $@
+
+# Generate .def file using gendef
+vs$(VSVER)\$(CFG)\$(PLAT)\libxmlxx\libxml++.def: $(libxmlxx_OBJS) $(GENDEF)
+       $(GENDEF) $@ 
xml++-vc$(VSVER_LIB)$(DEBUG_SUFFIX)-$(LIBXMLXX_MAJOR_VERSION)_$(LIBXMLXX_MINOR_VERSION).dll $(libxmlxx_OBJS)
+
+# Generate pre-generated resources and configuration headers (builds from GIT)
+prep-git-build: pkg-ver.mak
+
+libxml++\libxml++.rc: pkg-ver.mak libxml++\libxml++.rc.in libxml++\libxml++config.h
+       @echo Generating $@...
+       @copy "$@.in" "$@"
+       @$(PERL) -pi.bak -e "s/\@LIBXMLXX_MAJOR_VERSION\@/$(PKG_MAJOR_VERSION)/g" $@
+       @$(PERL) -pi.bak -e "s/\@LIBXMLXX_MINOR_VERSION\@/$(PKG_MINOR_VERSION)/g" $@
+       @$(PERL) -pi.bak -e "s/\@LIBXMLXX_MICRO_VERSION\@/$(PKG_MICRO_VERSION)/g" $@
+       @$(PERL) -pi.bak -e 
"s/\@PACKAGE_VERSION\@/$(PKG_MAJOR_VERSION).$(PKG_MINOR_VERSION).$(PKG_MICRO_VERSION)/g" $@
+       @$(PERL) -pi.bak -e "s/\@PACKAGE_NAME\@/libxml++-$(PKG_MAJOR_VERSION).$(PKG_MINOR_VERSION)/g" $@
+       @del $@.bak
+
+# You may change LIBXMLXX_DISABLE_DEPRECATED if you know what you are doing
+libxml++\libxml++config.h: pkg-ver.mak ..\libxml++config.h.in
+       @echo Generating $@...
+       @copy "..\$(@F).in" "$@"
+       @$(PERL) -pi.bak -e "s/\#undef LIBXMLXX_DISABLE_DEPRECATED/\/\* \#undef LIBXMLXX_DISABLE_DEPRECATED 
\*\//g" $@
+       @$(PERL) -pi.bak -e "s/\#undef LIBXMLXX_HAVE_EXCEPTION_PTR/\#define LIBXMLXX_HAVE_EXCEPTION_PTR 1/g" 
$@
+       @$(PERL) -pi.bak -e "s/\#undef LIBXMLXX_MAJOR_VERSION/\#define LIBXMLXX_MAJOR_VERSION 
$(PKG_MAJOR_VERSION)/g" $@
+       @$(PERL) -pi.bak -e "s/\#undef LIBXMLXX_MINOR_VERSION/\#define LIBXMLXX_MINOR_VERSION 
$(PKG_MINOR_VERSION)/g" $@
+       @$(PERL) -pi.bak -e "s/\#undef LIBXMLXX_MICRO_VERSION/\#define LIBXMLXX_MICRO_VERSION 
$(PKG_MICRO_VERSION)/g" $@
+       @del $@.bak
+
+pkg-ver.mak: ..\configure.ac
+       @echo Generating version info Makefile Snippet...
+       @$(PERL) -00 -ne "print if /AC_INIT\(/" $** |   \
+       $(PERL) -pe "tr/, /\n/s" |      \
+       $(PERL) -ne "print if 2 .. 2" | \
+       $(PERL) -ne "print /\[(.*)\]/" > ver.txt
+       @echo @echo off>pkg-ver.bat
+       @echo.>>pkg-ver.bat
+       @echo set /p libxmlxx_ver=^<ver.txt>>pkg-ver.bat
+       @echo for /f "tokens=1,2,3 delims=." %%%%a IN ("%libxmlxx_ver%") do (echo PKG_MAJOR_VERSION=%%%%a^& 
echo PKG_MINOR_VERSION=%%%%b^& echo PKG_MICRO_VERSION=%%%%c)^>$@>>pkg-ver.bat
+       @pkg-ver.bat
+       @del ver.txt pkg-ver.bat
+       $(MAKE) /f Makefile.vc CFG=$(CFG) GENERATE_VERSIONED_FILES=1 libxml++\libxml++.rc
diff --git a/MSVC_NMake/info-msvc.mak b/MSVC_NMake/info-msvc.mak
new file mode 100644
index 0000000..59ccfd9
--- /dev/null
+++ b/MSVC_NMake/info-msvc.mak
@@ -0,0 +1,44 @@
+# NMake Makefile portion for displaying config info
+
+all-build-info:
+       @echo.
+       @echo ----------
+       @echo Build info
+       @echo ---------
+       @echo Build Type: $(CFG)
+
+help:
+       @echo.
+       @echo ============================
+       @echo Building glibmm Using NMake
+       @echo ============================
+       @echo nmake /f Makefile.vc CFG=[release^|debug] ^<PREFIX=PATH^> ^<option1=xxx option2=xxx^>
+       @echo.
+       @echo Where:
+       @echo ------
+       @echo CFG: Required, use CFG=release for an optimized build and CFG=debug
+       @echo for a debug build.  PDB files are generated for all builds.
+       @echo.
+       @echo PREFIX: Optional, the path where dependent libraries and tools may be
+       @echo found, default is ^$(srcrootdir)\..\vs^$(short_vs_ver)\^$(platform),
+       @echo where ^$(short_vs_ver) is 15 for VS 2017 and so on; and
+       @echo ^$(platform) is Win32 for 32-bit builds and x64 for x64 builds.
+       @echo.
+       @echo -----
+       @echo A few options are supported here, namely:
+       @echo.
+       @echo USE_COMPAT_LIBS: Use this if your libsigc++ was built with Visual Studio 2017 or
+       @echo 2019 but has the "vc140" in its .lib filename.
+       @echo.
+       @echo USE_MESON_LIBS: Use DLLs and LIBs of C++ dependencies that are built with Meson,
+       @echo as applicable.
+       @echo ======
+       @echo A 'clean' target is supported to remove all generated files, intermediate
+       @echo object files and binaries for the specified configuration.
+       @echo.
+       @echo An 'install' target is supported to copy the build (DLLs, utility programs,
+       @echo LIBs, along with the header files) to appropriate locations under ^$(PREFIX).
+       @echo.
+       @echo A 'tests' target is supported to build the test programs.
+       @echo ======
+       @echo.
diff --git a/MSVC_NMake/install.mak b/MSVC_NMake/install.mak
new file mode 100644
index 0000000..ca65ba2
--- /dev/null
+++ b/MSVC_NMake/install.mak
@@ -0,0 +1,18 @@
+# NMake Makefile snippet for copying the built libraries, utilities and headers to
+# a path under $(PREFIX).
+
+install: all
+       @if not exist $(PREFIX)\bin\ md $(PREFIX)\bin
+       @if not exist $(PREFIX)\lib\libxml++-$(LIBXMLXX_MAJOR_VERSION).$(LIBXMLXX_MINOR_VERSION)\include\ md 
$(PREFIX)\lib\libxml++-$(LIBXMLXX_MAJOR_VERSION).$(LIBXMLXX_MINOR_VERSION)\include
+       @if not exist 
$(PREFIX)\include\libxml++-$(LIBXMLXX_MAJOR_VERSION).$(LIBXMLXX_MINOR_VERSION)\libxml++\ @md 
$(PREFIX)\include\libxml++-$(LIBXMLXX_MAJOR_VERSION).$(LIBXMLXX_MINOR_VERSION)\libxml++
+       @for /f %d in ('dir /ad /b ..\libxml++') do @if not exist 
$(PREFIX)\include\libxml++-$(LIBXMLXX_MAJOR_VERSION).$(LIBXMLXX_MINOR_VERSION)\libxml++\%d\ @md 
$(PREFIX)\include\libxml++-$(LIBXMLXX_MAJOR_VERSION).$(LIBXMLXX_MINOR_VERSION)\libxml++\%d
+       @copy /b "$(LIBXMLXX_DLL)" $(PREFIX)\bin
+       @copy /b "$(LIBXMLXX_DLL:dll=pdb)" $(PREFIX)\bin
+       @copy /b "$(LIBXMLXX_LIB)" $(PREFIX)\lib
+       @for %h in (libxml++.h $(h_root_sources_public:/=\)) do @copy "..\libxml++\%h" 
"$(PREFIX)\include\libxml++-$(LIBXMLXX_MAJOR_VERSION).$(LIBXMLXX_MINOR_VERSION)\libxml++\"
+       @for %h in ($(h_exceptions_sources_public:/=\)) do @copy "..\libxml++\%h" 
"$(PREFIX)\include\libxml++-$(LIBXMLXX_MAJOR_VERSION).$(LIBXMLXX_MINOR_VERSION)\libxml++\exceptions\"
+       @for %h in ($(h_io_sources_public:/=\)) do @copy "..\libxml++\%h" 
"$(PREFIX)\include\libxml++-$(LIBXMLXX_MAJOR_VERSION).$(LIBXMLXX_MINOR_VERSION)\libxml++\io\"
+       @for %h in ($(h_nodes_sources_public:/=\)) do @copy "..\libxml++\%h" 
"$(PREFIX)\include\libxml++-$(LIBXMLXX_MAJOR_VERSION).$(LIBXMLXX_MINOR_VERSION)\libxml++\nodes\"
+       @for %h in ($(h_parsers_sources_public:/=\)) do @copy "..\libxml++\%h" 
"$(PREFIX)\include\libxml++-$(LIBXMLXX_MAJOR_VERSION).$(LIBXMLXX_MINOR_VERSION)\libxml++\parsers\"
+       @for %h in ($(h_validators_sources_public:/=\)) do @copy "..\libxml++\%h" 
"$(PREFIX)\include\libxml++-$(LIBXMLXX_MAJOR_VERSION).$(LIBXMLXX_MINOR_VERSION)\libxml++\validators\"
+       @copy ".\libxml++\libxml++config.h" 
"$(PREFIX)\lib\libxml++-$(LIBXMLXX_MAJOR_VERSION).$(LIBXMLXX_MINOR_VERSION)\include\"


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