Detect Direct2D when building wxMSW with configure
Check for Direct2D headers (only, as DLLs are loaded during run-time anyhow) and enable Direct2D-based wxGraphicsContext implementation if they are available when building wxMSW with configure.
This commit is contained in:
85
configure
vendored
85
configure
vendored
@@ -1245,6 +1245,7 @@ enable_printarch
|
||||
enable_svg
|
||||
enable_webview
|
||||
enable_graphics_ctx
|
||||
enable_graphics_d2d
|
||||
enable_clipboard
|
||||
enable_dnd
|
||||
enable_controls
|
||||
@@ -2212,6 +2213,7 @@ Optional Features:
|
||||
--enable-svg use wxSVGFileDC device context
|
||||
--enable-webview use wxWebView library
|
||||
--enable-graphics_ctx use graphics context 2D drawing API
|
||||
--enable-graphics-d2d use Direct2D-based graphics context
|
||||
--enable-clipboard use wxClipboard class
|
||||
--enable-dnd use Drag'n'Drop classes
|
||||
--disable-controls disable compilation of all standard controls
|
||||
@@ -9094,6 +9096,38 @@ fi
|
||||
|
||||
fi
|
||||
|
||||
if test "$wxUSE_MSW" = 1 ; then
|
||||
|
||||
enablestring=
|
||||
defaultval=$wxUSE_ALL_FEATURES
|
||||
if test -z "$defaultval"; then
|
||||
if test x"$enablestring" = xdisable; then
|
||||
defaultval=yes
|
||||
else
|
||||
defaultval=no
|
||||
fi
|
||||
fi
|
||||
|
||||
# Check whether --enable-graphics_d2d was given.
|
||||
if test "${enable_graphics_d2d+set}" = set; then :
|
||||
enableval=$enable_graphics_d2d;
|
||||
if test "$enableval" = yes; then
|
||||
wx_cv_use_graphics_d2d='wxUSE_GRAPHICS_DIRECT2D=yes'
|
||||
else
|
||||
wx_cv_use_graphics_d2d='wxUSE_GRAPHICS_DIRECT2D=no'
|
||||
fi
|
||||
|
||||
else
|
||||
|
||||
wx_cv_use_graphics_d2d='wxUSE_GRAPHICS_DIRECT2D=${'DEFAULT_wxUSE_GRAPHICS_DIRECT2D":-$defaultval}"
|
||||
|
||||
fi
|
||||
|
||||
|
||||
eval "$wx_cv_use_graphics_d2d"
|
||||
|
||||
fi
|
||||
|
||||
|
||||
|
||||
enablestring=
|
||||
@@ -38020,6 +38054,57 @@ $as_echo "$wx_cv_lib_gdiplus" >&6; }
|
||||
if test "$wx_cv_lib_gdiplus" = "yes"; then
|
||||
wx_has_graphics=1
|
||||
fi
|
||||
|
||||
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking if Direct2D is available" >&5
|
||||
$as_echo_n "checking if Direct2D is available... " >&6; }
|
||||
if ${wx_cv_lib_direct2d+:} false; then :
|
||||
$as_echo_n "(cached) " >&6
|
||||
else
|
||||
|
||||
ac_ext=cpp
|
||||
ac_cpp='$CXXCPP $CPPFLAGS'
|
||||
ac_compile='$CXX -c $CXXFLAGS $CPPFLAGS conftest.$ac_ext >&5'
|
||||
ac_link='$CXX -o conftest$ac_exeext $CXXFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5'
|
||||
ac_compiler_gnu=$ac_cv_cxx_compiler_gnu
|
||||
|
||||
cat confdefs.h - <<_ACEOF >conftest.$ac_ext
|
||||
/* end confdefs.h. */
|
||||
#include <windows.h>
|
||||
#include <d2d1.h>
|
||||
#include <dwrite.h>
|
||||
|
||||
int
|
||||
main ()
|
||||
{
|
||||
|
||||
ID2D1Factory* factory = NULL;
|
||||
|
||||
;
|
||||
return 0;
|
||||
}
|
||||
_ACEOF
|
||||
if ac_fn_cxx_try_compile "$LINENO"; then :
|
||||
wx_cv_lib_direct2d=yes
|
||||
else
|
||||
wx_cv_lib_direct2d=no
|
||||
|
||||
fi
|
||||
rm -f core conftest.err conftest.$ac_objext conftest.$ac_ext
|
||||
ac_ext=c
|
||||
ac_cpp='$CPP $CPPFLAGS'
|
||||
ac_compile='$CC -c $CFLAGS $CPPFLAGS conftest.$ac_ext >&5'
|
||||
ac_link='$CC -o conftest$ac_exeext $CFLAGS $CPPFLAGS $LDFLAGS conftest.$ac_ext $LIBS >&5'
|
||||
ac_compiler_gnu=$ac_cv_c_compiler_gnu
|
||||
|
||||
|
||||
|
||||
fi
|
||||
{ $as_echo "$as_me:${as_lineno-$LINENO}: result: $wx_cv_lib_direct2d" >&5
|
||||
$as_echo "$wx_cv_lib_direct2d" >&6; }
|
||||
if test "$wx_cv_lib_direct2d" = "yes"; then
|
||||
$as_echo "#define wxUSE_GRAPHICS_DIRECT2D 1" >>confdefs.h
|
||||
|
||||
fi
|
||||
elif test "$WXGTK1" = "1"; then
|
||||
{ $as_echo "$as_me:${as_lineno-$LINENO}: WARNING: wxGraphicsContext not supported with GTK +1" >&5
|
||||
$as_echo "$as_me: WARNING: wxGraphicsContext not supported with GTK +1" >&2;}
|
||||
|
26
configure.in
26
configure.in
@@ -828,6 +828,10 @@ if test "$wxUSE_MAC" != 1; then
|
||||
WX_ARG_FEATURE(graphics_ctx,[ --enable-graphics_ctx use graphics context 2D drawing API], wxUSE_GRAPHICS_CONTEXT)
|
||||
fi
|
||||
|
||||
if test "$wxUSE_MSW" = 1 ; then
|
||||
WX_ARG_FEATURE(graphics_d2d,[ --enable-graphics-d2d use Direct2D-based graphics context], wxUSE_GRAPHICS_DIRECT2D)
|
||||
fi
|
||||
|
||||
dnl ---------------------------------------------------------------------------
|
||||
dnl IPC &c
|
||||
dnl ---------------------------------------------------------------------------
|
||||
@@ -7836,6 +7840,28 @@ if test "$wxUSE_GRAPHICS_CONTEXT" = "yes"; then
|
||||
if test "$wx_cv_lib_gdiplus" = "yes"; then
|
||||
wx_has_graphics=1
|
||||
fi
|
||||
|
||||
AC_CACHE_CHECK([if Direct2D is available], wx_cv_lib_direct2d,
|
||||
[
|
||||
dnl same as above, we need to test only for the headers
|
||||
AC_LANG_PUSH(C++)
|
||||
AC_TRY_COMPILE(
|
||||
[#include <windows.h>
|
||||
#include <d2d1.h>
|
||||
#include <dwrite.h>
|
||||
],
|
||||
[
|
||||
ID2D1Factory* factory = NULL;
|
||||
],
|
||||
wx_cv_lib_direct2d=yes,
|
||||
wx_cv_lib_direct2d=no
|
||||
)
|
||||
AC_LANG_POP()
|
||||
]
|
||||
)
|
||||
if test "$wx_cv_lib_direct2d" = "yes"; then
|
||||
AC_DEFINE(wxUSE_GRAPHICS_DIRECT2D)
|
||||
fi
|
||||
elif test "$WXGTK1" = "1"; then
|
||||
AC_MSG_WARN([wxGraphicsContext not supported with GTK +1])
|
||||
elif test "$wx_needs_cairo_for_gc" = 1; then
|
||||
|
Reference in New Issue
Block a user