diff options
Diffstat (limited to 'CMake')
| -rw-r--r-- | CMake/options.cmake | 37 | ||||
| -rw-r--r-- | CMake/pen-support.c | 41 |
2 files changed, 75 insertions, 3 deletions
diff --git a/CMake/options.cmake b/CMake/options.cmake index 27cffd038..f005f8b0e 100644 --- a/CMake/options.cmake +++ b/CMake/options.cmake @@ -491,11 +491,42 @@ else() set(FLTK_HAVE_FORMS 0) endif() +# Note: on some Windows build systems (notably "classic" MinGW 32-bit) +# Pen/Tablet support is not available, hence we use try_compile() to +# figure this out. +# +# CMake variables: +# - FLTK_OPTION_PEN_SUPPORT: user option (cache; default ON/TRUE) +# - PEN_DRIVER_SUPPORTED : Windows only; result of try_compile() +# - FLTK_HAVE_PEN_SUPPORT : final result for building Pen/Tablet support, +# also used to set config variable in config.h + if(FLTK_OPTION_PEN_SUPPORT) - set(FLTK_HAVE_PEN_SUPPORT 1) -else() + if(WIN32) + try_compile(PEN_DRIVER_SUPPORTED + ${CMAKE_CURRENT_BINARY_DIR} + ${CMAKE_CURRENT_SOURCE_DIR}/CMake/pen-support.c + ) + # fl_debug_var(PEN_DRIVER_SUPPORTED) + if(PEN_DRIVER_SUPPORTED) + set(FLTK_HAVE_PEN_SUPPORT 1) + else() + set(FLTK_HAVE_PEN_SUPPORT 0) + endif() + else(WIN32) # all other platforms + set(FLTK_HAVE_PEN_SUPPORT 1) + endif(WIN32) + + # generate a warning if Pen/Tablet support was requested but can't be compiled + + if(NOT FLTK_HAVE_PEN_SUPPORT) + message(STATUS "WARNING: Pen/Tablet support requested (FLTK_OPTION_PEN_SUPPORT) but not available") + message(STATUS " ... Pen/Tablet support has been disabled!") + endif() + +else(FLTK_OPTION_PEN_SUPPORT) # option disabled by user set(FLTK_HAVE_PEN_SUPPORT 0) -endif() +endif(FLTK_OPTION_PEN_SUPPORT) ####################################################################### if(DOXYGEN_FOUND) diff --git a/CMake/pen-support.c b/CMake/pen-support.c new file mode 100644 index 000000000..3c3bed0be --- /dev/null +++ b/CMake/pen-support.c @@ -0,0 +1,41 @@ +/* + Test Pen/Tablet support availability (Windows). + + Copyright 2026 by Bill Spitzak and others. + + This library is free software. Distribution and use rights are outlined in + the file "COPYING" which should have been included with this file. If this + file is missing or damaged, see the license at: + + https://www.fltk.org/COPYING.php + + Please see the following page on how to report bugs and issues: + + https://www.fltk.org/bugs.php +*/ + +/* + CMake test function: test if this can be compiled. + If compilation fails, then Pen/Tablet support can't be built and is disabled. +*/ + +/* We require Windows 8 or later features for Pen/Tablet support */ + +# if !defined(WINVER) || (WINVER < 0x0602) +# ifdef WINVER +# undef WINVER +# endif +# define WINVER 0x0602 +# endif +# if !defined(_WIN32_WINNT) || (_WIN32_WINNT < 0x0602) +# ifdef _WIN32_WINNT +# undef _WIN32_WINNT +# endif +# define _WIN32_WINNT 0x0602 +# endif + +#include <windows.h> + +int main() { + return POINTER_CHANGE_FIRSTBUTTON_DOWN; /* required symbol */ +} |
