blob: 26eeb6426d10a6b10d3c3211cbcdfede329daf57 (
plain) (
tree)
|
|
include(${QT_USE_FILE})
set(pvsinput_SRCS
inputEvent.cpp
unprivilegedInputHandlerChain.cpp
inputEventHandler.cpp
logNonMatchingHandler.cpp
)
set(feature_DEFS)
if(UNIX)
find_file(XINPUT2_HDR X11/extensions/XInput2.h)
if(XINPUT2_HDR)
list(APPEND feature_DEFS
HAVE_XINPUT2_H)
endif()
find_file(XINPUT_HDR X11/extensions/XInput.h)
if(XINPUT_HDR)
list(APPEND feature_DEFS
HAVE_XINPUT_H)
endif()
find_file(XKBLIB_HDR X11/XKBlib.h)
if(XKBLIB_HDR)
list(APPEND feature_DEFS
HAVE_XKBLIB_H)
endif()
set(pvsprivinputd_SRCS
pvsprivinputd.cpp
pvsPrivInputHandler.cpp
pvsCheckPrivileges.cpp
pvsSyslog.cpp
pvsPrivInputSignalHandler.cpp
rebootSystemHandler.cpp
killX11Handler.cpp
magicSysRqHandler.cpp
sayHelloHandler.cpp
privilegedInputHandlerChain.cpp
allowLocalOrPrivileged.cpp
)
set(pvsprivinputd_MOC_HDRS
pvsPrivInputHandler.h
pvsCheckPrivileges.h
pvsSyslog.h
pvsPrivInputSignalHandler.h
)
qt4_wrap_cpp(pvsprivinputd_MOC_SRCS
${pvsprivinputd_MOC_HDRS}
)
add_executable(pvsprivinputd
${pvsprivinputd_SRCS}
${pvsprivinputd_MOC_SRCS}
)
set_property(SOURCE ${pvsprivinputd_SRCS} ${pvsprivinputd_MOC_SRCS}
APPEND
PROPERTY COMPILE_FLAGS " -I${QT_QTCORE_INCLUDE_DIR} -I${QT_QTDBUS_INCLUDE_DIR} -I${QT_QTNETWORK_INCLUDE_DIR}")
target_link_libraries(pvsprivinputd
pvsinput
${QT_QTCORE_LIBRARY}
${QT_QTDBUS_LIBRARY}
${QT_QTNETWORK_LIBRARY}
)
list(APPEND pvsinput_SRCS
pvsPrivInputSocket.cpp
x11InputUtils.cpp
x11FakeKeyboardHandler.cpp
x11FakeMouseHandler.cpp
privilegedHandlerForwarder.cpp
)
# we need pkg-config to find out where to install the action file:
find_package(PkgConfig)
if(NOT PKG_CONFIG_FOUND)
# we will try to make a best effort and put our policy file into
# ${PREFIX}/share/polkit-1, but only if we can find
# the pkexec executable.
find_program(PKEXEC_LOCATION pkexec)
if(PKEXEC_LOCATION OR ENABLE_POLKIT)
set(POLKIT_FOUND ON)
set(POLKIT_PREFIX ${CMAKE_INSTALL_PREFIX})
set(POLKIT_POLICY_DIR ${POLKIT_PREFIX}/share/polkit-1/actions)
endif()
else()
pkg_check_modules(POLKIT "polkit-gobject-1")
if(POLKIT_FOUND)
execute_process(COMMAND ${PKG_CONFIG_EXECUTABLE} polkit-gobject-1 --variable=policydir
OUTPUT_VARIABLE POLKIT_POLICY_DIR
OUTPUT_STRIP_TRAILING_WHITESPACE)
if(NOT POLKIT_POLICY_DIR)
set(POLKIT_FOUND OFF)
endif()
endif()
endif()
# now, arrange for policykit integration:
if(POLKIT_FOUND OR ENABLE_POLKIT)
if(NOT POLKIT_POLICY_DIR)
message(SEND_ERROR "PolicyKit integration is enabled, but cannot find PolicyKit's actions directory. Please set POLKIT_POLICY_DIR to the right value")
endif()
install(FILES org.openslx.pvs.input.policy
DESTINATION ${POLKIT_POLICY_DIR})
set_property(SOURCE ${pvsprivinputd_SRCS}
APPEND
PROPERTY COMPILE_DEFINITIONS HAVE_POLKIT)
message(STATUS "PolicyKit integration: enabled")
else()
message(STATUS "PolicyKit integration: disabled")
endif()
# Install a pvsprivinputd.conf template
install(FILES pvsprivinputd.conf
DESTINATION /etc
PERMISSIONS OWNER_READ OWNER_WRITE GROUP_READ WORLD_READ)
# Install the daemon
install(TARGETS pvsprivinputd
DESTINATION sbin)
endif()
set_property(SOURCE ${pvsinput_SRCS} ${pvsprivinputd_SRCS}
APPEND
PROPERTY COMPILE_DEFINITIONS ${feature_DEFS}
)
set(pvsinput_TSS
i18n/pvsinput_de_DE.ts
i18n/pvsinput_fr_FR.ts
i18n/pvsinput_es_MX.ts
i18n/pvsinput_ar_JO.ts
i18n/pvsinput_pl_PL.ts)
QT4_CREATE_TRANSLATION(pvsinput_QMS
${pvsinput_SRCS}
${pvsprivinputd_SRCS}
${pvsinput_TSS})
# Generate an RCC file for our translations:
file(WRITE "${CMAKE_CURRENT_BINARY_DIR}/pvsinput.qrc"
"<RCC version='1.0'><qresource prefix='/i18n/pvsinput'>")
foreach(qm ${pvsinput_QMS})
file(RELATIVE_PATH qm_rel ${CMAKE_CURRENT_BINARY_DIR} ${qm})
get_filename_component(qm_basename ${qm} NAME)
file(APPEND "${CMAKE_CURRENT_BINARY_DIR}/pvsinput.qrc"
"<file alias='${qm_basename}'>${qm_rel}</file>")
endforeach()
file(APPEND "${CMAKE_CURRENT_BINARY_DIR}/pvsinput.qrc" "</qresource></RCC>")
qt4_add_resources(pvsinput_RCS
"${CMAKE_CURRENT_BINARY_DIR}/pvsinput.qrc")
add_library(
pvsinput
STATIC
${pvsinput_SRCS}
${pvsinput_RCS}
)
if(EXISTS /etc/gentoo-release)
configure_file(${CMAKE_CURRENT_SOURCE_DIR}/pvsprivinputd.gentooinit.in ${CMAKE_CURRENT_BINARY_DIR}/pvsprivinputd.init @ONLY@)
else()
configure_file(${CMAKE_CURRENT_SOURCE_DIR}/pvsprivinputd.lsbinit.in ${CMAKE_CURRENT_BINARY_DIR}/pvsprivinputd.init @ONLY@)
endif()
install(PROGRAMS ${CMAKE_CURRENT_BINARY_DIR}/pvsprivinputd.init
DESTINATION /etc/init.d
RENAME pvsprivinputd)
|