Fixes #2271, Add KD detection under CMake by Scott Percival
authorGabriel Jacobo <gabomdq@gmail.com>
Tue, 26 Nov 2013 11:50:54 -0300
changeset 8032e2096994e8b8
parent 8031 edf58197a910
child 8033 8181c3a4a055
Fixes #2271, Add KD detection under CMake by Scott Percival
CMakeLists.txt
include/SDL_config.h.cmake
     1.1 --- a/CMakeLists.txt	Tue Nov 26 11:47:52 2013 -0300
     1.2 +++ b/CMakeLists.txt	Tue Nov 26 11:50:54 2013 -0300
     1.3 @@ -651,6 +651,17 @@
     1.4          #endif
     1.5          int main(int argc, char** argv) {}" HAVE_INPUT_EVENTS)
     1.6  
     1.7 +    check_c_source_compiles("
     1.8 +        #include <linux/kd.h>
     1.9 +        #include <linux/keyboard.h>
    1.10 +
    1.11 +        int main(int argc, char **argv) 
    1.12 +        {
    1.13 +            struct kbentry kbe;
    1.14 +            kbe.kb_table = KG_CTRL;
    1.15 +            ioctl(0, KDGKBENT, &kbe);
    1.16 +        }" HAVE_INPUT_KD)
    1.17 +
    1.18      file(GLOB CORE_SOURCES ${SDL2_SOURCE_DIR}/src/core/linux/*.c)
    1.19      set(SOURCE_FILES ${SOURCE_FILES} ${CORE_SOURCES})
    1.20  
    1.21 @@ -665,6 +676,10 @@
    1.22        set(HAVE_SDL_HAPTIC TRUE)
    1.23      endif(SDL_HAPTIC AND HAVE_INPUT_EVENTS)
    1.24  
    1.25 +    if(HAVE_INPUT_KD)
    1.26 +      set(SDL_INPUT_LINUXKD 1)
    1.27 +    endif(HAVE_INPUT_KD)
    1.28 +
    1.29      check_include_file("libudev.h" HAVE_LIBUDEV_H)
    1.30  
    1.31      # !!! FIXME: this needs pkg-config to find the include path, I think.
     2.1 --- a/include/SDL_config.h.cmake	Tue Nov 26 11:47:52 2013 -0300
     2.2 +++ b/include/SDL_config.h.cmake	Tue Nov 26 11:50:54 2013 -0300
     2.3 @@ -215,6 +215,7 @@
     2.4  
     2.5  /* Enable various input drivers */
     2.6  #cmakedefine SDL_INPUT_LINUXEV @SDL_INPUT_LINUXEV@
     2.7 +#cmakedefine SDL_INPUT_LINUXKD @SDL_INPUT_LINUXKD@
     2.8  #cmakedefine SDL_INPUT_TSLIB @SDL_INPUT_TSLIB@
     2.9  #cmakedefine SDL_JOYSTICK_HAIKU @SDL_JOYSTICK_HAIKU@
    2.10  #cmakedefine SDL_JOYSTICK_DINPUT @SDL_JOYSTICK_DINPUT@