Skip to content

Commit a2b8594

Browse files
author
kgbook
committed
chore(build):finish skeleton
1 parent 277cee7 commit a2b8594

11 files changed

+6557
-0
lines changed

.gitignore

+7
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,10 @@
1+
# Locals
2+
node_modules
3+
cmake-build-debug
4+
build
5+
.DS_Store
6+
.idea
7+
#
18
# Prerequisites
29
*.d
310

CMakeLists.txt

+60
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,60 @@
1+
cmake_minimum_required(VERSION 3.7)
2+
set(PROJECT_NAME RTSPServer)
3+
project(${PROJECT_NAME})
4+
5+
option(DEBUG "release or debug" OFF)
6+
7+
set(CMAKE_CXX_STANDARD 11)
8+
set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} ${CMAKE_SOURCE_DIR}/cmake)
9+
set(CMAKE_ARCHIVE_OUTPUT_DIRECTORY ${PROJECT_BINARY_DIR}/lib)
10+
set(CMAKE_LIBRARY_OUTPUT_DIRECTORY ${PROJECT_BINARY_DIR}/lib)
11+
set(EXECUTABLE_OUTPUT_PATH ${PROJECT_BINARY_DIR}/bin)
12+
13+
include(cpplint)
14+
15+
if (DEBUG)
16+
set(CMAKE_VERBOSE_MAKEFILE ON)
17+
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -g -O0")
18+
else()
19+
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -O2")
20+
add_definitions(-DNDEBUG)
21+
endif ()
22+
23+
find_package(PkgConfig)
24+
if (NOT PKG_CONFIG_FOUND)
25+
message(FATAL_ERROR "pkg-config needed, install it please!")
26+
endif ()
27+
28+
pkg_check_modules(libavformat REQUIRED libavformat)
29+
pkg_check_modules(libavutil REQUIRED libavutil)
30+
pkg_check_modules(libavcodec REQUIRED libavcodec)
31+
pkg_check_modules(spdlog REQUIRED spdlog)
32+
33+
set(Boost_USE_STATIC_LIBS OFF)
34+
set(Boost_USE_MULTITHREADED ON)
35+
set(Boost_USE_STATIC_RUNTIME OFF)
36+
find_package(Boost 1.66.0 REQUIRED)
37+
if (NOT Boost_FOUND)
38+
message(FATAL_ERROR "Boost needed, install it please!")
39+
endif()
40+
41+
include_directories(${CMAKE_SOURCE_DIR}
42+
${libavformat_INCLUDE_DIRS}
43+
${libavutil_INCLUDE_DIRS}
44+
${libavcodec_INCLUDE_DIRS}
45+
${Boost_INCLUDE_DIRS}
46+
${spdlog_INCLUDE_DIRS}
47+
${fmt_INCLUDE_DIRS})
48+
49+
link_directories(${libavformat_LIBRARY_DIRS}
50+
${libavutil_LIBRARY_DIRS}
51+
${libavcodec_LIBRARY_DIRS}
52+
${Boost_LIBRARY_DIRS}
53+
${spdlog_LIBRARY_DIRS}
54+
${fmt_LIBRARY_DIRS})
55+
56+
add_subdirectory(skeleton)
57+
add_subdirectory(utils)
58+
add_subdirectory(server)
59+
add_subdirectory(client)
60+
#add_subdirectory(testProgs)

client/CMakeLists.txt

+7
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
include_directories(${CMAKE_CURRENT_SOURCE_DIR})
2+
3+
aux_source_directory(${CMAKE_CURRENT_SOURCE_DIR} client_src)
4+
5+
add_library(client STATIC ${client_src})
6+
7+
add_style_check_target(client_cpplint "${client_src}")

cmake/cpplint.cmake

+84
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,84 @@
1+
# Copyright (C) 2013 Daniel Scharrer
2+
#
3+
# This software is provided 'as-is', without any express or implied
4+
# warranty. In no event will the author(s) be held liable for any damages
5+
# arising from the use of this software.
6+
#
7+
# Permission is granted to anyone to use this software for any purpose,
8+
# including commercial applications, and to alter it and redistribute it
9+
# freely, subject to the following restrictions:
10+
#
11+
# 1. The origin of this software must not be misrepresented; you must not
12+
# claim that you wrote the original software. If you use this software
13+
# in a product, an acknowledgment in the product documentation would be
14+
# appreciated but is not required.
15+
# 2. Altered source versions must be plainly marked as such, and must not be
16+
# misrepresented as being the original software.
17+
# 3. This notice may not be removed or altered from any source distribution.
18+
19+
20+
# Copyright (C) 2014 Greg Horn
21+
# In order to comply with the above copyright, I am noting that I took
22+
# Daniel's script and hacked it a bit, mostly changing paths and filters
23+
24+
find_package(PythonInterp 2.7 REQUIRED)
25+
26+
set(STYLE_FILTER)
27+
28+
# disable unwanted filters
29+
set(STYLE_FILTER ${STYLE_FILTER}-whitespace/braces,)
30+
set(STYLE_FILTER ${STYLE_FILTER}-whitespace/semicolon,)
31+
set(STYLE_FILTER ${STYLE_FILTER}-whitespace/blank_line,)
32+
set(STYLE_FILTER ${STYLE_FILTER}-whitespace/comma,)
33+
set(STYLE_FILTER ${STYLE_FILTER}-whitespace/operators,)
34+
set(STYLE_FILTER ${STYLE_FILTER}-whitespace/parens,)
35+
set(STYLE_FILTER ${STYLE_FILTER}-whitespace/indent,)
36+
set(STYLE_FILTER ${STYLE_FILTER}-whitespace/comments,)
37+
set(STYLE_FILTER ${STYLE_FILTER}-whitespace/newline,)
38+
set(STYLE_FILTER ${STYLE_FILTER}-whitespace/tab,)
39+
set(STYLE_FILTER ${STYLE_FILTER}-whitespace/ending_newline,)
40+
41+
set(STYLE_FILTER ${STYLE_FILTER}-build/include_order,)
42+
set(STYLE_FILTER ${STYLE_FILTER}-build/namespaces,)
43+
set(STYLE_FILTER ${STYLE_FILTER}-build/include_what_you_use,)
44+
set(STYLE_FILTER ${STYLE_FILTER}-build/include,)
45+
46+
set(STYLE_FILTER ${STYLE_FILTER}-readability/streams,)
47+
set(STYLE_FILTER ${STYLE_FILTER}-readability/todo,)
48+
49+
set(STYLE_FILTER ${STYLE_FILTER}-runtime/references,)
50+
set(STYLE_FILTER ${STYLE_FILTER}-runtime/int,)
51+
set(STYLE_FILTER ${STYLE_FILTER}-runtime/explicit,)
52+
set(STYLE_FILTER ${STYLE_FILTER}-runtime/printf,)
53+
54+
set(STYLE_FILTER ${STYLE_FILTER}-legal/copyright)
55+
56+
function(add_style_check_target TARGET_NAME SOURCES_LIST)
57+
58+
if(NOT PYTHONINTERP_FOUND)
59+
message(FATAL_ERROR "python not found!")
60+
endif()
61+
62+
find_file(GOOGLE_CPP_LINT_PY NAMES cpplint.py PATHS ${CMAKE_SOURCE_DIR} DOC "google cpp style scan program.")
63+
# if (NOT EXISTS ${CMAKE_SOURCE_DIR}/cmake/cpplint.py)
64+
# message (FATAL_ERROR "${CMAKE_SOURCE_DIR}/cmake/cpplint.py not found!")
65+
# endif()
66+
67+
list(REMOVE_DUPLICATES SOURCES_LIST)
68+
list(SORT SOURCES_LIST)
69+
70+
add_custom_target(${TARGET_NAME} ALL
71+
COMMAND "${CMAKE_COMMAND}" -E chdir
72+
"${CMAKE_CURRENT_SOURCE_DIR}"
73+
"${PYTHON_EXECUTABLE}"
74+
"${CMAKE_SOURCE_DIR}/cpplint.py"
75+
"--filter=${STYLE_FILTER}"
76+
"--counting=detailed"
77+
"--extensions=cpp,hpp,h"
78+
"--linelength=250"
79+
${SOURCES_LIST}
80+
DEPENDS ${SOURCES_LIST}
81+
COMMENT "Linting ${TARGET_NAME}"
82+
VERBATIM)
83+
84+
endfunction()

0 commit comments

Comments
 (0)