From e281ed8bacd81de0ff49340ba817fa5a2908d71b Mon Sep 17 00:00:00 2001 From: nyamatongwe Date: Tue, 17 Jul 2012 19:38:23 +1000 Subject: Refine checking for Direct2D and DirectWrite by using NTDDI_WIN7 to indicate a recent SDK and allow disabling Direct2D by defining DISABLE_D2D. Run a test compile of a file that includes these headers and use compilation failure to disable Direct2D. --- win32/CheckD2D.cxx | 3 +++ win32/PlatWin.cxx | 2 +- win32/ScintillaWin.cxx | 2 +- win32/scintilla.mak | 5 +++++ 4 files changed, 10 insertions(+), 2 deletions(-) create mode 100644 win32/CheckD2D.cxx diff --git a/win32/CheckD2D.cxx b/win32/CheckD2D.cxx new file mode 100644 index 000000000..80f5d46d2 --- /dev/null +++ b/win32/CheckD2D.cxx @@ -0,0 +1,3 @@ +// This file is compiled to check whether Direct2D and DirectWrite headers are available. +#include +#include diff --git a/win32/PlatWin.cxx b/win32/PlatWin.cxx index 507567bb8..723995407 100644 --- a/win32/PlatWin.cxx +++ b/win32/PlatWin.cxx @@ -26,7 +26,7 @@ #include #include -#if defined(_MSC_VER) && (_MSC_VER > 1200) +#if defined(NTDDI_WIN7) && !defined(DISABLE_D2D) #define USE_D2D 1 #endif diff --git a/win32/ScintillaWin.cxx b/win32/ScintillaWin.cxx index 367e33466..2caa685a1 100644 --- a/win32/ScintillaWin.cxx +++ b/win32/ScintillaWin.cxx @@ -26,7 +26,7 @@ #include #include -#if defined(_MSC_VER) && (_MSC_VER > 1200) +#if defined(NTDDI_WIN7) && !defined(DISABLE_D2D) #define USE_D2D 1 #endif diff --git a/win32/scintilla.mak b/win32/scintilla.mak index b4ca7204a..e57da3c71 100644 --- a/win32/scintilla.mak +++ b/win32/scintilla.mak @@ -36,6 +36,11 @@ CXXFLAGS=$(CXXFLAGS) $(NOLOGO) LDFLAGS=$(LDFLAGS) $(NOLOGO) !ENDIF +!IF [cl -c -nologo CheckD2D.cxx >NUL:] +CXXFLAGS=$(CXXFLAGS) -DDISABLE_D2D +!MESSAGE Direct2D is not available +!ENDIF + !IFDEF DEBUG CXXFLAGS=$(CXXFLAGS) $(CXXDEBUG) LDFLAGS=$(LDDEBUG) $(LDFLAGS) -- cgit v1.2.3