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) add_subdirectory(stitch) include_directories(tests) # 测试用例1 add_executable(stitch tests/main.cpp "tests/S7215/Arith_zhryp.cpp" "tests/S7215/Arith_zhryp.h") target_link_libraries(stitch ${LIB_STITCH}) # 测试用例2 add_executable(stitch_DJ "tests/DJ/ProcDJ.cpp" "tests/S7215/Arith_zhryp.cpp" "tests/S7215/Arith_zhryp.h") target_link_libraries(stitch_DJ ${LIB_STITCH}) # 测试用例3 add_executable(stitch_Fea "tests/feaStitchTest.cpp" "tests/S7215/Arith_zhryp.cpp" "tests/S7215/Arith_zhryp.h") target_link_libraries(stitch_Fea ${LIB_STITCH}) # 测试用例4 add_executable(stitch_Genaral "tests/stitch_Genaral.cpp" "tests/utils.cpp" "tests/S7215/Arith_zhryp.cpp" "tests/S7215/Arith_zhryp.h") target_link_libraries(stitch_Genaral ${LIB_STITCH}) #S732 add_executable(stitch_S732_VL "tests/S732/stitch_S732.cpp" "tests/S732/S732.h" "tests/S7215/Arith_zhryp.cpp" "tests/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/S732/stitch_udp.cpp" "tests/S732/decodedata.h" "tests/S732/decodedata.cpp" "tests/S7215/Arith_zhryp.cpp" "tests/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/S7215/TsDecoder.hpp" "tests/S7215/TsPacker.hpp" "tests/S7215/stitch_S7215.cpp" "tests/S7215/Arith_zhryp.cpp" "tests/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() # ======== FFMPEG配置 ======== set(FFMPEG_INCLUDE_DIRS "/usr/include/x86_64-linux-gnu") set(FFMPEG_LIBS_DIR "/usr/lib/x86_64-linux-gnu") include_directories(${FFMPEG_INCLUDE_DIRS}) set(FFMPEG_LIBRARIES "avdevice" "avcodec" "avformat" "avutil" "swscale" "swresample") # == Qt 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/S7215/TsDecoder.hpp" "tests/S7215/TsPacker.hpp" "tests/S7215/stitch_S7215.cpp" "tests/S7215/Arith_zhryp.cpp" "tests/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) ENDIF() # 可执行文件输出路径 set(EXECUTABLE_OUTPUT_PATH ${CMAKE_SOURCE_DIR}/Bin)