rtspReceive/CMakeLists.txt

55 lines
2.0 KiB
CMake
Raw Normal View History

2024-03-21 16:23:30 +08:00
cmake_minimum_required(VERSION 3.7)
set(PROJECT_NAME recive)
project(${PROJECT_NAME})
set(CMAKE_CXX_STANDARD 20)
set(CMAKE_CXX_STANDARD_REQUIRED True)
add_definitions(-DLIVEMEDIA_API=)
add_definitions(-DNO_OPENSSL=1)
include_directories(${CMAKE_CURRENT_SOURCE_DIR}/includes)
include_directories(${CMAKE_CURRENT_SOURCE_DIR}/includes/rtc)
include_directories(${CMAKE_CURRENT_SOURCE_DIR}/includes/nlohmann)
include_directories(${CMAKE_CURRENT_SOURCE_DIR}/includes/nlohmann/detail)
include_directories(${CMAKE_CURRENT_SOURCE_DIR}/includes/nlohmann/thirdparty)
include_directories(${CMAKE_CURRENT_SOURCE_DIR}/includes/ffmpeg)
include_directories(${CMAKE_CURRENT_SOURCE_DIR}/includes/ffmpeg/libavcodec)
include_directories(${CMAKE_CURRENT_SOURCE_DIR}/includes/ffmpeg/libavformat)
include_directories(${CMAKE_CURRENT_SOURCE_DIR}/includes/ffmpeg/libavutil)
set(LIBS_PATH ${CMAKE_CURRENT_SOURCE_DIR}/libs)
# static
link_directories(${LIBS_PATH})
# for datachannel
link_libraries(datachannel)
link_libraries(json)
# for ffmpeg
link_directories(${LIBS_PATH}/ffmpeg)
link_libraries(avcodec)
link_libraries(avdevice)
link_libraries(avutil)
aux_source_directory(./src DIR_SRCS)
add_executable(${PROJECT_NAME} ${DIR_SRCS})
# shared
# find_package(Threads REQUIRED)
# target_link_libraries(${PROJECT_NAME} Threads::Threads)
# target_link_libraries(${PROJECT_NAME} ws2_32)
# Copy dll to run dir.
file(COPY ${CMAKE_CURRENT_SOURCE_DIR}/libs/datachannel.dll DESTINATION ${CMAKE_CURRENT_BINARY_DIR})
file(COPY ${CMAKE_CURRENT_SOURCE_DIR}/libs/ffmpeg/avcodec-60.dll DESTINATION ${CMAKE_CURRENT_BINARY_DIR})
file(COPY ${CMAKE_CURRENT_SOURCE_DIR}/libs/ffmpeg/avformat-60.dll DESTINATION ${CMAKE_CURRENT_BINARY_DIR})
file(COPY ${CMAKE_CURRENT_SOURCE_DIR}/libs/ffmpeg/avutil-58.dll DESTINATION ${CMAKE_CURRENT_BINARY_DIR})
file(COPY ${CMAKE_CURRENT_SOURCE_DIR}/libs/ffmpeg/postproc-57.dll DESTINATION ${CMAKE_CURRENT_BINARY_DIR})
file(COPY ${CMAKE_CURRENT_SOURCE_DIR}/libs/ffmpeg/swresample-4.dll DESTINATION ${CMAKE_CURRENT_BINARY_DIR})