This repository has been archived by the owner on Sep 23, 2021. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 9
/
CMakeLists.txt
165 lines (144 loc) · 4.24 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
cmake_minimum_required(VERSION 2.8.3)
project(ros_web_video)
## Find catkin macros and libraries
## if COMPONENTS list like find_package(catkin REQUIRED COMPONENTS xyz)
## is used, also find other catkin packages
find_package(catkin REQUIRED roscpp rostime sensor_msgs image_transport mk)
find_package(Boost COMPONENTS system filesystem thread REQUIRED)
find_package(BZip2 REQUIRED)
find_package(ZLIB REQUIRED)
###################################################
## Declare things to be passed to other projects ##
###################################################
## LIBRARIES: libraries you create in this project that dependent projects also need
## CATKIN_DEPENDS: catkin_packages dependent projects also need
## DEPENDS: system dependencies of this project that dependent projects also need
catkin_package(
INCLUDE_DIRS include
LIBRARIES ${PROJECT_NAME}
CATKIN_DEPENDS sensor_msgs image_transport roscpp rostime mk
)
###########
## Build ##
###########
## Specify additional locations of header files
include_directories(include
${PROJECT_SOURCE_DIR}/FFmpeg/
${catkin_INCLUDE_DIRS}
${Boost_INCLUDE_DIRS}
${ZLIB_INCLUDE_DIRS}
${BZIP2_INCLUDE_DIR}
)
link_directories(
${catkin_LIBRARY_DIRS}
${Boost_LIBRARY_DIRS}
${ZLIB_LIBRARY_DIRS}
${BZIP2_LIBRARY_DIR}
)
add_definitions(
${ZLIB_CFLAGS_OTHER}
${BZIP2_CFLAGS_OTHER}
)
## Grab external libraries
execute_process(
COMMAND git config --global http.sslVerify false
WORKING_DIRECTORY ${PROJECT_SOURCE_DIR}/
)
execute_process(
COMMAND git clone https://chromium.googlesource.com/webm/libvpx
WORKING_DIRECTORY ${PROJECT_SOURCE_DIR}/
)
execute_process(
COMMAND git checkout v1.2.0
WORKING_DIRECTORY ${PROJECT_SOURCE_DIR}/libvpx
)
execute_process(
COMMAND git clone https://github.com/FFmpeg/FFmpeg.git
WORKING_DIRECTORY ${PROJECT_SOURCE_DIR}/
)
execute_process(
COMMAND git checkout n1.1
WORKING_DIRECTORY ${PROJECT_SOURCE_DIR}/FFmpeg
)
execute_process(
COMMAND git config --global http.sslVerify true
WORKING_DIRECTORY ${PROJECT_SOURCE_DIR}/
)
## Setup libvpx
execute_process(
COMMAND ./configure --enable-vp8
WORKING_DIRECTORY ${PROJECT_SOURCE_DIR}/libvpx/
)
execute_process(
COMMAND make
WORKING_DIRECTORY ${PROJECT_SOURCE_DIR}/libvpx/
)
## Setup FFmpeg
execute_process(
COMMAND ./configure --enable-libvpx --extra-cflags="-I../libvpx" --extra-ldflags="-L../libvpx" --enable-gpl
WORKING_DIRECTORY ${PROJECT_SOURCE_DIR}/FFmpeg/
)
execute_process(
COMMAND make WORKING_DIRECTORY
${PROJECT_SOURCE_DIR}/FFmpeg/
)
## Declare a cpp executables and libraries
add_executable(${PROJECT_NAME}
src/ffmpeg_wrapper.cpp
src/server.cpp
src/connection.cpp
src/topic_streamer.cpp
src/reply.cpp
src/request_parser.cpp
src/image_subscriber.cpp
src/ffmpeg_encoder.cpp
)
add_library(avcodec STATIC IMPORTED)
set_property(TARGET avcodec
PROPERTY IMPORTED_LOCATION ${PROJECT_SOURCE_DIR}/FFmpeg/libavcodec/libavcodec.a
)
add_library(avformat STATIC IMPORTED)
set_property(TARGET avformat PROPERTY
IMPORTED_LOCATION ${PROJECT_SOURCE_DIR}/FFmpeg/libavformat/libavformat.a
)
add_library(avutil STATIC IMPORTED)
set_property(TARGET avutil PROPERTY
IMPORTED_LOCATION ${PROJECT_SOURCE_DIR}/FFmpeg/libavutil/libavutil.a
)
add_library(avfilter STATIC IMPORTED)
set_property(TARGET avfilter PROPERTY
IMPORTED_LOCATION ${PROJECT_SOURCE_DIR}/FFmpeg/libavfilter/libavfilter.a
)
add_library(swscale STATIC IMPORTED)
set_property(TARGET swscale PROPERTY
IMPORTED_LOCATION ${PROJECT_SOURCE_DIR}/FFmpeg/libswscale/libswscale.a
)
add_library(vpx STATIC IMPORTED)
set_property(TARGET vpx PROPERTY
IMPORTED_LOCATION ${PROJECT_SOURCE_DIR}/libvpx/libvpx.a
)
target_link_libraries(${PROJECT_NAME}
${catkin_LIBRARIES}
${Boost_LIBRARIES}
avcodec
avformat
avutil
avfilter
swscale
vpx
${BZIP2_LIBRARIES}
${ZLIB_LIBRARIES}
)
#############
## Install ##
#############
## Mark executables and/or libraries for installation
install(TARGETS ${PROJECT_NAME}
RUNTIME DESTINATION ${CATKIN_PACKAGE_BIN_DESTINATION}
ARCHIVE DESTINATION ${CATKIN_PACKAGE_LIB_DESTINATION}
LIBRARY DESTINATION ${CATKIN_PACKAGE_LIB_DESTINATION}
)
install(DIRECTORY include/
DESTINATION ${CATKIN_PACKAGE_INCLUDE_DESTINATION}
FILES_MATCHING PATTERN "*.h" PATTERN "*.hpp"
)