list(APPEND PLATFORM_LIBS ${COCOA_LIBRARY} ${CORESERVICES_LIBRARY})
elseif(CMAKE_SYSTEM_NAME MATCHES "Linux")
- # disabled while DBus / HAL / udev issues are decided
- #set(EVENT_INPUT_DEFAULT 1)
+ find_package(UDev)
+
+ if(UDEV_FOUND)
+ set(EVENT_INPUT_DEFAULT 1)
+ endif(UDEV_FOUND)
endif()
find_package(Git)
if(EVENT_INPUT)
message(STATUS "checking event-based Input")
-
+
IF(APPLE)
elseif(CMAKE_SYSTEM_NAME MATCHES "Linux")
- find_package(DBus)
- if(NOT DBUS_FOUND)
- message(WARNING "DBus not found, event input will be disabled")
- set(EVENT_INPUT 0)
- endif()
-
+ if(NOT UDEV_FOUND)
+ message(WARNING "UDev not found, event input is disabled!")
+ set(EVENT_INPUT 0)
+ else()
+ set(EVENT_INPUT_LIBRARIES ${UDEV_LIBRARIES})
+ endif()
+
else()
message(WARNING "event input is not supported on this platform yet")
endif()
+
+ # Keep PLIB INPUT enabled as long as EventInput does not replace current joystick configurations.
+ set(ENABLE_PLIB_JOYSTICK 1)
else(EVENT_INPUT)
set(ENABLE_PLIB_JOYSTICK 1)
endif(EVENT_INPUT)
+++ /dev/null
-# - Try to find the low-level D-Bus library
-# Once done this will define
-#
-# DBUS_FOUND - system has D-Bus
-# DBUS_INCLUDE_DIR - the D-Bus include directory
-# DBUS_ARCH_INCLUDE_DIR - the D-Bus architecture-specific include directory
-# DBUS_LIBRARIES - the libraries needed to use D-Bus
-
-# Copyright (c) 2008, Kevin Kofler, <kevin.kofler@chello.at>
-# modeled after FindLibArt.cmake:
-# Copyright (c) 2006, Alexander Neundorf, <neundorf@kde.org>
-#
-# Redistribution and use is allowed according to the terms of the BSD license.
-# For details see the accompanying COPYING-CMAKE-SCRIPTS file.
-
-if (DBUS_INCLUDE_DIR AND DBUS_ARCH_INCLUDE_DIR AND DBUS_LIBRARIES)
-
- # in cache already
- SET(DBUS_FOUND TRUE)
-
-else (DBUS_INCLUDE_DIR AND DBUS_ARCH_INCLUDE_DIR AND DBUS_LIBRARIES)
-
- IF (NOT WIN32)
- FIND_PACKAGE(PkgConfig)
- IF (PKG_CONFIG_FOUND)
- # use pkg-config to get the directories and then use these values
- # in the FIND_PATH() and FIND_LIBRARY() calls
- pkg_check_modules(_DBUS_PC QUIET dbus-1)
- ENDIF (PKG_CONFIG_FOUND)
- ENDIF (NOT WIN32)
-
- FIND_PATH(DBUS_INCLUDE_DIR dbus/dbus.h
- ${_DBUS_PC_INCLUDE_DIRS}
- /usr/include
- /usr/include/dbus-1.0
- /usr/local/include
- )
-
- FIND_PATH(DBUS_ARCH_INCLUDE_DIR dbus/dbus-arch-deps.h
- ${_DBUS_PC_INCLUDE_DIRS}
- /usr/lib${LIB_SUFFIX}/include
- /usr/lib${LIB_SUFFIX}/dbus-1.0/include
- /usr/lib64/include
- /usr/lib64/dbus-1.0/include
- /usr/lib/include
- /usr/lib/dbus-1.0/include
- )
-
- FIND_LIBRARY(DBUS_LIBRARIES NAMES dbus-1 dbus
- PATHS
- ${_DBUS_PC_LIBDIR}
- )
-
-
- if (DBUS_INCLUDE_DIR AND DBUS_ARCH_INCLUDE_DIR AND DBUS_LIBRARIES)
- set(DBUS_FOUND TRUE)
- endif (DBUS_INCLUDE_DIR AND DBUS_ARCH_INCLUDE_DIR AND DBUS_LIBRARIES)
-
-
- if (DBUS_FOUND)
- if (NOT DBus_FIND_QUIETLY)
- message(STATUS "Found D-Bus: ${DBUS_LIBRARIES}")
- endif (NOT DBus_FIND_QUIETLY)
- else (DBUS_FOUND)
- if (DBus_FIND_REQUIRED)
- message(FATAL_ERROR "Could NOT find D-Bus")
- endif (DBus_FIND_REQUIRED)
- endif (DBUS_FOUND)
-
- MARK_AS_ADVANCED(DBUS_INCLUDE_DIR DBUS_ARCH_INCLUDE_DIR DBUS_LIBRARIES)
-
-endif (DBUS_INCLUDE_DIR AND DBUS_ARCH_INCLUDE_DIR AND DBUS_LIBRARIES)
--- /dev/null
+# Configure libudev environment
+#
+# UDEV_FOUND - system has a libudev
+# UDEV_INCLUDE_DIR - where to find header files
+# UDEV_LIBRARIES - the libraries to link against udev
+# UDEV_STABLE - it's true when is the version greater or equals to 143 - version when the libudev was stabilized in its API
+#
+# copyright (c) 2011 Petr Vanek <petr@scribus.info>
+# Redistribution and use of this file is allowed according to the terms of the BSD license.
+#
+
+FIND_PATH(
+ UDEV_INCLUDE_DIR
+ libudev.h
+ /usr/include
+ /usr/local/include
+ ${UDEV_PATH_INCLUDES}
+)
+
+FIND_LIBRARY(
+ UDEV_LIBRARIES
+ NAMES udev libudev
+ PATHS
+ /usr/${CMAKE_INSTALL_LIBDIR}
+ /usr/local/${CMAKE_INSTALL_LIBDIR}
+ ${UDEV_PATH_LIB}
+)
+
+IF (UDEV_LIBRARIES AND UDEV_INCLUDE_DIR)
+ SET(UDEV_FOUND "YES")
+ execute_process(COMMAND pkg-config --atleast-version=143 libudev RESULT_VARIABLE UDEV_STABLE)
+ # retvale is 0 of the condition is "true" so we need to negate the value...
+ if (UDEV_STABLE)
+ set(UDEV_STABLE 0)
+ else (UDEV_STABLE)
+ set(UDEV_STABLE 1)
+ endif (UDEV_STABLE)
+ message(STATUS "libudev stable: ${UDEV_STABLE}")
+ENDIF (UDEV_LIBRARIES AND UDEV_INCLUDE_DIR)
+
+IF (UDEV_FOUND)
+ MESSAGE(STATUS "Found UDev: ${UDEV_LIBRARIES}")
+ MESSAGE(STATUS " include: ${UDEV_INCLUDE_DIR}")
+ELSE (UDEV_FOUND)
+ MESSAGE(STATUS "UDev not found.")
+ MESSAGE(STATUS "UDev: You can specify includes: -DUDEV_PATH_INCLUDES=/opt/udev/include")
+ MESSAGE(STATUS " currently found includes: ${UDEV_INCLUDE_DIR}")
+ MESSAGE(STATUS "UDev: You can specify libs: -DUDEV_PATH_LIB=/opt/udev/lib")
+ MESSAGE(STATUS " currently found libs: ${UDEV_LIBRARIES}")
+ IF (UDev_FIND_REQUIRED)
+ MESSAGE(FATAL_ERROR "Could not find UDev library")
+ ENDIF (UDev_FIND_REQUIRED)
+ENDIF (UDEV_FOUND)
set(EVENT_INPUT_SOURCES FGMacOSXEventInput.cxx)
set(EVENT_INPUT_HEADERS FGMacOSXEventInput.hxx)
elseif(MSVC)
- message(STATUS "EventInput not implemented for Windows yet")
+ message(STATUS "EventInput not implemented for Windows yet")
else()
set(EVENT_INPUT_SOURCES FGLinuxEventInput.cxx)
set(EVENT_INPUT_HEADERS FGLinuxEventInput.hxx)
FGMouseInput.cxx
input.cxx
)
-
+
set(HEADERS
FGButton.hxx
- FGCommonInput.hxx
- FGDeviceConfigurationMap.hxx
- FGEventInput.hxx
- FGJoystickInput.hxx
- FGKeyboardInput.hxx
- FGMouseInput.hxx
- input.hxx
+ FGCommonInput.hxx
+ FGDeviceConfigurationMap.hxx
+ FGEventInput.hxx
+ FGJoystickInput.hxx
+ FGKeyboardInput.hxx
+ FGMouseInput.hxx
+ input.hxx
)
-
+
if(EVENT_INPUT)
list(APPEND SOURCES ${EVENT_INPUT_SOURCES})
list(APPEND SOURCES ${EVENT_INPUT_HEADERS})
- include_directories(${DBUS_INCLUDE_DIR} ${DBUS_ARCH_INCLUDE_DIR})
+ include_directories(${UDEV_INCLUDE_DIR})
+ add_definitions(-DWITH_EVENTINPUT)
endif()
-
+
set(FGJS_SOURCES
fgjs.cxx
jsinput.cxx
jssuper.cxx
)
-
+
add_executable(fgjs ${FGJS_SOURCES})
target_link_libraries(fgjs
- ${SIMGEAR_CORE_LIBRARIES}
- ${PLIB_LIBRARIES}
- ${SIMGEAR_CORE_LIBRARY_DEPENDENCIES})
+ ${SIMGEAR_CORE_LIBRARIES}
+ ${PLIB_LIBRARIES}
+ ${SIMGEAR_CORE_LIBRARY_DEPENDENCIES})
add_executable(js_demo js_demo.cxx)
#message(STATUS "SG libs ${SIMGEAR_LIBRARIES}")
if(RTI_FOUND)
- find_sg_component(hla SIMGEAR_LIBRARIES)
- find_sg_component(rti13 SIMGEAR_LIBRARIES)
- find_sg_component(rti SIMGEAR_LIBRARIES)
- set(HLA_LIBRARIES ${RTI_LIBRARIES})
+ find_sg_component(hla SIMGEAR_LIBRARIES)
+ find_sg_component(rti13 SIMGEAR_LIBRARIES)
+ find_sg_component(rti SIMGEAR_LIBRARIES)
+ set(HLA_LIBRARIES ${RTI_LIBRARIES})
else()
- set(HLA_LIBRARIES "")
+ set(HLA_LIBRARIES "")
endif()
target_link_libraries(fgfs
${PLIB_LIBRARIES}
${JPEG_LIBRARY}
${HLA_LIBRARIES}
+ ${EVENT_INPUT_LIBRARIES}
${SIMGEAR_CORE_LIBRARY_DEPENDENCIES}
${SIMGEAR_SCENE_LIBRARY_DEPENDENCIES}
${PLATFORM_LIBS}