Commit 32c4996c04a7214a85cce2476547a5532ff95faf

Anonymous Maarten 2022-08-26T02:38:54

cmake: add SDL_IBUS option to enable/disable DBUS + test sys/inotify.h

diff --git a/CMakeLists.txt b/CMakeLists.txt
index 5c29143..c7541b3 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -446,6 +446,7 @@ set_option(SDL_DUMMYAUDIO          "Support the dummy audio driver" ON)
 set_option(SDL_DIRECTFB            "Use DirectFB video driver" OFF)
 dep_option(SDL_DIRECTFB_SHARED     "Dynamically load directfb support" ON "SDL_DIRECTFB" OFF)
 set_option(SDL_DUMMYVIDEO          "Use dummy video driver" ON)
+dep_option(SDL_IBUS                "Enable IBus support" ON ${UNIX_SYS} OFF)
 set_option(SDL_OPENGL              "Include OpenGL support" ON)
 set_option(SDL_OPENGLES            "Include OpenGL ES support" ON)
 set_option(SDL_PTHREADS            "Use POSIX threads for multi-threading" ${SDL_PTHREADS_ENABLED_BY_DEFAULT})
@@ -1443,10 +1444,14 @@ elseif(UNIX AND NOT APPLE AND NOT RISCOS AND NOT HAIKU)
         endif()
       endif()
 
-      pkg_search_module(IBUS ibus-1.0 ibus)
-      if(IBUS_FOUND)
-        set(HAVE_IBUS_IBUS_H TRUE)
-        target_include_directories(sdl-build-options INTERFACE "${IBUS_INCLUDE_DIRS}")
+      if(SDL_IBUS)
+        pkg_search_module(IBUS ibus-1.0 ibus)
+        find_path(HAVE_SYS_INOTIFY_H NAMES sys/inotify.h)
+        if(IBUS_FOUND AND HAVE_SYS_INOTIFY_H)
+          set(HAVE_IBUS_IBUS_H TRUE)
+          target_include_directories(sdl-build-options INTERFACE "${IBUS_INCLUDE_DIRS}")
+          set(HAVE_IBUS TRUE)
+        endif()
       endif()
 
       if (HAVE_IBUS_IBUS_H OR HAVE_FCITX)