Changing Direct2D detection on Win32 platform

32 views
Skip to first unread message

Neil Hodgson

unread,
Mar 29, 2018, 5:37:33 AM3/29/18
to Scintilla mailing list
Currently, win32/makefile and win32/scintilla.mak try to compile a test file CheckD2D.cxx that includes d2d1.h and dwrite.h. If this fails then Direct2D is not available and DISABLE_D2D is defined so conditional compilation will avoid using Direct2D.

With C++17, the availability of headers can be tested with the __has_include feature. This could simplify the make files and remove the CheckD2D.cxx file.

This could be implemented by changing the current guard from

#if defined(NTDDI_WIN7) && !defined(DISABLE_D2D)

to

#if !defined(DISABLE_D2D) && __has_include(<d2d1.h>)

NTDDI_WIN7 is always defined nowadays.

Another possibility would be to require Direct2D support or to always include Direct2D support unless the disabling flag is set manually.

MinGW-64 includes Direct2D support (for both 32-bit and 64-bit builds) but MinGW-32 does not.

Scintilla does not link to Direct2D statically and there are runtime checks so that there will not be any problems on old versions of Windows that do not have Direct2D.

Neil

Neil Hodgson

unread,
Apr 4, 2018, 2:56:20 AM4/4/18
to Scintilla mailing list
Most current Win32 build systems include Direct2D support so Scintilla no longer tries so hard to cope with its absence. The DISABLE_D2D preprocessor symbol is still checked in the source code.

The Direct2D guard condition has been changed from

#if defined(NTDDI_WIN7) && !defined(DISABLE_D2D)

to

#if !defined(DISABLE_D2D)

DISABLE_D2D is no longer automatically set during build but may be set by a custom make or project file. The CheckD2D.cxx file that was used for checking support has been removed.

Change set:
https://sourceforge.net/p/scintilla/code/ci/9c1997a14d89200ee4755226750d2ef8452a4ba9/

Neil

Reply all
Reply to author
Forward
0 new messages