-
Notifications
You must be signed in to change notification settings - Fork 0
/
CMakeLists.txt
169 lines (142 loc) · 4.29 KB
/
CMakeLists.txt
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
cmake_minimum_required(VERSION 3.1)
project(webx-engine)
if(NOT CMAKE_BUILD_TYPE)
set(CMAKE_BUILD_TYPE Debug)
endif()
# set(CMAKE_CXX_FLAGS_DEBUG "-g -O0 -pg")
set(CMAKE_CXX_FLAGS_DEBUG "-g -O0")
set(CMAKE_CXX_FLAGS_RELEASE "-O3 -ftree-vectorize -mavx")
set(CMAKE_CXX_STANDARD 11)
file(MAKE_DIRECTORY ${CMAKE_BINARY_DIR}/bin)
set(CMAKE_RUNTIME_OUTPUT_DIRECTORY ${CMAKE_BINARY_DIR}/bin)
file(GLOB_RECURSE SOURCES src/*.cpp src/*/*.cpp lib/*.c lib/*.cpp)
find_package(PkgConfig)
if (NOT PKG_CONFIG_FOUND)
message(FATAL_ERROR "pkg-config needed, install it please!")
endif ()
find_package(Threads REQUIRED)
pkg_check_modules(LIBPNG libpng)
pkg_check_modules(WEBP REQUIRED libwebp )
pkg_check_modules(X11 REQUIRED x11)
include_directories(src lib)
add_executable(${PROJECT_NAME} ${SOURCES})
target_link_libraries(
${PROJECT_NAME}
${LIBPNG_LIBRARIES}
-ljpeg
-lwebp
${X11_LIBRARIES}
-lXdamage
${CMAKE_THREAD_LIBS_INIT}
-lzmq
-lXtst
-lxkbfile
-lXfixes
)
target_include_directories(
${PROJECT_NAME}
PUBLIC
${LIBPNG_INCLUDEDIR}
${ZeroMQ_INCLUDE_DIR}
)
file(GLOB_RECURSE TEST_IMAGE_SOURCES test/testImageEncoder.cpp src/image/*.cpp src/utils/*.cpp lib/*.cpp)
add_executable(testImageEncoder ${TEST_IMAGE_SOURCES})
target_link_libraries(
testImageEncoder
${LIBPNG_LIBRARIES}
${CMAKE_THREAD_LIBS_INIT}
-ljpeg
-lpng
-lwebp
-lXtst
-lX11
)
file(GLOB_RECURSE TEST_SQUISH_SOURCES test/testSquish.cpp)
add_executable(testSquish ${TEST_SQUISH_SOURCES})
target_link_libraries(
testSquish
${LIBPNG_LIBRARIES}
${CMAKE_THREAD_LIBS_INIT}
-lpng
-lsquish
)
file(GLOB_RECURSE TEST_ALPHA_SOURCES test/testAlpha.cpp src/image/*.cpp src/utils/*.cpp lib/*.cpp)
add_executable(testAlpha ${TEST_ALPHA_SOURCES})
target_link_libraries(
testAlpha
${LIBPNG_LIBRARIES}
${CMAKE_THREAD_LIBS_INIT}
-ljpeg
-lwebp
)
file(GLOB_RECURSE TEST_MOUSE_SOURCES test/testMouse.cpp)
add_executable(testMouse ${TEST_MOUSE_SOURCES})
target_link_libraries(
testMouse
-lXtst
-lX11
)
file(GLOB_RECURSE TEST_KEYBOARD_SOURCES test/testKeyboard.cpp)
add_executable(testKeyboard ${TEST_KEYBOARD_SOURCES})
target_link_libraries(
testKeyboard
-lXtst
-lX11
)
file(GLOB_RECURSE TEST_CURSOR_IMAGE_ENCODER_SOURCES test/testCursorImageEncoder.cpp src/input/* src/utils/* src/image/* lib/crc32/*)
add_executable(testCursorImageEncoder ${TEST_CURSOR_IMAGE_ENCODER_SOURCES})
target_link_libraries(
testCursorImageEncoder
-lXtst
-lX11
-lXfixes
-lxkbfile
-ljpeg
-lwebp
-lpng
)
file(GLOB_RECURSE TEST_PUSH_SOURCES test/testPush.cpp)
add_executable(testPush ${TEST_PUSH_SOURCES})
target_link_libraries(
testPush
-lzmq
)
file(GLOB_RECURSE TEST_PUSH_PULL_SOURCES test/testPushPull.cpp)
add_executable(testPushPull ${TEST_PUSH_PULL_SOURCES})
target_link_libraries(
testPushPull
${CMAKE_THREAD_LIBS_INIT}
-lzmq
)
file(GLOB_RECURSE TEST_DAMAGE_SOURCES test/testDamage.cpp src/events/*)
add_executable(testDamage ${TEST_DAMAGE_SOURCES})
target_link_libraries(
testDamage
-lX11
-lXfixes
-lXdamage
)
file(GLOB_RECURSE TEST_ALPHA_CHECK_SOURCES test/testAlphaCheck.cpp)
add_executable(testAlphaCheck ${TEST_ALPHA_CHECK_SOURCES})
target_link_libraries(
testAlphaCheck
)
file(GLOB_RECURSE TEST_ALPHA_CREATE_SOURCES test/testAlphaCreate.cpp)
add_executable(testAlphaCreate ${TEST_ALPHA_CREATE_SOURCES})
target_link_libraries(
testAlphaCreate
)
install(TARGETS ${PROJECT_NAME} DESTINATION "/usr/bin")
SET(CPACK_GENERATOR "DEB")
set(CPACK_CMAKE_GENERATOR Ninja)
set(CPACK_PACKAGE_VERSION "0.1.0")
SET(CPACK_DEBIAN_PACKAGE_MAINTAINER "Stuart Caunt <[email protected]>, Jamie Hall <[email protected]>")
set(CPACK_DEBIAN_PACKAGE_SHLIBDEPS ON)
set(CPACK_PACKAGE_DESCRIPTION_SUMMARY "The WebX Engine hooks on to an X11 display and provides a protocol to obtain X11 windows, receive display events and forward mouse and keyboard events.")
set(CPACK_RESOURCE_FILE_LICENSE "${CMAKE_CURRENT_SOURCE_DIR}/LICENSE")
set(CPACK_RESOURCE_FILE_README "${CMAKE_CURRENT_SOURCE_DIR}/README.md")
set(CPACK_DEBIAN_PACKAGE_SECTION "net")
set(CPACK_DEBIAN_PACKAGE_ARCHITECTURE "amd64")
set(CPACK_PACKAGE_FILE_NAME "${PROJECT_NAME}_${CPACK_PACKAGE_VERSION}_${CPACK_DEBIAN_PACKAGE_ARCHITECTURE}")
SET(CPACK_OUTPUT_FILE_PREFIX packages)
INCLUDE(CPack)