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) target_link_libraries(stitch ${LIB_STITCH}) # 测试用例2 add_executable(stitch_DJ "tests/ProcDJ.cpp") target_link_libraries(stitch_DJ ${LIB_STITCH}) # 测试用例3 add_executable(stitch_Fea "tests/feaStitchTest.cpp") target_link_libraries(stitch_Fea ${LIB_STITCH}) # 测试用例4 add_executable(stitch_Genaral "tests/stitch_Genaral.cpp" "tests/utils.cpp") target_link_libraries(stitch_Genaral ${LIB_STITCH}) #S732 add_executable(stitch_S732_VL "tests/stitch_S732.cpp" "tests/S732.h" "tests/utils.cpp") target_link_libraries(stitch_S732_VL ${LIB_STITCH} ${OpenCV_LIBS}) # 测试用例5:s732 UDP IF(WIN32) # ======== FFMPEG配置 ======== set(FFMPEG_DIR "C:/Lib/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 "${FFMPEG_LIBS_DIR}/avcodec.lib" "${FFMPEG_LIBS_DIR}/avformat.lib" "${FFMPEG_LIBS_DIR}/avutil.lib" "${FFMPEG_LIBS_DIR}/swscale.lib" "${FFMPEG_LIBS_DIR}/swresample.lib") add_executable(stitch_udp "tests/stitch_udp.cpp" "tests/decodedata.h" "tests/decodedata.cpp") target_link_libraries(stitch_udp ${LIB_STITCH} ${FFMPEG_LIBRARIES} ${OpenCV_LIBS}) target_link_libraries(stitch_udp PRIVATE) target_include_directories(stitch_udp PUBLIC ${FFMPEG_INCLUDE_DIRS}) ENDIF() # 格式转换 add_subdirectory(convert) # 可执行文件输出路径 set(EXECUTABLE_OUTPUT_PATH ${CMAKE_SOURCE_DIR}/Bin)