CMake: enable Direct2D graphics context by default

Disable it when the d2d1.h header is not found.
When using MSVC, match the behaviour of setup.h.
This commit is contained in:
Maarten Bent
2018-11-04 16:30:20 +01:00
parent 5c4741430a
commit e1e5169e4b
2 changed files with 17 additions and 6 deletions

View File

@@ -142,10 +142,6 @@ if(DEFINED wxUSE_OLE AND wxUSE_OLE)
set(wxUSE_OLE_AUTOMATION ON)
endif()
if(DEFINED wxUSE_GRAPHICS_DIRECT2D AND NOT wxUSE_GRAPHICS_CONTEXT)
set(wxUSE_GRAPHICS_DIRECT2D OFF)
endif()
if(wxUSE_OPENGL)
set(wxUSE_GLCANVAS ON)
endif()
@@ -174,6 +170,21 @@ if(wxUSE_GUI)
set(wxUSE_ENH_METAFILE ON)
endif()
# Direct2D check
if(WIN32 AND wxUSE_GRAPHICS_DIRECT2D)
check_include_file(d2d1.h HAVE_D2D1_H)
if (NOT HAVE_D2D1_H)
wx_option_force_value(wxUSE_GRAPHICS_DIRECT2D OFF)
endif()
endif()
if(MSVC) # match setup.h
if(MSVC_VERSION LESS 1600)
wx_option_force_value(wxUSE_GRAPHICS_DIRECT2D OFF)
else()
wx_option_force_value(wxUSE_GRAPHICS_DIRECT2D ${wxUSE_GRAPHICS_CONTEXT})
endif()
endif()
# WXQT checks
if(WXQT)
wx_option_force_value(wxUSE_WEBVIEW OFF)

View File

@@ -208,8 +208,8 @@ if(APPLE)
set(wxUSE_GRAPHICS_CONTEXT ON)
else()
wx_option(wxUSE_GRAPHICS_CONTEXT "use graphics context 2D drawing API")
if (WIN32 AND (NOT MSVC OR MSVC_VERSION LESS 1600))
wx_option(wxUSE_GRAPHICS_DIRECT2D "enable Direct2D graphics context" OFF)
if(WIN32)
wx_option(wxUSE_GRAPHICS_DIRECT2D "enable Direct2D graphics context")
endif()
endif()