forked from Dafang-Hacks/v4l2rtspserver-master
-
Notifications
You must be signed in to change notification settings - Fork 0
/
CMakeLists.txt
97 lines (69 loc) · 3.59 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
cmake_minimum_required(VERSION 2.6)
# set project name from current directory
get_filename_component(BASENAME ${CMAKE_SOURCE_DIR} NAME)
project(${BASENAME})
set(CMAKE_C_FLAGS "-Wall")
set(CMAKE_CXX_FLAGS "-std=c++11 -Wall")
# define executable to build
include_directories("inc")
aux_source_directory(src SRC_FILES)
add_executable(${PROJECT_NAME} ${SRC_FILES})
if (COVERAGE)
set(COVERAGE_FLAGS "-g -O0 -fprofile-arcs -ftest-coverage")
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} ${COVERAGE_FLAGS}")
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${COVERAGE_FLAGS}")
target_link_libraries(${PROJECT_NAME} gcov)
endif()
# v4l2wrapper
include_directories("v4l2wrapper/inc")
find_library(V4L2WRAPPER_LIBRARY libv4l2wrapper.a PATHS "." NO_CMAKE_FIND_ROOT_PATH)
if (NOT V4L2WRAPPER_LIBRARY)
message(STATUS "Installing v4l2wrapper")
EXEC_PROGRAM("git submodule init && git submodule update && make -C v4l2wrapper CC=${CMAKE_C_COMPILER} CFLAGS_EXTRA=--sysroot=${CMAKE_FIND_ROOT_PATH} && cp v4l2wrapper/libv4l2wrapper.a . && make -C v4l2wrapper clean")
find_library(V4L2WRAPPER_LIBRARY libv4l2wrapper.a PATHS "." NO_CMAKE_FIND_ROOT_PATH)
message(STATUS "v4l2wrapper built in V4L2WRAPPER_LIBRARY=${V4L2WRAPPER_LIBRARY}")
endif (NOT V4L2WRAPPER_LIBRARY)
target_link_libraries(${PROJECT_NAME} PUBLIC ${V4L2WRAPPER_LIBRARY})
#pthread
find_package (Threads)
target_link_libraries (${PROJECT_NAME} PUBLIC ${CMAKE_THREAD_LIBS_INIT})
#ALSA
#target_link_libraries (${PROJECT_NAME} PUBLIC ${ALSA_LIBRARY})
find_path(LIBLIVE555_INCLUDE_DIR liveMedia/liveMedia.hh)
include_directories(../live/liveMedia/include)
include_directories(../v4l2rtspserver-tools/)
add_library(sharedmem ../v4l2rtspserver-tools/sharedmem.cpp)
target_link_libraries(${PROJECT_NAME} sharedmem)
include_directories("filter")
add_library(filter filter/g711super.c filter/noise_remover.c filter/wave.c filter/mylog.c)
target_link_libraries(${PROJECT_NAME} filter)
#include_directories(../live/liveMedia/)
foreach (LIBLIVE555_module groupsock liveMedia UsageEnvironment BasicUsageEnvironment)
include_directories(../live/${LIBLIVE555_module}/include)
endforeach (LIBLIVE555_module)
set(LIBLIVE555_LIBRARIES "")
foreach (LIBLIVE555_module groupsock liveMedia UsageEnvironment BasicUsageEnvironment)
find_library( ${LIBLIVE555_module}_LIBRARY ${LIBLIVE555_module} )
if ( ${LIBLIVE555_module}_LIBRARY )
set(LIBLIVE555_LIBRARIES ${LIBLIVE555_LIBRARIES} ${${LIBLIVE555_module}_LIBRARY})
endif ( ${LIBLIVE555_module}_LIBRARY )
endforeach (LIBLIVE555_module)
# Separate treatments of dynamic and static libs
set(DEPENDLIBS ${CMAKE_CURRENT_SOURCE_DIR}/../live/liveMedia/libliveMedia.so ;
${CMAKE_CURRENT_SOURCE_DIR}/../live/groupsock/libgroupsock.so ;
${CMAKE_CURRENT_SOURCE_DIR}/../live/UsageEnvironment/libUsageEnvironment.so ;
${CMAKE_CURRENT_SOURCE_DIR}/../live/BasicUsageEnvironment/libBasicUsageEnvironment.so ;
${CMAKE_CURRENT_SOURCE_DIR}/uclibc/libalog.so ;
${CMAKE_CURRENT_SOURCE_DIR}/uclibc/libimp.so ;
${CMAKE_CURRENT_SOURCE_DIR}/uclibc/libsysutils.so;
${CMAKE_CURRENT_SOURCE_DIR}/../lame-3.100/_install/lib/libmp3lame.so;
${CMAKE_CURRENT_SOURCE_DIR}/../opus/.libs/libopus.so
)
foreach (LIB ${DEPENDLIBS})
target_link_libraries(${PROJECT_NAME} PRIVATE ${LIB})
install(FILES ${LIB} DESTINATION libs NAMELINK_ONLY)
endforeach (LIB)
target_link_libraries(${PROJECT_NAME} PRIVATE "${CMAKE_CURRENT_SOURCE_DIR}/libv4l2wrapper.a")
target_link_libraries(${PROJECT_NAME} PRIVATE "${CMAKE_CURRENT_SOURCE_DIR}/libfilter.a")
# Install
install (TARGETS ${PROJECT_NAME} DESTINATION bin)