You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
203 lines
6.1 KiB
203 lines
6.1 KiB
cmake_minimum_required(VERSION 3.15.0)
|
|
project(stitch VERSION 0.1.0)
|
|
|
|
set(CMAKE_CXX_STANDARD 17) # 或更高版本
|
|
set(CMAKE_CXX_STANDARD_REQUIRED ON)
|
|
|
|
|
|
|
|
IF(WIN32)
|
|
# ======== OpenCV 配置 ========
|
|
set(OpenCV_DIR "C:/lib/opencv455/build/x64/vc14/lib")
|
|
find_package(OpenCV REQUIRED)
|
|
include_directories(${OpenCV_INCLUDE_DIRS})
|
|
link_libraries(${OpenCV_LIBS})
|
|
|
|
# ======== Ceres 配置 ========
|
|
set(Ceres_DIR ${CMAKE_SOURCE_DIR}/3rdParty/ceres_2.2)
|
|
|
|
set(Ceres_INCLUDE_DIR
|
|
${Ceres_DIR}/include
|
|
${Ceres_DIR}/include/ceres
|
|
${Ceres_DIR}/include/eigen3
|
|
${Ceres_DIR}/include/eigen3/Eigen
|
|
${Ceres_DIR}/include/gflags
|
|
${Ceres_DIR}/include/glog)
|
|
include_directories(${Ceres_INCLUDE_DIR})
|
|
|
|
|
|
|
|
set(CERES_LIBRARIES
|
|
"${Ceres_DIR}/lib/ceres.lib"
|
|
"${Ceres_DIR}/lib/gflags.lib"
|
|
"${Ceres_DIR}/lib/glog.lib"
|
|
)
|
|
|
|
if(CMAKE_BUILD_TYPE STREQUAL "Debug")
|
|
set(CERES_LIBRARIES
|
|
"${Ceres_DIR}/lib/ceres-debug.lib"
|
|
"${Ceres_DIR}/lib/gflags_debug.lib"
|
|
"${Ceres_DIR}/lib/glogd.lib"
|
|
)
|
|
endif()
|
|
|
|
ELSE()
|
|
# ======== OpenCV 配置 ========
|
|
find_package(OpenCV REQUIRED)
|
|
include_directories(${OpenCV_INCLUDE_DIRS})
|
|
link_libraries(${OpenCV_LIBS})
|
|
# ======== Ceres 配置 ========
|
|
find_package(Ceres REQUIRED)
|
|
include_directories(${Ceres_INCLUDE_DIR})
|
|
|
|
ENDIF()
|
|
|
|
# ======== Ceres 配置 ========
|
|
|
|
|
|
# 拼接算法库设置
|
|
SET(LIB_STITCH GuideStitch)
|
|
SET(LIB_STITCH_STATIC GuideStitchStatic)
|
|
add_subdirectory(stitch)
|
|
|
|
include_directories(tests)
|
|
|
|
|
|
# 测试用例1
|
|
add_executable(stitch tests/cpp/main.cpp "tests/cpp/S7215/Arith_zhryp.cpp" "tests/cpp/S7215/Arith_zhryp.h")
|
|
target_link_libraries(stitch ${LIB_STITCH})
|
|
|
|
# 测试用例2
|
|
add_executable(stitch_DJ "tests/cpp/DJ/ProcDJ.cpp" "tests/cpp/S7215/Arith_zhryp.cpp" "tests/cpp/S7215/Arith_zhryp.h")
|
|
target_link_libraries(stitch_DJ ${LIB_STITCH})
|
|
|
|
# 测试用例3
|
|
add_executable(stitch_Fea "tests/cpp/feaStitchTest.cpp" "tests/cpp/S7215/Arith_zhryp.cpp" "tests/cpp/S7215/Arith_zhryp.h")
|
|
target_link_libraries(stitch_Fea ${LIB_STITCH})
|
|
|
|
# 测试用例4
|
|
add_executable(stitch_Genaral "tests/cpp/stitch_Genaral.cpp" "tests/cpp/utils.cpp" "tests/cpp/S7215/Arith_zhryp.cpp" "tests/cpp/S7215/Arith_zhryp.h")
|
|
target_link_libraries(stitch_Genaral ${LIB_STITCH})
|
|
|
|
|
|
#S732
|
|
add_executable(stitch_S732_VL "tests/cpp/S732/stitch_S732.cpp" "tests/cpp/S732/S732.h" "tests/cpp/S7215/Arith_zhryp.cpp" "tests/cpp/S7215/Arith_zhryp.h")
|
|
target_link_libraries(stitch_S732_VL ${LIB_STITCH} ${OpenCV_LIBS})
|
|
|
|
|
|
|
|
# 测试用例5:s732 UDP
|
|
IF(WIN32)
|
|
# ======== FFMPEG配置 ========
|
|
set(FFMPEG_DIR "./3rdParty/ffmpeg4")
|
|
set(FFMPEG_INCLUDE_DIRS ${FFMPEG_DIR}/include)
|
|
set(FFMPEG_LIBS_DIR ${FFMPEG_DIR}/lib/)
|
|
include_directories(${FFMPEG_DIR})
|
|
include_directories(${FFMPEG_INCLUDE_DIRS})
|
|
|
|
|
|
set(FFMPEG_LIBRARIES "avcodec" "avformat" "avutil" "swscale" "swresample")
|
|
|
|
add_executable(stitch_udp "tests/cpp/S732/stitch_udp.cpp" "tests/cpp/S732/decodedata.h" "tests/cpp/S732/decodedata.cpp" "tests/cpp/S7215/Arith_zhryp.cpp" "tests/cpp/S7215/Arith_zhryp.h")
|
|
target_link_directories(stitch_udp PUBLIC ${FFMPEG_LIBS_DIR})
|
|
target_include_directories(stitch_udp PUBLIC ${FFMPEG_INCLUDE_DIRS})
|
|
target_link_libraries(stitch_udp ${LIB_STITCH} ${FFMPEG_LIBRARIES} ${OpenCV_LIBS})
|
|
|
|
|
|
ENDIF()
|
|
|
|
# 格式转换
|
|
#add_subdirectory(convert)
|
|
|
|
# 测试用例5:s7215 ts码流
|
|
IF(WIN32)
|
|
# ======== FFMPEG配置 ========
|
|
set(FFMPEG_DIR "./3rdParty/ffmpeg4")
|
|
set(FFMPEG_INCLUDE_DIRS ${FFMPEG_DIR}/include)
|
|
set(FFMPEG_LIBS_DIR ${FFMPEG_DIR}/lib/)
|
|
include_directories(${FFMPEG_DIR})
|
|
include_directories(${FFMPEG_INCLUDE_DIRS})
|
|
set(FFMPEG_LIBRARIES "avdevice" "avcodec" "avformat" "avutil" "swscale" "swresample")
|
|
|
|
# == Qt
|
|
set(Qt_DIR "C:/Qt/5.15.2/msvc2015_64")
|
|
find_package(QT NAMES Qt5 REQUIRED COMPONENTS Widgets )
|
|
find_package(Qt${QT_VERSION_MAJOR} REQUIRED COMPONENTS Widgets )
|
|
find_package(Qt5 REQUIRED COMPONENTS PrintSupport)
|
|
set(TS_FILES QGuideArith_zh_CN.ts)
|
|
|
|
set(CMAKE_AUTOUIC ON)
|
|
set(CMAKE_AUTOMOC ON)
|
|
set(CMAKE_AUTORCC ON)
|
|
|
|
add_executable(stitch_S7215ts "tests/cpp/S7215/TsDecoder.hpp" "tests/cpp/S7215/TsPacker.hpp" "tests/cpp/S7215/stitch_S7215.cpp" "tests/cpp/S7215/Arith_zhryp.cpp" "tests/cpp/S7215/Arith_zhryp.h")
|
|
target_link_directories(stitch_S7215ts PUBLIC ${FFMPEG_LIBS_DIR})
|
|
target_include_directories(stitch_S7215ts PUBLIC ${FFMPEG_INCLUDE_DIRS})
|
|
target_link_libraries(stitch_S7215ts ${LIB_STITCH} ${FFMPEG_LIBRARIES} ${OpenCV_LIBS} Qt${QT_VERSION_MAJOR}::Core)
|
|
|
|
ELSE()
|
|
# # ======== Qt5 配置 ========
|
|
# find_package(QT NAMES Qt5 REQUIRED COMPONENTS Core Widgets)
|
|
# find_package(Qt${QT_VERSION_MAJOR} REQUIRED COMPONENTS Core Widgets)
|
|
|
|
# message(STATUS "QT_VERSION_MAJOR: ${QT_VERSION_MAJOR}")
|
|
# message(STATUS "Qt5_FOUND: ${Qt5_FOUND}")
|
|
# message(STATUS "Qt5_VERSION: ${Qt5_VERSION}")
|
|
|
|
# # 启用Qt的MOC、UIC、RCC自动处理
|
|
# set(CMAKE_AUTOUIC ON)
|
|
# set(CMAKE_AUTOMOC ON)
|
|
# set(CMAKE_AUTORCC ON)
|
|
|
|
# # ======== FFMPEG配置 ========
|
|
# # 尝试多个可能的FFmpeg安装路径
|
|
# set(FFMPEG_POSSIBLE_PATHS
|
|
# "/usr"
|
|
# )
|
|
|
|
# set(FFMPEG_INCLUDE_DIRS ${FFMPEG_DIR}/include)
|
|
# set(FFMPEG_LIBS_DIR ${FFMPEG_DIR}/lib)
|
|
# set(FFMPEG_LIBRARIES "avdevice" "avcodec" "avformat" "avutil" "swscale" "swresample")
|
|
# include_directories(${FFMPEG_INCLUDE_DIRS})
|
|
# message(STATUS "FFmpeg found at: ${FFMPEG_DIR}")
|
|
|
|
|
|
|
|
# # ======== 构建 stitch_S7215ts 可执行文件 ========
|
|
# add_executable(stitch_S7215ts
|
|
# "tests/cpp/S7215/TsDecoder.hpp"
|
|
# "tests/cpp/S7215/TsPacker.hpp"
|
|
# "tests/cpp/S7215/stitch_S7215.cpp"
|
|
# "tests/cpp/S7215/Arith_zhryp.cpp"
|
|
# "tests/cpp/S7215/Arith_zhryp.h"
|
|
# )
|
|
|
|
# # 设置链接目录
|
|
# if(NOT FFMPEG_LIBS_DIR STREQUAL "")
|
|
# target_link_directories(stitch_S7215ts PUBLIC ${FFMPEG_LIBS_DIR})
|
|
# endif()
|
|
|
|
# # 设置包含目录
|
|
# if(FFMPEG_INCLUDE_DIRS)
|
|
# target_include_directories(stitch_S7215ts PUBLIC ${FFMPEG_INCLUDE_DIRS})
|
|
# endif()
|
|
|
|
# # 链接所有库
|
|
# target_link_libraries(stitch_S7215ts
|
|
# ${LIB_STITCH}
|
|
# ${FFMPEG_LIBRARIES}
|
|
# ${OpenCV_LIBS}
|
|
# Qt${QT_VERSION_MAJOR}::Core
|
|
# )
|
|
|
|
ENDIF()
|
|
|
|
|
|
add_executable(stitch_GeoCorrect "tests/cpp/Test_GeoCorrect.cpp")
|
|
target_link_libraries(stitch_GeoCorrect ${LIB_STITCH})
|
|
|
|
# 可执行文件输出路径
|
|
set(EXECUTABLE_OUTPUT_PATH ${CMAKE_SOURCE_DIR}/Bin)
|
|
|
|
|