blob: d5164f8027667f01649773b4dcc7011f51d20a7d (
plain) (
tree)
|
|
################################################################################
# General
################################################################################
PROJECT(pvs2)
CMAKE_MINIMUM_REQUIRED(VERSION 2.8.0)
# set compiler optimizations for debug and release
SET(CMAKE_BUILD_TYPE Debug)
SET(CMAKE_C_FLAGS_DEBUG "-O0 -g -Wall -Wunused -Wunreachable-code -pedantic")
SET(CMAKE_C_FLAGS_RELEASE "-O2")
SET(CMAKE_CXX_FLAGS_DEBUG "-O0 -g -Wall -std=c++11")
SET(CMAKE_CXX_FLAGS_RELEASE "-O2 -std=c++11" )
# local cmake modules
SET(CMAKE_MODULE_PATH ${CMAKE_SOURCE_DIR}/cmake)
# this command finds libraries and sets all required variables
FIND_PACKAGE(Qt4 4.7.0 REQUIRED)
FIND_PACKAGE(X11 REQUIRED)
FIND_PACKAGE(VNC REQUIRED)
# some includes
INCLUDE_DIRECTORIES(
${CMAKE_SOURCE_DIR}
${CMAKE_BINARY_DIR}
${X11_INCLUDE_DIR}
# ${X11_XTest_INCLUDE_PATH}
# ${X11_Xinput_INCLUDE_PATH}
)
#IF(NOT X11_XTest_FOUND)
# MESSAGE(FATAL_ERROR "Could not find X11 extension XTest or its developer files.")
#ENDIF()
#IF(NOT X11_Xinput_FOUND)
# MESSAGE(FATAL_ERROR "Could not find X11 extension Xinput or its developer files.")
#ENDIF()
# TODO: Detect this somehow
SET(SYSDEP_SUFFIX _X11)
################################################################################
# Variables
################################################################################
# pvsmgr
FILE(GLOB PVSMGR_SRCS
src/server/*.cpp
src/server/*/*.cpp
src/shared/*.cpp
)
# pvsclient
FILE(GLOB PVSCLIENT_SRCS
src/client/*.cpp
src/client/*/*.cpp
src/client/util/platform/*${SYSDEP_SUFFIX}.cpp
src/shared/*.cpp
)
################################################################################
# Qt
################################################################################
# .ui files
FILE(GLOB PVSMGR_UIS
gui/server_normal/*.ui
)
FILE(GLOB PVSCLIENT_UIS
gui/client/*.ui
)
# .qrc files
SET(PVSMGR_RCS pvsmgr.qrc)
SET(PVSCLIENT_RCS pvsclient.qrc)
# includes all header files that should be treated with moc
FILE(GLOB PVSMGR_MOC_HDRS
src/server/*/*.h
)
FILE(GLOB PVSCLIENT_MOC_HDRS
src/client/*/*.h
src/client/*/*/*.h
)
# i18n
FILE(GLOB PVSMGR_TSS
i18n/server/*.ts
)
FILE(GLOB PVSCLIENT_TSS
i18n/client/*.ts
)
# include Qt modules
#SET(QT_USE_QTDBUS TRUE)
SET(QT_USE_QTNETWORK TRUE)
#SET(QT_USE_QTWEBKIT TRUE)
# add some useful macros and variables
# (QT_USE_FILE is a variable defined by FIND_PACKAGE( Qt4 ) that contains
# a path to CMake script)
INCLUDE(${QT_USE_FILE})
# this will run rcc on .qrc files
QT4_ADD_RESOURCES(PVSMGR_RC_SRCS ${PVSMGR_RCS})
QT4_ADD_RESOURCES(PVSCLIENT_RC_SRCS ${PVSCLIENT_RCS})
# this will run uic on .ui files
QT4_WRAP_UI(PVSMGR_UI_HDRS ${PVSMGR_UIS})
QT4_WRAP_UI(PVSCLIENT_UI_HDRS ${PVSCLIENT_UIS})
# this will run moc
QT4_WRAP_CPP(PVSMGR_MOC_SRCS ${PVSMGR_MOC_HDRS})
QT4_WRAP_CPP(PVSCLIENT_MOC_SRCS ${PVSCLIENT_MOC_HDRS})
option(UPDATE_TRANSLATIONS "Update .ts files (WARNING: make clean will delete the .ts files!)")
if(PVSMGR_TSS)
if (UPDATE_TRANSLATIONS)
QT4_CREATE_TRANSLATION(PVSMGR_QMS ${PVSMGR_SRCS} ${PVSMGR_UI_HDRS} ${PVSMGR_TSS} OPTIONS -noobsolete)
message(STATUS ".tr files have been updated")
else (UPDATE_TRANSLATIONS)
QT4_ADD_TRANSLATION(PVSMGR_QMS ${PVSMGR_TSS})
endif (UPDATE_TRANSLATIONS)
endif(PVSMGR_TSS)
if(PVSCLIENT_TSS)
if (UPDATE_TRANSLATIONS)
QT4_CREATE_TRANSLATION(PVSCLIENT_QMS ${PVSCLIENT_SRCS} ${PVSCLIENT_UI_HDRS} ${PVSCLIENT_TSS} OPTIONS -noobsolete)
message(STATUS ".tr files have been updated")
else (UPDATE_TRANSLATIONS)
QT4_ADD_TRANSLATION(PVSCLIENT_QMS ${PVSCLIENT_TSS})
endif (UPDATE_TRANSLATIONS)
endif(PVSCLIENT_TSS)
################################################################################
# Build
################################################################################
ADD_EXECUTABLE(pvsmgr
${PVSMGR_SRCS}
${PVSMGR_MOC_SRCS}
${PVSMGR_UI_HDRS}
${PVSMGR_RC_SRCS}
${PVSMGR_QMS}
)
ADD_EXECUTABLE(pvsclient
${PVSCLIENT_SRCS}
${PVSCLIENT_MOC_SRCS}
${PVSCLIENT_UI_HDRS}
${PVSCLIENT_RC_SRCS}
${PVSCLIENT_QMS}
)
# link
TARGET_LINK_LIBRARIES(pvsmgr
${QT_LIBRARIES}
# ${VNC_LIBRARIES}
# ${X11_LIBRARIES}
)
TARGET_LINK_LIBRARIES(pvsclient
${QT_LIBRARIES}
${VNC_LIBRARIES}
${X11_LIBRARIES}
)
SET_PROPERTY(TARGET pvsmgr PROPERTY COMPILE_DEFINITIONS MAINWINDOW_USE_NORMALGUI)
# install
INSTALL(TARGETS pvsmgr pvsclient RUNTIME DESTINATION bin)
#INSTALL(PROGRAMS misc/pvs-vncsrv DESTINATION bin)
INSTALL(FILES misc/pvsclient.conf misc/pvsmgr.conf DESTINATION /etc/openslx)
INSTALL(FILES misc/pvsclient.desktop DESTINATION /etc/xdg/autostart)
# uninstall
CONFIGURE_FILE(
"${CMAKE_CURRENT_SOURCE_DIR}/cmake/Uninstall.cmake"
"${CMAKE_CURRENT_BINARY_DIR}/cmake/Uninstall.cmake"
IMMEDIATE @ONLY
)
ADD_CUSTOM_TARGET(uninstall
"${CMAKE_COMMAND}" -P "${CMAKE_CURRENT_BINARY_DIR}/cmake/Uninstall.cmake"
)
# package
SET( CPACK_GENERATOR "DEB" )
SET( CPACK_SET_DESTDIR "ON" )
SET( CPACK_PACKAGE_NAME "pvs" )
SET( CPACK_PACKAGE_VERSION_MAJOR "3" )
SET( CPACK_PACKAGE_VERSION_MINOR "1" )
SET( CPACK_PACKAGE_VERSION_PATCH "2" )
SET( CPACK_PACKAGE_DESCRIPTION_SUMMARY "Pool Video Switch" )
SET( CPACK_PACKAGE_DESCRIPTION "")
SET( CPACK_PACKAGE_CONTACT "Johann Latocha <johann@latocha.de>" )
SET( CPACK_DEBIAN_PACKAGE_DEPENDS "libvncserver0 (>= 0.9.3.dfsg.1-2), libqtgui4 (>= 4:4.5.3-4), libqt4-dbus (>= 4:4.5.3-4), libqt4-network (>= 4:4.5.3-4)" )
SET( CPACK_DEBIAN_PACKAGE_ARCHITECTURE "i386" )
SET( CPACK_DEBIAN_PACKAGE_SECTION "Network" )
SET( CPACK_DEBIAN_PACKAGE_PRIORITY "optional" )
SET( CPACK_DEBIAN_PACKAGE_RECOMMENDS "x11vnc (>= 0.9.9-1)" )
INCLUDE( CPack )
|