Make CMake script more accurate to autoconf script DBus, IBus and inotify is now able to be used outside Linux like in configure. KMSDRM input is now working on FreeBSD with CMake compilation.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109
diff --git a/CMakeLists.txt b/CMakeLists.txt
index 358f32f..ec6b7a7 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -1215,9 +1215,7 @@ elseif(UNIX AND NOT APPLE AND NOT ANDROID AND NOT RISCOS)
if(UNIX)
file(GLOB CORE_UNIX_SOURCES ${SDL2_SOURCE_DIR}/src/core/unix/*.c)
set(SOURCE_FILES ${SOURCE_FILES} ${CORE_UNIX_SOURCES})
- endif()
- if(LINUX)
check_c_source_compiles("
#include <linux/input.h>
#ifndef EVIOCGNAME
@@ -1225,16 +1223,28 @@ elseif(UNIX AND NOT APPLE AND NOT ANDROID AND NOT RISCOS)
#endif
int main(int argc, char** argv) {}" HAVE_INPUT_EVENTS)
- check_c_source_compiles("
- #include <linux/kd.h>
- #include <linux/keyboard.h>
+ if(LINUX)
+ check_c_source_compiles("
+ #include <linux/kd.h>
+ #include <linux/keyboard.h>
+
+ int main(int argc, char **argv)
+ {
+ struct kbentry kbe;
+ kbe.kb_table = KG_CTRL;
+ ioctl(0, KDGKBENT, &kbe);
+ }" HAVE_INPUT_KD)
+ elseif(FREEBSD)
+ check_c_source_compiles("
+ #include <sys/kbio.h>
+ #include <sys/ioctl.h>
- int main(int argc, char **argv)
- {
- struct kbentry kbe;
- kbe.kb_table = KG_CTRL;
- ioctl(0, KDGKBENT, &kbe);
- }" HAVE_INPUT_KD)
+ int main(int argc, char **argv)
+ {
+ accentmap_t accTable;
+ ioctl(0, KDENABIO, 1);
+ }" HAVE_INPUT_KBIO)
+ endif()
if(HAVE_INPUT_EVENTS)
set(SDL_INPUT_LINUXEV 1)
@@ -1250,11 +1260,16 @@ elseif(UNIX AND NOT APPLE AND NOT ANDROID AND NOT RISCOS)
if(HAVE_INPUT_KD)
set(SDL_INPUT_LINUXKD 1)
endif()
+
+ if(HAVE_INPUT_KBIO)
+ set(SDL_INPUT_FBSDKBIO 1)
+ endif()
check_include_file("libudev.h" HAVE_LIBUDEV_H)
check_include_file("sys/inotify.h" HAVE_SYS_INOTIFY_H)
check_symbol_exists(inotify_init "sys/inotify.h" HAVE_INOTIFY_INIT)
check_symbol_exists(inotify_init1 "sys/inotify.h" HAVE_INOTIFY_INIT1)
+
if(HAVE_SYS_INOTIFY_H AND HAVE_INOTIFY_INIT)
set(HAVE_INOTIFY 1)
endif()
@@ -1280,6 +1295,16 @@ elseif(UNIX AND NOT APPLE AND NOT ANDROID AND NOT RISCOS)
set(SDL_USE_IME TRUE)
add_definitions(-DSDL_USE_IME) # !!! FIXME: why isn't this a definition and not in SDL_config.h.cmake?
endif()
+
+ if(FREEBSD AND NOT HAVE_INOTIFY)
+ pkg_search_module(INOTIFY libinotify)
+ if(INOTIFY_FOUND)
+ set(HAVE_INOTIFY 1)
+ include_directories(${INOTIFY_INCLUDE_DIRS})
+ list(APPEND EXTRA_LIBS ${INOTIFY_LIBRARIES})
+ endif()
+ endif()
+
if(HAVE_LIBUNWIND_H)
# We've already found the header, so REQUIRE the lib to be present
pkg_search_module(UNWIND REQUIRED libunwind)
@@ -1312,6 +1337,10 @@ elseif(UNIX AND NOT APPLE AND NOT ANDROID AND NOT RISCOS)
set(SOURCE_FILES ${SOURCE_FILES} "${SDL2_SOURCE_DIR}/src/core/linux/SDL_evdev.c")
set(SOURCE_FILES ${SOURCE_FILES} "${SDL2_SOURCE_DIR}/src/core/linux/SDL_evdev_kbd.c")
endif()
+
+ if(HAVE_INPUT_KBIO)
+ set(SOURCE_FILES ${SOURCE_FILES} "${SDL2_SOURCE_DIR}/src/core/freebsd/SDL_evdev_kbd_freebsd.c")
+ endif()
# Always compiled for Linux, unconditionally:
set(SOURCE_FILES ${SOURCE_FILES} "${SDL2_SOURCE_DIR}/src/core/linux/SDL_evdev_capabilities.c")
diff --git a/include/SDL_config.h.cmake b/include/SDL_config.h.cmake
index 0446547..8463f47 100644
--- a/include/SDL_config.h.cmake
+++ b/include/SDL_config.h.cmake
@@ -302,6 +302,7 @@
/* Enable various input drivers */
#cmakedefine SDL_INPUT_LINUXEV @SDL_INPUT_LINUXEV@
#cmakedefine SDL_INPUT_LINUXKD @SDL_INPUT_LINUXKD@
+#cmakedefine SDL_INPUT_FBSDKBIO @SDL_INPUT_FBSDKBIO@
#cmakedefine SDL_JOYSTICK_ANDROID @SDL_JOYSTICK_ANDROID@
#cmakedefine SDL_JOYSTICK_HAIKU @SDL_JOYSTICK_HAIKU@
#cmakedefine SDL_JOYSTICK_DINPUT @SDL_JOYSTICK_DINPUT@