From df2e1b0cb8047ae9102c01fbb8df442d865ffa74 Mon Sep 17 00:00:00 2001 From: Chun-wei Fan Date: Mon, 12 Oct 2015 17:05:13 +0800 Subject: MSVC builds: Move math.h compatibility header Move the math.h compatibility header from build/win32/math-compat to build/win32/vs9, and copy it to build/win32/vs10 and build/win32/vs11 during 'make dist'. This is because we don't need the header for Visual Studio 2013 and later, and the math.h header shipped with Visual Studio 2015 is now included in Windows 10 SDK's UCRT directory, so the old way of including the compiler-shipped math.h by doing '#include <../include/math.h>' would not work there. This will fix the build on Visual Studio 2015. https://bugzilla.gnome.org/show_bug.cgi?id=756381 --- build/win32/Makefile.am | 2 - build/win32/math-compat/math.h | 58 ------------------------ build/win32/vs10/Makefile.am | 8 +++- build/win32/vs10/gdk-pixbuf-build-defines.props | 2 +- build/win32/vs11/Makefile.am | 6 ++- build/win32/vs9/Makefile.am | 3 +- build/win32/vs9/gdk-pixbuf-build-defines.vsprops | 2 +- build/win32/vs9/math.h | 58 ++++++++++++++++++++++++ 8 files changed, 73 insertions(+), 66 deletions(-) delete mode 100644 build/win32/math-compat/math.h create mode 100644 build/win32/vs9/math.h (limited to 'build') diff --git a/build/win32/Makefile.am b/build/win32/Makefile.am index c6f1aa4a5..6a7b4b17b 100644 --- a/build/win32/Makefile.am +++ b/build/win32/Makefile.am @@ -5,6 +5,4 @@ SUBDIRS = \ vs12 \ vs14 -EXTRA_DIST = math-compat/math.h - -include $(top_srcdir)/git.mk diff --git a/build/win32/math-compat/math.h b/build/win32/math-compat/math.h deleted file mode 100644 index a442179d2..000000000 --- a/build/win32/math-compat/math.h +++ /dev/null @@ -1,58 +0,0 @@ -/* GdkPixbuf library - Compatibility Math Header for - * pre-Visual Studio 2013 Headers - * to Build GDK-Pixbuf - * - * Copyright (C) 2014 Chun-wei Fan - * - * Authors: Chun-wei Fan - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; either - * version 2 of the License, or (at your option) any later version. - * - * This library is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with this library; if not, see . - */ - -#ifndef _MSC_VER -#error "This Header is intended for Visual Studio Builds only" -#endif - -/* Include the stock Visual Studio math.h first */ -#include <../include/math.h> - -/* Visual Studio 2013 and later do not need this compatibility item */ -#if (_MSC_VER < 1800) - -#ifndef __MSVC_MATH_COMPAT_H__ -#define __MSVC_MATH_COMPAT_H__ - -/* Note: This is a rather generic fallback implementation for round(), which is - * okay for the purposes for GTK+, but please note the following if intending - * use this implementation: - * - * -The largest floating point value strictly less than 0.5. The problem is - * that the addition produces 1 due to rounding. - * - * -A set of large integers near 2^52 for which adding 0.5 is the same as - * adding 1, again due to rounding. - */ - -static __inline double -round (double x) -{ - if (x >= 0) - return floor (x + 0.5); - else - return ceil (x - 0.5); -} - -#endif /* __MSVC_MATH_COMPAT_H__ */ - -#endif /* _MSC_VER < 1800 */ \ No newline at end of file diff --git a/build/win32/vs10/Makefile.am b/build/win32/vs10/Makefile.am index dd891edb9..d25fb7596 100644 --- a/build/win32/vs10/Makefile.am +++ b/build/win32/vs10/Makefile.am @@ -19,12 +19,16 @@ EXTRA_DIST = \ gdk-pixbuf-pixdata.vcxproj \ gdk-pixbuf-pixdata.vcxproj.filters \ gdk-pixbuf-install.vcxproj \ - $(GENERATED_ITEMS) + $(GENERATED_ITEMS) \ + math.h gdk-pixbuf-install.props: $(top_srcdir)/build/win32/vs10/gdk-pixbuf-install.propsin gdk-pixbuf.vs10.headers $(CPP) -P - <$(top_srcdir)/build/win32/vs10/gdk-pixbuf-install.propsin >$@ rm gdk-pixbuf.vs10.headers -DISTCLEANFILES = $(GENERATED_ITEMS) +math.h: $(top_srcdir)/build/win32/vs9/math.h + cp $< $@ + +DISTCLEANFILES = $(GENERATED_ITEMS) math.h -include $(top_srcdir)/git.mk diff --git a/build/win32/vs10/gdk-pixbuf-build-defines.props b/build/win32/vs10/gdk-pixbuf-build-defines.props index d95b62afa..42598652f 100644 --- a/build/win32/vs10/gdk-pixbuf-build-defines.props +++ b/build/win32/vs10/gdk-pixbuf-build-defines.props @@ -23,7 +23,7 @@ - ..\..\..;..\..\..\gdk-pixbuf;..\math-compat;$(GlibEtcInstallRoot)\include\glib-2.0;$(GlibEtcInstallRoot)\lib\glib-2.0\include;$(GlibEtcInstallRoot)\include;%(AdditionalIncludeDirectories) + ..\..\..;..\..\..\gdk-pixbuf;.;$(GlibEtcInstallRoot)\include\glib-2.0;$(GlibEtcInstallRoot)\lib\glib-2.0\include;$(GlibEtcInstallRoot)\include;%(AdditionalIncludeDirectories) HAVE_CONFIG_H;G_DISABLE_SINGLE_INCLUDES;GDK_PIXBUF_DISABLE_SINGLE_INCLUDES;%(PreprocessorDefinitions) msvc_recommended_pragmas.h;%(ForcedIncludeFiles) true diff --git a/build/win32/vs11/Makefile.am b/build/win32/vs11/Makefile.am index fa74c9c65..282b4f1f1 100644 --- a/build/win32/vs11/Makefile.am +++ b/build/win32/vs11/Makefile.am @@ -13,7 +13,8 @@ EXTRA_DIST = \ gdk-pixbuf-query-loaders.vcxproj.filters \ gdk-pixbuf-pixdata.vcxproj \ gdk-pixbuf-pixdata.vcxproj.filters \ - gdk-pixbuf-install.vcxproj + gdk-pixbuf-install.vcxproj \ + math.h DISTCLEANFILES = $(EXTRA_DIST) @@ -23,4 +24,7 @@ MSVC_FORMAT_VER = 12 include $(top_srcdir)/build/Makefile-newvs.am +math.h: $(top_srcdir)/build/win32/vs9/math.h + cp $< $@ + -include $(top_srcdir)/git.mk diff --git a/build/win32/vs9/Makefile.am b/build/win32/vs9/Makefile.am index 0e35530c7..871133742 100644 --- a/build/win32/vs9/Makefile.am +++ b/build/win32/vs9/Makefile.am @@ -14,7 +14,8 @@ EXTRA_DIST = \ gdk-pixbuf-query-loaders.vcproj \ gdk-pixbuf-pixdata.vcproj \ gdk-pixbuf-install.vcproj \ - $(GENERATED_ITEMS) + $(GENERATED_ITEMS) \ + math.h gdk-pixbuf-install.vsprops: $(top_srcdir)/build/win32/vs9/gdk-pixbuf-install.vspropsin gdk-pixbuf.headers $(CPP) -P - <$(top_srcdir)/build/win32/vs9/gdk-pixbuf-install.vspropsin >$@ diff --git a/build/win32/vs9/gdk-pixbuf-build-defines.vsprops b/build/win32/vs9/gdk-pixbuf-build-defines.vsprops index ccad986f6..d4a767eef 100644 --- a/build/win32/vs9/gdk-pixbuf-build-defines.vsprops +++ b/build/win32/vs9/gdk-pixbuf-build-defines.vsprops @@ -9,7 +9,7 @@ > + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, see . + */ + +#ifndef _MSC_VER +#error "This Header is intended for Visual Studio Builds only" +#endif + +/* Include the stock Visual Studio math.h first */ +#include <../include/math.h> + +/* Visual Studio 2013 and later do not need this compatibility item */ +#if (_MSC_VER < 1800) + +#ifndef __MSVC_MATH_COMPAT_H__ +#define __MSVC_MATH_COMPAT_H__ + +/* Note: This is a rather generic fallback implementation for round(), which is + * okay for the purposes for GTK+, but please note the following if intending + * use this implementation: + * + * -The largest floating point value strictly less than 0.5. The problem is + * that the addition produces 1 due to rounding. + * + * -A set of large integers near 2^52 for which adding 0.5 is the same as + * adding 1, again due to rounding. + */ + +static __inline double +round (double x) +{ + if (x >= 0) + return floor (x + 0.5); + else + return ceil (x - 0.5); +} + +#endif /* __MSVC_MATH_COMPAT_H__ */ + +#endif /* _MSC_VER < 1800 */ \ No newline at end of file -- cgit v1.2.1