changeset 3127:e0257da7fcdc

[MSVC] only use special math.h with clgcc and similar. - cc-msvc.cc: define __CLGCC__ macro - math/math.h.in: defaults to stock math.h if __CLGCC__ is not defined - math/Makefile: add -D__CLGCC__ for files compiled with MSVC
author Michael Goffioul <michael.goffioul@gmail.com>
date Thu, 11 Jul 2013 23:47:31 -0400
parents 7421017ece8e
children 9e26e3930422
files src/build-msvctools/cc-msvc.cc src/build-msvctools/math/Makefile src/build-msvctools/math/math.h.in
diffstat 3 files changed, 11 insertions(+), 2 deletions(-) [+]
line wrap: on
line diff
--- a/src/build-msvctools/cc-msvc.cc	Tue Jul 09 15:28:11 2013 -0400
+++ b/src/build-msvctools/cc-msvc.cc	Thu Jul 11 23:47:31 2013 -0400
@@ -356,7 +356,7 @@
 
 	prog = "cl";
 	// Default target is WinXP SP3
-	clopt = "-nologo -MD -DWIN32 -D_WIN32 -D__WIN32__ -DNTDDI_VERSION=0x05010300 -D_WIN32_WINNT=0x0501";
+	clopt = "-nologo -MD -DWIN32 -D__CLGCC__ -D_WIN32 -D__WIN32__ -DNTDDI_VERSION=0x05010300 -D_WIN32_WINNT=0x0501";
 	linkopt = "-nologo";
 	cllinkopt = "";
 	sourcefile = "";
--- a/src/build-msvctools/math/Makefile	Tue Jul 09 15:28:11 2013 -0400
+++ b/src/build-msvctools/math/Makefile	Thu Jul 11 23:47:31 2013 -0400
@@ -38,7 +38,7 @@
 
 %.obj: %.c
 	@echo "MSC $<"
-	@cl -nologo -MD -O2 -Fo$@ -c $<
+	@cl -nologo -MD -O2 -D__CLGCC__ -Fo$@ -c $<
 
 %.o : %.S
 	@echo "AS $<"
--- a/src/build-msvctools/math/math.h.in	Tue Jul 09 15:28:11 2013 -0400
+++ b/src/build-msvctools/math/math.h.in	Thu Jul 11 23:47:31 2013 -0400
@@ -9,6 +9,13 @@
 # error "this header can only be used with Visual C++ compiler"
 #endif
 
+#ifndef __CLGCC__
+/* Only use this header with clgcc/clg++, otherwise fall back
+ * to the default VC++ header.
+ */
+#include <@MSVCMATH@>
+#else
+
 /* Make sure math constants are defined */
 #ifndef _USE_MATH_DEFINES
 # define _USE_MATH_DEFINES
@@ -320,4 +327,6 @@
 }
 #endif
 
+#endif /* __CLGCC__ */
+
 #endif