blob: af61455218a59964fdaff36839553cdf0ab2f52e (
plain) (
blame)
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
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
|
################################################################################
# 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 -Wextra -Wpedantic -std=c++0x -Wcast-align -Wcast-qual -Wchar-subscripts -Wcomment -Wconversion -Wdisabled-optimization -Wfloat-equal -Wformat -Wformat=2 -Wformat-nonliteral -Wformat-security -Wformat-y2k -Wimport -Winit-self -Winline -Winvalid-pch -Wunsafe-loop-optimizations -Wlong-long -Wmissing-braces -Wmissing-field-initializers -Wmissing-format-attribute -Wmissing-include-dirs -Wmissing-noreturn -Wpacked -Wparentheses -Wpointer-arith -Wredundant-decls -Wreturn-type -Wsequence-point -Wsign-compare -Wstack-protector -Wstrict-aliasing -Wstrict-aliasing=2 -Wswitch -Wswitch-default -Wswitch-enum -Wtrigraphs -Wuninitialized -Wunknown-pragmas -Wunreachable-code -Wunused -Wunused-function -Wunused-label -Wunused-parameter -Wunused-value -Wunused-variable -Wvariadic-macros -Wvolatile-register-var -Wwrite-strings")
# -Wshadow spams too much :/
SET(CMAKE_CXX_FLAGS_RELEASE "-O2 -std=c++0x" )
# 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
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_QTSVG 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 )
|