blob: 5e1b55036c96da112823bfbdc4df5061447e5e64 (
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
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
|
################################################################################
# General
################################################################################
PROJECT(pvs2)
CMAKE_MINIMUM_REQUIRED(VERSION 2.8.12 FATAL_ERROR)
SET(EXTRA_C_FLAGS "" CACHE STRING "Additional options to pass to C compiler")
SET(EXTRA_CXX_FLAGS "" CACHE STRING "Additional options to pass to C++ compiler")
# set compiler optimizations for debug and release
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 -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 -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")
SET(CMAKE_CXX_FLAGS_RELEASE "-O2")
# -Wshadow spams too much :/
SET(CMAKE_CXX_STANDARD 11)
SET(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -std=c11 ${EXTRA_C_FLAGS}")
SET(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++11 ${EXTRA_CXX_FLAGS}")
# local cmake modules
SET(CMAKE_MODULE_PATH ${CMAKE_SOURCE_DIR}/cmake)
# this command finds libraries and sets all required variables
FIND_PACKAGE(Qt5 COMPONENTS Widgets Network X11Extras LinguistTools Svg REQUIRED)
FIND_PACKAGE(X11 REQUIRED)
FIND_PACKAGE(VNC REQUIRED)
SET(CMAKE_INCLUDE_CURRENT_DIR ON)
SET(CMAKE_AUTOMOC ON)
# some includes
INCLUDE_DIRECTORIES(
${CMAKE_CURRENT_SOURCE_DIR}
${CMAKE_CURRENT_BINARY_DIR}
${X11_INCLUDE_DIR}
)
IF(X11_Xscreensaver_FOUND)
ADD_DEFINITIONS(-DX11_Xscreensaver_FOUND)
ENDIF()
IF(X11_dpms_FOUND)
ADD_DEFINITIONS(-DX11_dpms_FOUND)
ENDIF()
#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/server/util/platform/*.cpp
src/shared/*.cpp
)
# pvsclient
FILE(GLOB PVSCLIENT_SRCS
src/client/*.cpp
src/client/*/*.cpp
src/client/util/platform/*.cpp
src/shared/*.cpp
)
################################################################################
# Qt
################################################################################
# .ui files
FILE(GLOB PVSMGR_UIS
gui/server_normal/*.ui
)
FILE(GLOB PVSCLIENT_UIS
gui/client/*.ui
)
# .qrc files
FILE(GLOB PVSMGR_RC_SRCS
pvsmgr.qrc
)
FILE(GLOB PVSCLIENT_RC_SRCS
pvsclient.qrc
)
# i18n
FILE(GLOB PVSMGR_TSS
i18n/server/*.ts
)
FILE(GLOB PVSCLIENT_TSS
i18n/client/*.ts
)
# this will run uic on .ui files
QT5_WRAP_UI(PVSMGR_UI_HDRS ${PVSMGR_UIS})
QT5_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!)" OFF)
if(PVSMGR_TSS)
if (UPDATE_TRANSLATIONS)
set(FILES_TO_TRANSLATE ${PVSMGR_SRCS} ${PVSMGR_UIS})
QT5_CREATE_TRANSLATION(PVSMGR_QMS ${FILES_TO_TRANSLATE} ${PVSMGR_TSS} OPTIONS -noobsolete)
message(STATUS ".tr files have been updated")
else (UPDATE_TRANSLATIONS)
QT5_ADD_TRANSLATION(PVSMGR_QMS ${PVSMGR_TSS})
endif (UPDATE_TRANSLATIONS)
# # write a resource file for qm files
# set(resource_file_content "<RCC>\n <qresource prefix=\"/\">\n")
# foreach(file ${PVSMGR_QMS})
# get_filename_component(filename ${file} NAME)
# set(resource_file_content "${resource_file_content} <file>${filename}</file>\n")
# endforeach(file)
# set(resource_file_content "${resource_file_content} </qresource>\n</RCC>\n")
# file(WRITE "${CMAKE_BINARY_DIR}/ts_pvsmgr.qrc" "${resource_file_content}")
# set(PVSMGR_RESOURCES ${PVSMGR_RESOURCES} "${CMAKE_BINARY_DIR}/ts_pvsmgr.qrc")
endif(PVSMGR_TSS)
if(PVSCLIENT_TSS)
if (UPDATE_TRANSLATIONS)
set(FILES_TO_TRANSLATE ${PVSCLIENT_SRCS} ${PVSCLIENT_UIS})
QT5_CREATE_TRANSLATION(PVSCLIENT_QMS ${FILES_TO_TRANSLATE} ${PVSCLIENT_TSS} OPTIONS -noobsolete)
message(STATUS ".tr files have been updated")
else (UPDATE_TRANSLATIONS)
QT5_ADD_TRANSLATION(PVSCLIENT_QMS ${PVSCLIENT_TSS})
endif (UPDATE_TRANSLATIONS)
# # write a resource file for qm files
# set(resource_file_content "<RCC>\n <qresource prefix=\"/\">\n")
# foreach(file ${PVSCLIENT_QMS})
# get_filename_component(filename ${file} NAME)
# set(resource_file_content "${resource_file_content} <file>${filename}</file>\n")
# endforeach(file)
# set(resource_file_content "${resource_file_content} </qresource>\n</RCC>\n")
# file(WRITE "${CMAKE_BINARY_DIR}/ts_pvsclient.qrc" "${resource_file_content}")
# set(PVSCLIENT_RESOURCES ${PVSCLIENT_RESOURCES} "${CMAKE_BINARY_DIR}/ts_pvsclient.qrc")
endif(PVSCLIENT_TSS)
# this will run rcc on .qrc files
QT5_ADD_RESOURCES(PVSMGR_RCS ${PVSMGR_RC_SRCS})
QT5_ADD_RESOURCES(PVSCLIENT_RCS ${PVSCLIENT_RC_SRCS})
################################################################################
# Build
################################################################################
ADD_EXECUTABLE(pvsmgr
${PVSMGR_SRCS}
${PVSMGR_RCS}
# ${PVSMGR_MOC_SRCS}
${PVSMGR_UI_HDRS}
${PVSMGR_RC_SRCS}
${PVSMGR_QMS}
)
ADD_EXECUTABLE(pvsclient
${PVSCLIENT_SRCS}
${PVSCLIENT_RCS}
# ${PVSCLIENT_MOC_SRCS}
${PVSCLIENT_UI_HDRS}
${PVSCLIENT_RC_SRCS}
${PVSCLIENT_QMS}
)
# link
TARGET_LINK_LIBRARIES(pvsmgr
Qt5::Network
Qt5::Widgets
Qt5::Svg
Qt5::X11Extras
# ${VNC_LIBRARIES}
${X11_LIBRARIES}
${X11_Xscreensaver_LIB}
)
TARGET_LINK_LIBRARIES(pvsclient
Qt5::Network
Qt5::Widgets
${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 )
|