v4l2rtspserver/CMakeLists.txt

95 lines
3.3 KiB
CMake
Raw Normal View History

2014-08-15 19:11:03 +00:00
cmake_minimum_required(VERSION 2.6)
# set project name from current directory
2014-08-15 20:33:40 +00:00
get_filename_component(BASENAME ${CMAKE_SOURCE_DIR} NAME)
project(${BASENAME})
2014-08-15 19:11:03 +00:00
2014-09-05 19:33:27 +00:00
set(CMAKE_BUILD_TYPE DEBUG)
set(CMAKE_C_FLAGS "-Wall")
set(CMAKE_CXX_FLAGS "-Wall")
add_custom_target(git_update
COMMAND git submodule init
COMMAND git submodule update
WORKING_DIRECTORY ${PROJECT_SOURCE_DIR}
)
2014-08-15 19:11:03 +00:00
# define executable to build
include_directories("${PROJECT_BINARY_DIR}/inc")
aux_source_directory(src SRC_FILES)
add_executable(${PROJECT_NAME} ${SRC_FILES})
add_dependencies(${PROJECT_NAME} git_update)
# v4l2wrapper
include_directories("${PROJECT_BINARY_DIR}/v4l2wrapper/inc")
set_source_files_properties(${PROJECT_BINARY_DIR}/v4l2wrapper/src/V4l2Capture.cpp PROPERTIES GENERATED 1)
set_source_files_properties(${PROJECT_BINARY_DIR}/v4l2wrapper/src/V4l2MmapCapture.cpp PROPERTIES GENERATED 1)
set_source_files_properties(${PROJECT_BINARY_DIR}/v4l2wrapper/src/V4l2ReadCapture.cpp PROPERTIES GENERATED 1)
add_library(v4l2wrapper
STATIC
v4l2wrapper/src/V4l2Capture.cpp
v4l2wrapper/src/V4l2MmapCapture.cpp
v4l2wrapper/src/V4l2ReadCapture.cpp
)
target_link_libraries(${PROJECT_NAME} v4l2wrapper)
add_dependencies(v4l2wrapper git_update)
2014-08-15 19:11:03 +00:00
#pthread
find_package (Threads)
target_link_libraries (${PROJECT_NAME} ${CMAKE_THREAD_LIBS_INIT})
2014-11-22 14:35:59 +00:00
# LOG4CPP
find_path(LOG4CPP_INCLUDE_DIR log4cpp/Category.hh)
if (NOT LOG4CPP_INCLUDE_DIR)
message(STATUS "Could not find the liblog4cpp5-dev.")
EXEC_PROGRAM("sudo apt-get install -y liblog4cpp5-dev")
2014-11-22 14:35:59 +00:00
find_path(V4L2_INCLUDE_DIR log4cpp/Category.hh)
endif (NOT LOG4CPP_INCLUDE_DIR)
include_directories(${LOG4CPP_INCLUDE_DIR})
find_library(LOG4CPP_LIBRARY log4cpp)
target_link_libraries(${PROJECT_NAME} "${LOG4CPP_LIBRARY}")
2014-08-15 19:11:03 +00:00
# V4L2
find_path(LIBV4L2_INCLUDE_DIR libv4l2.h)
if (NOT LIBV4L2_INCLUDE_DIR)
message(STATUS "Could not find package V4L2. Try to install it")
EXEC_PROGRAM("sudo apt-get install -y libv4l-dev")
find_path(LIBV4L2_INCLUDE_DIR libv4l2.h)
endif (NOT LIBV4L2_INCLUDE_DIR)
include_directories(${LIBV4L2_INCLUDE_DIR})
2014-08-15 19:11:03 +00:00
find_library(LIBV4L2_LIBRARY v4l2)
target_link_libraries(${PROJECT_NAME} "${LIBV4L2_LIBRARY}")
2014-08-15 19:11:03 +00:00
# live555
find_path(LIBLIVE555_INCLUDE_DIR liveMedia/liveMedia.hh)
if (NOT LIBLIVE555_INCLUDE_DIR)
message(STATUS "Could not find the liblivemedia-dev")
EXEC_PROGRAM("sudo apt-get install -y liblivemedia-dev")
2014-11-15 16:35:37 +00:00
find_path(LIBLIVE555_INCLUDE_DIR liveMedia/liveMedia.hh)
2014-08-15 19:11:03 +00:00
endif (NOT LIBLIVE555_INCLUDE_DIR)
foreach (LIBLIVE555_module groupsock liveMedia UsageEnvironment BasicUsageEnvironment)
include_directories(${LIBLIVE555_INCLUDE_DIR}/${LIBLIVE555_module})
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)
target_link_libraries(${PROJECT_NAME} ${LIBLIVE555_LIBRARIES})
2014-08-15 20:33:40 +00:00
# package
2014-08-15 22:27:47 +00:00
install (TARGETS ${PROJECT_NAME} DESTINATION bin)
2014-08-15 20:33:40 +00:00
SET(CPACK_GENERATOR "DEB")
SET(CPACK_DEBIAN_PACKAGE_MAINTAINER "Michel Promonet")
SET(CPACK_PACKAGE_CONTACT "michel.promonet@free.fr")
2014-08-15 22:27:47 +00:00
2014-08-15 20:33:40 +00:00
INCLUDE(CPack)