89 lines
2.9 KiB
CMake
89 lines
2.9 KiB
CMake
|
cmake_minimum_required(VERSION 3.20)
|
||
|
|
||
|
# 选择交叉编译环境
|
||
|
option(BUILD_RK3328 "build in rk3328 sdk" ON)
|
||
|
option(BUILD_RV1126 "build in rv1126 sdk" OFF)
|
||
|
# 导入交叉编译环境
|
||
|
if (${BUILD_RK3328})
|
||
|
include(cmake/rk3328.cmake)
|
||
|
add_definitions(-DSDK_RK3328)
|
||
|
elseif(${BUILD_RV1126})
|
||
|
include(cmake/rv1126.cmake)
|
||
|
add_definitions(-DSDK_RV1126)
|
||
|
|
||
|
endif()
|
||
|
|
||
|
SET(CMAKE_C_FLAGS_DEBUG "-O3")
|
||
|
SET(CMAKE_C_FLAGS_RELEASE "-O3")
|
||
|
SET(CMAKE_CXX_FLAGS_DEBUG "-O3")
|
||
|
SET(CMAKE_CXX_FLAGS_RELEASE "-O3")
|
||
|
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -ftree-vectorize")
|
||
|
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -ftree-vectorize")
|
||
|
SET(CMAKE_BUILD_TYPE "Release")
|
||
|
SET(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -fvisibility=hidden")
|
||
|
|
||
|
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS_DEBUG} -Wall -g -O0 -Wextra -Wno-unused-variable")
|
||
|
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS_RELDEBINFO} -g -O3")
|
||
|
|
||
|
# 设置C++标准 C++11
|
||
|
set(CMAKE_CXX_STANDARD 14)
|
||
|
set(CMAKE_BUILD_TYPE "Debug")
|
||
|
|
||
|
|
||
|
set(THIRDPARTY_PATH ${CMAKE_CURRENT_SOURCE_DIR}/third_party)
|
||
|
# link_directories(${THIRDPARTY_PATH}/lib)
|
||
|
include_directories(${THIRDPARTY_PATH}/include)
|
||
|
include_directories(${TARGET_SYSROOT}/usr/include)
|
||
|
include_directories(${THIRDPARTY_PATH}/include/absl)
|
||
|
include_directories(${THIRDPARTY_PATH}/include/webrtc-audio-processing-1)
|
||
|
# webrtc库
|
||
|
if(${BUILD_RK3328})
|
||
|
link_directories(${THIRDPARTY_PATH}/lib/webrtc/rk3328)
|
||
|
link_directories(${THIRDPARTY_PATH}/lib/rk3328)
|
||
|
elseif(${BUILD_RV1126})
|
||
|
link_directories(${THIRDPARTY_PATH}/lib/webrtc/rv1126)
|
||
|
link_directories(${THIRDPARTY_PATH}/lib/rv1126)
|
||
|
endif()
|
||
|
|
||
|
set(THIRD_LIBS avformat avcodec avfilter avdevice avutil swresample asound easymedia rga webrtc-audio-processing-1)
|
||
|
|
||
|
project(realtime_ns)
|
||
|
|
||
|
# ns source
|
||
|
file(GLOB NS_SRC ns/*.cc ns/*.h ns/*.c)
|
||
|
# log日志
|
||
|
set(LOGGER_SRCS
|
||
|
log/File.cpp
|
||
|
log/local_time.cpp
|
||
|
log/logger.cpp
|
||
|
log/NoticeCenter.cpp
|
||
|
log/util.cpp
|
||
|
log/uv_errno.cpp
|
||
|
)
|
||
|
|
||
|
if(${BUILD_RK3328})
|
||
|
add_executable(${PROJECT_NAME} main.cpp ${NS_SRC})
|
||
|
add_executable(record_file record_file.cpp ${NS_SRC})
|
||
|
target_link_libraries(${PROJECT_NAME} ${THIRD_LIBS} pthread)
|
||
|
target_link_libraries(record_file ${THIRD_LIBS})
|
||
|
endif()
|
||
|
|
||
|
add_executable(aecm_sender aecm_sender.cpp alsa_dev.cpp ${LOGGER_SRCS})
|
||
|
add_executable(aecm_receiver aecm_receiver.cpp alsa_dev.cpp ${LOGGER_SRCS})
|
||
|
target_link_libraries(aecm_sender ${THIRD_LIBS} pthread)
|
||
|
target_link_libraries(aecm_receiver ${THIRD_LIBS} pthread)
|
||
|
|
||
|
add_executable(cap_test cap_test.cpp alsa_dev.cpp ${LOGGER_SRCS})
|
||
|
target_link_libraries(cap_test ${THIRD_LIBS} pthread)
|
||
|
|
||
|
add_executable(voice_call voice_call.cpp alsa_dev.cpp agc.c rnnoise_plugin.cpp ${LOGGER_SRCS})
|
||
|
target_link_libraries(voice_call ${THIRD_LIBS} pthread rnnoise atomic)
|
||
|
|
||
|
add_executable(agcm_test agcm_test.cpp alsa_dev.cpp agc.c ${LOGGER_SRCS})
|
||
|
target_link_libraries(agcm_test ${THIRD_LIBS} pthread)
|
||
|
|
||
|
add_executable(rtmp_push rtmp_push.cpp alsa_dev.cpp agc.c rnnoise_plugin.cpp ${LOGGER_SRCS})
|
||
|
target_link_libraries(rtmp_push ${THIRD_LIBS} pthread rnnoise atomic)
|
||
|
|
||
|
|