From e3cd67d2587ac4c3f5a16a1b87ca359fde98413c Mon Sep 17 00:00:00 2001 From: Chun-wei Fan Date: Fri, 17 Feb 2017 14:18:26 +0800 Subject: [PATCH] Visual Studio builds: Support Visual Studio 2017 Update the autotools scripts so that we can copy the Visual Studio 2010 and update items as necessary to obtain the Visual Studio 2017 projects. Note that the toolset version string format has changed for Visual Studio 2017, so a custom toolset version string is allowed and used if specified, otherwise the toolset version string is generated as we did before. Note also that Visual Studio 2017 aims to be compatible with Visual Studio 2015 on the CRT level, so it should be possible to use 2017- compiled binaries with 2015-compiled binaries without problems. --- build/Makefile-newvs.am | 18 +++++++++++++----- build/win32/Makefile.am | 3 ++- build/win32/vs10/Makefile.am | 1 + build/win32/vs15/Makefile.am | 35 +++++++++++++++++++++++++++++++++++ configure.ac | 7 +++++++ 5 files changed, 58 insertions(+), 6 deletions(-) create mode 100644 build/win32/vs15/Makefile.am diff --git a/build/Makefile-newvs.am b/build/Makefile-newvs.am index b5e321607..81611776e 100644 --- a/build/Makefile-newvs.am +++ b/build/Makefile-newvs.am @@ -9,9 +9,17 @@ # Author: Fan, Chun-wei # November 05, 2012 -# MSVC_VER_LONG: Long Version of Visual Studio (2012, 2013, 14 and so on) -# MSVC_VER: Short Version of Visual Studio (11 for 2012, 12 for 2013, 14 for 2015 and so on) -# MSVC_FORMAT_VER: Use 12 for MSVC 2012 through 2015 +# MSVC_VER_LONG: Long Version of target Visual Studio (2012, 2013, 14 and so on) +# MSVC_VER: Short Version of target Visual Studio (110 for 2012, 120 for 2013, 140 for 2015, 141 for 2017) +# MSVC_TOOLSET: Use if target MSVC toolsett is not in the form v $(MSVC_VER)0, meaning v$(MSVC_TOOLSET) + +if MSVC_BASE_NO_TOOLSET_SET +MSVC_BASE_TOOLSET = $(MSVC_BASE_VER)0 +endif + +if MSVC_NO_TOOLSET_SET +MSVC_TOOLSET = $(MSVC_VER)0 +endif %.sln: sed 's/11\.00/$(MSVC_FORMAT_VER)\.00/g' < $(top_srcdir)/build/win32/vs10/$@ > $(top_builddir)/build/win32/vs$(MSVC_VER)/$@.tmp @@ -25,9 +33,9 @@ %.vcxproj: if test -e $(top_srcdir)/build/win32/vs10/$@; then \ - sed 's/v100/v$(MSVC_VER)0/g' < $(top_srcdir)/build/win32/vs10/$@ > $(top_builddir)/build/win32/vs$(MSVC_VER)/$@; \ + sed 's/v100/v$(MSVC_TOOLSET)/g' < $(top_srcdir)/build/win32/vs10/$@ > $(top_builddir)/build/win32/vs$(MSVC_VER)/$@; \ else \ - sed 's/v100/v$(MSVC_VER)0/g' < $(top_builddir)/build/win32/vs10/$@ > $(top_builddir)/build/win32/vs$(MSVC_VER)/$@; \ + sed 's/v100/v$(MSVC_TOOLSET)/g' < $(top_builddir)/build/win32/vs10/$@ > $(top_builddir)/build/win32/vs$(MSVC_VER)/$@; \ fi %.props: $(top_builddir)/build/win32/vs10/Makefile diff --git a/build/win32/Makefile.am b/build/win32/Makefile.am index 3ad51d883..1e2aadd03 100644 --- a/build/win32/Makefile.am +++ b/build/win32/Makefile.am @@ -30,7 +30,8 @@ SUBDIRS = \ vs10 \ vs11 \ vs12 \ - vs14 + vs14 \ + vs15 EXTRA_DIST += \ detectenv-msvc.mak \ diff --git a/build/win32/vs10/Makefile.am b/build/win32/vs10/Makefile.am index 25f228900..822c764c2 100644 --- a/build/win32/vs10/Makefile.am +++ b/build/win32/vs10/Makefile.am @@ -46,6 +46,7 @@ gtk-install.props: $(MSVC_INTERMEDIATE_FILES) -$(RM) $(top_builddir)/build/win32/vs11/gtk-install.props -$(RM) $(top_builddir)/build/win32/vs12/gtk-install.props -$(RM) $(top_builddir)/build/win32/vs14/gtk-install.props + -$(RM) $(top_builddir)/build/win32/vs15/gtk-install.props $(CPP) -P - <$(top_srcdir)/build/win32/vs10/gtk-install.propsin >$@ rm $(MSVC_INTERMEDIATE_FILES) diff --git a/build/win32/vs15/Makefile.am b/build/win32/vs15/Makefile.am new file mode 100644 index 000000000..dcee27a13 --- /dev/null +++ b/build/win32/vs15/Makefile.am @@ -0,0 +1,35 @@ +include $(top_srcdir)/Makefile.decl + +EXTRA_DIST += \ + README.txt \ + gtk+.sln \ + gtk-build-defines.props \ + gtk-gen-srcs.props \ + gtk-install.props \ + gtk-version-paths.props \ + gdk-win32.vcxproj \ + gdk-win32.vcxproj.filters \ + gdk.vcxproj \ + gdk.vcxproj.filters \ + gtk.vcxproj \ + gtk.vcxproj.filters \ + gtk-demo.vcxproj \ + gtk-demo.vcxproj.filters \ + gailutil.vcxproj \ + gailutil.vcxproj.filters \ + libwimp.vcxproj \ + libwimp.vcxproj.filters \ + gtk-update-icon-cache.vcxproj \ + gtk-update-icon-cache.vcxproj.filters \ + gtk-install.vcxproj \ + gtk-install.vcxproj.filters + +DISTCLEANFILES = $(EXTRA_DIST) + + +MSVC_VER = 15 +MSVC_VER_LONG = 15 +MSVC_TOOLSET = 141 +MSVC_FORMAT_VER = 12 + +include $(top_srcdir)/build/Makefile-newvs.am diff --git a/configure.ac b/configure.ac index 9b7151aee..c3e43395e 100644 --- a/configure.ac +++ b/configure.ac @@ -1623,6 +1623,12 @@ fi AM_CONDITIONAL(ENABLE_MAN, test x$enable_man != xno) +################################################## +# Check whether MSVC toolset is explicitly set +################################################## + +AM_CONDITIONAL(MSVC_BASE_NO_TOOLSET_SET, [test x$MSVC_BASE_TOOLSET = x]) +AM_CONDITIONAL(MSVC_NO_TOOLSET_SET, [test x$MSVC_TOOLSET = x]) ################################################## # Output commands @@ -1747,6 +1753,7 @@ build/win32/vs10/gtk-version-paths.props build/win32/vs11/Makefile build/win32/vs12/Makefile build/win32/vs14/Makefile +build/win32/vs15/Makefile gdk/Makefile gdk/x11/Makefile gdk/win32/Makefile