-
Notifications
You must be signed in to change notification settings - Fork 52
/
CMakeLists.txt
156 lines (134 loc) · 5.04 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
project(freshplayerplugin)
cmake_minimum_required(VERSION 2.8.8)
# version
set(VER_MAJOR 0)
set(VER_MINOR 3)
set(VER_MICRO 12)
# setup compiler flags
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -std=gnu99 -fPIC -pthread")
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -Wall -Werror=format-security")
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -Werror=implicit-function-declaration")
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -std=c++11 -fPIC -pthread")
#set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Wall -Werror=format-security")
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -Werror=implicit-function-declaration")
# add missing NDEBUG in RelWithDebugInfo
set(CMAKE_CXX_FLAGS_RELWITHDEBINFO "${CMAKE_CXX_FLAGS_RELWITHDEBINFO} -DNDEBUG -g3")
set(CMAKE_C_FLAGS_RELWITHDEBINFO "${CMAKE_C_FLAGS_RELWITHDEBINFO} -DNDEBUG -g3")
# generate more debug info for Debug build type
set(CMAKE_CXX_FLAGS_DEBUG "${CMAKE_CXX_FLAGS_DEBUG} -O0 -g3")
set(CMAKE_C_FLAGS_DEBUG "${CMAKE_C_FLAGS_DEBUG} -O0 -g3")
# directory for auto-generated headers
include_directories("${CMAKE_BINARY_DIR}")
# determine software version
add_custom_target(git-revision ALL
COMMAND sh "${CMAKE_SOURCE_DIR}/cmake/update-version-info.sh"
"${CMAKE_SOURCE_DIR}" "${CMAKE_BINARY_DIR}" ${VER_MAJOR}
${VER_MINOR} ${VER_MICRO}
WORKING_DIRECTORY "${CMAKE_BINARY_DIR}")
# find Ragel
find_program(RAGEL ragel)
if (${RAGEL} STREQUAL "RAGEL-NOTFOUND")
message(FATAL_ERROR "Ragel State Machine Compiler not found")
endif()
# dependencies
find_package(PkgConfig REQUIRED)
pkg_check_modules(GLIB glib-2.0 REQUIRED)
pkg_check_modules(REQ
alsa
gio-2.0
x11
xrandr
xrender
xcursor
gl
libdrm
libevent
libevent_pthreads
cairo
pango
pangocairo
pangoft2
freetype2
openssl
icu-uc
REQUIRED)
# merge glib-2.0
list(APPEND REQ_LIBRARY_DIRS ${GLIB_LIBRARY_DIRS})
list(APPEND REQ_INCLUDE_DIRS ${GLIB_INCLUDE_DIRS})
list(APPEND REQ_LIBRARIES ${GLIB_LIBRARIES})
# libdl.so, librt.so, and libm.so
list(APPEND REQ_LIBRARIES dl rt m)
# OpenGL ES 2
set(WITH_GLES2 FALSE CACHE BOOLEAN "use system libGLESv2")
if (WITH_GLES2)
pkg_check_modules(GLES2 glesv2 REQUIRED)
add_definitions(-DHAVE_GLES2=1)
list(APPEND REQ_LIBRARY_DIRS ${GLES2_LIBRARY_DIRS})
list(APPEND REQ_INCLUDE_DIRS ${GLES2_INCLUDE_DIRS})
list(APPEND REQ_LIBRARIES ${GLES2_LIBRARIES})
else()
# otherwise ANGLE will be used for shader translation
endif()
# optional dependencies
message(STATUS "checking for optional dependencies")
pkg_check_modules(PULSEAUDIO QUIET libpulse)
pkg_check_modules(JACK QUIET jack)
pkg_check_modules(SOXR QUIET soxr)
set(WITH_PULSEAUDIO TRUE CACHE STRING "enable PulseAudio support")
set(WITH_JACK TRUE CACHE STRING "enable JACK Audio Connection Kit")
if (PULSEAUDIO_FOUND AND WITH_PULSEAUDIO)
add_definitions(-DHAVE_PULSEAUDIO=1)
message(STATUS " found libpulse, version ${PULSEAUDIO_VERSION} (optional)")
list(APPEND REQ_LIBRARY_DIRS ${PULSEAUDIO_LIBRARY_DIRS})
list(APPEND REQ_INCLUDE_DIRS ${PULSEAUDIO_INCLUDE_DIRS})
list(APPEND REQ_LIBRARIES ${PULSEAUDIO_LIBRARIES})
else()
message(STATUS " no libpulse found (optional)")
endif()
if (JACK_FOUND AND WITH_JACK)
message(STATUS " found jack, version ${JACK_VERSION} (optional)")
if (SOXR_FOUND)
message(STATUS " found soxr, version ${SOXR_VERSION}")
add_definitions(-DHAVE_JACK=1)
list(APPEND REQ_LIBRARY_DIRS "${JACK_LIBRARY_DIRS}" "${SOXR_LIBRARY_DIRS}")
list(APPEND REQ_INCLUDE_DIRS "${JACK_INCLUDE_DIRS}" "${SOXR_INCLUDE_DIRS}")
list(APPEND REQ_LIBRARIES "${JACK_LIBRARIES}" "${SOXR_LIBRARIES}")
else()
message(STATUS " no soxr found, JACK output disabled")
endif()
else()
message(STATUS " no jack found (optional)")
endif()
# hw accelerated decoding
set(WITH_HWDEC TRUE CACHE STRING "enable hw accelerated decoding")
if (WITH_HWDEC)
pkg_check_modules(HWDEC libavcodec libavutil libva libva-x11 vdpau REQUIRED)
list(APPEND REQ_LIBRARY_DIRS ${HWDEC_LIBRARY_DIRS})
list(APPEND REQ_INCLUDE_DIRS ${HWDEC_INCLUDE_DIRS})
list(APPEND REQ_LIBRARIES ${HWDEC_LIBRARIES})
add_subdirectory(cmake/ffmpeg-compat)
endif()
# using libv4l2 for colorspace conversion
set(WITH_LIBV4L2 TRUE CACHE STRING "use libv4l2 for colorspace conversion")
if (WITH_LIBV4L2)
add_definitions(-DHAVE_LIBV4L2=1)
pkg_check_modules(LIBV4L2 libv4l2 REQUIRED)
list(APPEND REQ_LIBRARY_DIRS ${LIBV4L2_LIBRARY_DIRS})
list(APPEND REQ_INCLUDE_DIRS ${LIBV4L2_INCLUDE_DIRS})
list(APPEND REQ_LIBRARIES ${LIBV4L2_LIBRARIES})
else()
add_definitions(-DHAVE_LIBV4L2=0)
endif()
include_directories(${REQ_INCLUDE_DIRS})
link_directories(${REQ_LIBRARY_DIRS})
add_definitions(${REQ_CFLAGS_OTHER})
add_definitions(-DXP_UNIX)
include_directories(3rdparty)
if (NOT WITH_GLES2)
include_directories(3rdparty/angle/include)
list(APPEND REQ_LIBRARIES shader_translator)
endif()
set(SYMBOLMAP "-Wl,-version-script=\"${CMAKE_SOURCE_DIR}/src/symbolmap\"")
add_subdirectory(3rdparty)
add_subdirectory(src)
add_subdirectory(tests)