cmake_minimum_required(VERSION 3.15.0) project(stitch VERSION 0.1.0) set(CMAKE_CXX_STANDARD 17) # 或更高版本 set(CMAKE_CXX_STANDARD_REQUIRED ON) SET(ArithStitchDir stitch) # 设置第三方库根目录 set(THIRD_PARTY_DIR ${CMAKE_CURRENT_SOURCE_DIR}/3rdParty) # ======== OpenCV 配置 ======== set(OpenCV_DIR "C:/Lib/opencv455/build/x64/vc14/lib") find_package(OpenCV REQUIRED) include_directories(${OpenCV_INCLUDE_DIRS}) message(STATUS "OpenCV_LIBS: ${OpenCV_LIBS}") link_directories(${OpenCV_LIBS_DIR}) # ======== FFMPEG配置 ======== set(FFMPEG_DIR ${THIRD_PARTY_DIR}) set(FFMPEG_INCLUDE_DIRS ${THIRD_PARTY_DIR}/include/ffmpeg) set(FFMPEG_LIBS_DIR ${THIRD_PARTY_DIR}/lib) # ======== Ceres 配置 ======== set(Ceres_DIR ${THIRD_PARTY_DIR}) set(CERES_INCLUDE_DIRS ${THIRD_PARTY_DIR}/include) set(CERES_LIBRARIES ceres) # ======== Eigen 配置 ======== set(EIGEN_INCLUDE_DIRS ${THIRD_PARTY_DIR}/include) # ======== gflags 配置 ======== set(GFLAGS_INCLUDE_DIRS ${THIRD_PARTY_DIR}/include) set(GFLAGS_LIBRARIES gflags) # ======== glog 配置 ======== set(GLOG_INCLUDE_DIRS ${THIRD_PARTY_DIR}/include) set(GLOG_LIBRARIES glog) # 设置所有第三方库的包含目录 set(THIRD_PARTY_INCLUDE_DIRS ${OpenCV_INCLUDE_DIRS} ${FFMPEG_INCLUDE_DIRS} ${CERES_INCLUDE_DIRS} ${EIGEN_INCLUDE_DIRS} ${GFLAGS_INCLUDE_DIRS} ${GLOG_INCLUDE_DIRS} ) message(${FFMPEG_INCLUDE_DIRS}) # 设置所有第三方库的库目录 link_directories(${THIRD_PARTY_DIR}/lib) # 设置所有第三方库的库文件 set(THIRD_PARTY_LIBRARIES ${OpenCV_LIBS} ${CERES_LIBRARIES} ${GFLAGS_LIBRARIES} ${GLOG_LIBRARIES} CACHE STRING "Third party libraries" ) include_directories(${THIRD_PARTY_INCLUDE_DIRS} ${Stitch_INCLUDE_DIRS} public_include ${ArithStitchDir}/src) include_directories(${FFMPEG_DIR}) # 设置算法库目录 SET(LIB_STITCH GuideStitch) add_subdirectory(stitch) add_executable(stitch main.cpp) target_link_libraries(stitch ${Stitch_LIBS} ${LIB_STITCH}) add_executable(stitch_DJ "ProcDJ.cpp") target_link_libraries(stitch_DJ ${Stitch_LIBS} ${LIB_STITCH}) add_executable(stitch_Fea "feaStitchTest.cpp") target_link_libraries(stitch_Fea ${Stitch_LIBS} ${LIB_STITCH}) add_executable(stitch_Genaral "stitch_Genaral.cpp" "utils.cpp") target_link_libraries(stitch_Genaral ${Stitch_LIBS} ${LIB_STITCH}) add_executable(stitch_udp "stitch_udp.cpp" "decodedata.h" "decodedata.cpp") target_link_libraries(stitch_udp ${Stitch_LIBS} ${LIB_STITCH} ) target_include_directories(stitch_udp PUBLIC ${FFMPEG_INCLUDE_DIRS}) add_subdirectory(convert) # 可执行文件输出路径 set(EXECUTABLE_OUTPUT_PATH ${CMAKE_SOURCE_DIR}/Bin)